Skip to content

Commit 7705a05

Browse files
committed
install.sh: Add should_update to prevent reinstalling if already installed
Updates #2219
1 parent 650c88c commit 7705a05

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

install.sh

+19
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,10 @@ main() {
201201
exit 1
202202
fi
203203

204+
if ! should_update; then
205+
return 0
206+
fi
207+
204208
distro_name
205209

206210
ARCH="$(arch)"
@@ -489,6 +493,21 @@ arch() {
489493
esac
490494
}
491495

496+
should_update() {
497+
if ! command_exists code-server; then
498+
return 0
499+
fi
500+
501+
installed_version="$(code-server --version | cut -d " " -f1)"
502+
if [ "$installed_version" != "$VERSION" ]; then
503+
echo "updating as installed version v$installed_version does not match version v$VERSION"
504+
return 0
505+
fi
506+
507+
echo "already on version v$VERSION"
508+
return 1
509+
}
510+
492511
command_exists() {
493512
command -v "$@" > /dev/null
494513
}

0 commit comments

Comments
 (0)