Skip to content

Commit 78e429e

Browse files
committed
Add advert to code-server install
1 parent e759950 commit 78e429e

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

flake.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
in {
1313
devShells.default = pkgs.mkShell {
1414
nativeBuildInputs = with pkgs; [
15-
nodejs yarn' python pkg-config git rsync jq moreutils quilt
15+
nodejs yarn' python pkg-config git rsync jq moreutils quilt bats
1616
];
1717
buildInputs = with pkgs; (lib.optionals (!stdenv.isDarwin) [ libsecret ]
1818
++ (with xorg; [ libX11 libxkbfile ])

install.sh

+7-2
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ Or, if you don't want/need a background service you can run:
131131
EOF
132132
}
133133

134+
echo_coder_postinstall() {
135+
echoh
136+
echoh "Deploy code-server for your team with Coder: https://github.com/coder/coder"
137+
}
138+
134139
main() {
135140
if [ "${TRACE-}" ]; then
136141
set -x
@@ -243,6 +248,7 @@ main() {
243248
if [ "$METHOD" = standalone ]; then
244249
if has_standalone; then
245250
install_standalone
251+
echo_coder_postinstall
246252
exit 0
247253
else
248254
echoerr "There are no standalone releases for $ARCH"
@@ -287,8 +293,7 @@ main() {
287293
;;
288294
esac
289295

290-
echoh
291-
echoh "Deploy code-server for your team with Coder: https://github.com/coder/coder"
296+
echo_coder_postinstall
292297
}
293298

294299
parse_arg() {

test/scripts/install.bats

+9-9
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ function should-use-deb() {
1111
DISTRO=$1 ARCH=$2 OS=linux run "$SCRIPT" --dry-run
1212
[ "$status" -eq 0 ]
1313
[ "${lines[1]}" = "Installing v$VERSION of the $2 deb package from GitHub." ]
14-
[ "${lines[-5]}" = "deb package has been installed." ]
14+
[ "${lines[-6]}" = "deb package has been installed." ]
1515
}
1616

1717
function should-use-rpm() {
1818
DISTRO=$1 ARCH=$2 OS=linux run "$SCRIPT" --dry-run
1919
[ "$status" -eq 0 ]
2020
[ "${lines[1]}" = "Installing v$VERSION of the $2 rpm package from GitHub." ]
21-
[ "${lines[-5]}" = "rpm package has been installed." ]
21+
[ "${lines[-6]}" = "rpm package has been installed." ]
2222
}
2323

2424
function should-fallback-npm() {
@@ -27,21 +27,21 @@ function should-fallback-npm() {
2727
[ "${lines[1]}" = "No standalone releases for $2." ]
2828
[ "${lines[2]}" = "Falling back to installation from npm." ]
2929
[ "${lines[3]}" = "Installing latest from npm." ]
30-
[ "${lines[-5]}" = "npm package has been installed." ]
30+
[ "${lines[-6]}" = "npm package has been installed." ]
3131
}
3232

3333
function should-use-npm() {
3434
YARN_PATH=true DISTRO=$1 ARCH=$2 OS=linux run "$SCRIPT" --dry-run
3535
[ "$status" -eq 0 ]
3636
[ "${lines[1]}" = "Installing latest from npm." ]
37-
[ "${lines[-5]}" = "npm package has been installed." ]
37+
[ "${lines[-6]}" = "npm package has been installed." ]
3838
}
3939

4040
function should-use-aur() {
4141
DISTRO=$1 ARCH=$2 OS=linux run "$SCRIPT" --dry-run
4242
[ "$status" -eq 0 ]
4343
[ "${lines[1]}" = "Installing latest from the AUR." ]
44-
[ "${lines[-5]}" = "AUR package has been installed." ]
44+
[ "${lines[-6]}" = "AUR package has been installed." ]
4545
}
4646

4747
function should-fallback-npm-brew() {
@@ -52,21 +52,21 @@ function should-fallback-npm-brew() {
5252
[ "${lines[3]}" = "No standalone releases for $1." ]
5353
[ "${lines[4]}" = "Falling back to installation from npm." ]
5454
[ "${lines[5]}" = "Installing latest from npm." ]
55-
[ "${lines[-5]}" = "npm package has been installed." ]
55+
[ "${lines[-6]}" = "npm package has been installed." ]
5656
}
5757

5858
function should-use-brew() {
5959
BREW_PATH=true OS=macos ARCH=$1 run "$SCRIPT" --dry-run
6060
[ "$status" -eq 0 ]
6161
[ "${lines[1]}" = "Installing latest from Homebrew." ]
62-
[ "${lines[-3]}" = "Brew release has been installed." ]
62+
[ "${lines[-4]}" = "Brew release has been installed." ]
6363
}
6464

6565
function should-use-standalone() {
6666
DISTRO=$1 ARCH=$2 OS=$3 run "$SCRIPT" --method standalone --dry-run
6767
[ "$status" -eq 0 ]
6868
[ "${lines[1]}" = "Installing v$VERSION of the $2 release from GitHub." ]
69-
[[ "${lines[-5]}" = "Standalone release has been installed"* ]]
69+
[[ "${lines[-6]}" = "Standalone release has been installed"* ]]
7070
}
7171

7272
@test "$SCRIPT_NAME: usage with --help" {
@@ -141,7 +141,7 @@ function should-use-standalone() {
141141
[ "${lines[1]}" = "Homebrew not installed." ]
142142
[ "${lines[2]}" = "Falling back to standalone installation." ]
143143
[ "${lines[3]}" = "Installing v$VERSION of the amd64 release from GitHub." ]
144-
[[ "${lines[-5]}" = "Standalone release has been installed"* ]]
144+
[[ "${lines[-6]}" = "Standalone release has been installed"* ]]
145145
}
146146
@test "$SCRIPT_NAME: macos i386 (no brew)" {
147147
should-fallback-npm-brew "i386"

0 commit comments

Comments
 (0)