@@ -81,8 +81,8 @@ echo_latest_version() {
81
81
82
82
echo_standalone_postinstall () {
83
83
echoh
84
- cath << EOF
85
- Standalone release has been installed into $STANDALONE_INSTALL_PREFIX /lib /coder- $VERSION
84
+ cath << EOF
85
+ Standalone release has been installed into $STANDALONE_INSTALL_PREFIX /bin /coder
86
86
87
87
Extend your path to use Coder:
88
88
PATH="$STANDALONE_INSTALL_PREFIX /bin:\$ PATH"
98
98
99
99
echo_systemd_postinstall () {
100
100
echoh
101
- cath << EOF
101
+ cath << EOF
102
102
$1 package has been installed.
103
103
104
104
To run Coder as a system service:
@@ -347,8 +347,15 @@ install_standalone() {
347
347
echoh " Installing v$VERSION of the $ARCH release from GitHub."
348
348
echoh
349
349
350
- fetch " https://github.com/coder/coder/releases/download/v$VERSION /coder_${VERSION} _${OS} _${ARCH} .tar.gz" \
351
- " $CACHE_DIR /coder_${VERSION} _${OS} _${ARCH} .tar"
350
+ # MacOS and Windows releases are packaged as .zip
351
+ case $OS in
352
+ darwin) STANDALONE_ARCHIVE_FORMAT=zip ;;
353
+ windows) STANDALONE_ARCHIVE_FORMAT=zip ;;
354
+ * ) STANDALONE_ARCHIVE_FORMAT=tar.gz ;;
355
+ esac
356
+
357
+ fetch " https://github.com/coder/coder/releases/download/v$VERSION /coder_${VERSION} _${OS} _${ARCH} .$STANDALONE_ARCHIVE_FORMAT " \
358
+ " $CACHE_DIR /coder_${VERSION} _${OS} _${ARCH} .$STANDALONE_ARCHIVE_FORMAT "
352
359
353
360
# -w only works if the directory exists so try creating it first. If this
354
361
# fails we can ignore the error as the -w check will then swap us to sudo.
@@ -359,27 +366,26 @@ install_standalone() {
359
366
sh_c=" sudo_sh_c"
360
367
fi
361
368
362
- if [ -e " $STANDALONE_INSTALL_PREFIX /lib/coder_ $VERSION " ] ; then
363
- echoh
364
- echoh " coder_ $VERSION is already installed at $STANDALONE_INSTALL_PREFIX /lib/ coder_$VERSION "
365
- echoh " Remove it to reinstall. "
366
- exit 0
369
+ " $sh_c " mkdir -p " $STANDALONE_INSTALL_PREFIX /bin "
370
+ if [ " $STANDALONE_ARCHIVE_FORMAT " == tar.gz ] ; then
371
+ " $sh_c " tar -C " $CACHE_DIR " -xzf " $CACHE_DIR / coder_${ VERSION} _ ${OS} _ ${ARCH} .tar.gz "
372
+ else
373
+ " $sh_c " unzip -d " $CACHE_DIR " -o " $CACHE_DIR /coder_ ${VERSION} _ ${OS} _ ${ARCH} .zip "
367
374
fi
368
375
369
- " $sh_c " mkdir -p " $STANDALONE_INSTALL_PREFIX /lib" " $STANDALONE_INSTALL_PREFIX /bin"
370
- " $sh_c " tar -C " $STANDALONE_INSTALL_PREFIX /lib" -xzf " $CACHE_DIR /coder_${VERSION} _${OS} _${ARCH} .tar"
371
- " $sh_c " ln -fs " $STANDALONE_INSTALL_PREFIX /lib/coder/bin/coder" " $STANDALONE_INSTALL_PREFIX /bin/coder"
376
+ " $sh_c " cp " $CACHE_DIR /coder" " $STANDALONE_INSTALL_PREFIX /bin/coder"
372
377
373
378
echo_standalone_postinstall
374
379
}
375
380
376
381
# Determine if we have standalone releases on GitHub for the system's arch.
382
+ # TODO: fix for Coder v2
377
383
has_standalone () {
378
384
case $ARCH in
379
385
amd64) return 0 ;;
380
386
# We only have amd64 for macOS.
381
387
arm64)
382
- [ " $( distro) " != macos ]
388
+ [ " $( distro) " != darwin ]
383
389
return
384
390
;;
385
391
* ) return 1 ;;
@@ -390,7 +396,7 @@ os() {
390
396
uname=" $( uname) "
391
397
case $uname in
392
398
Linux) echo linux ;;
393
- Darwin) echo macos ;;
399
+ Darwin) echo darwin ;;
394
400
FreeBSD) echo freebsd ;;
395
401
* ) echo " $uname " ;;
396
402
esac
@@ -399,7 +405,7 @@ os() {
399
405
# Print the detected Linux distro, otherwise print the OS name.
400
406
#
401
407
# Example outputs:
402
- # - macos -> macos
408
+ # - darwin -> darwin
403
409
# - freebsd -> freebsd
404
410
# - ubuntu, raspbian, debian ... -> debian
405
411
# - amzn, centos, rhel, fedora, ... -> fedora
@@ -409,7 +415,7 @@ os() {
409
415
#
410
416
# Inspired by https://github.com/docker/docker-install/blob/26ff363bcf3b3f5a00498ac43694bf1c7d9ce16c/install.sh#L111-L120.
411
417
distro () {
412
- if [ " $OS " = " macos " ] || [ " $OS " = " freebsd" ]; then
418
+ if [ " $OS " = " darwin " ] || [ " $OS " = " freebsd" ]; then
413
419
echo " $OS "
414
420
return
415
421
fi
0 commit comments