@@ -32,42 +32,38 @@ function update_script() {
3232 if check_for_gh_release " pangolin" " fosrl/pangolin" ; then
3333 msg_info " Stopping Service"
3434 systemctl stop pangolin
35+ systemctl stop gerbil
3536 msg_info " Service stopped"
3637
3738 msg_info " Creating backup"
3839 tar -czf /opt/pangolin_config_backup.tar.gz -C /opt/pangolin config
3940 msg_ok " Created backup"
4041
41- fetch_and_deploy_gh_release " pangolin" " fosrl/pangolin" " tarball"
42- fetch_and_deploy_gh_release " gerbil" " fosrl/gerbil" " singlefile" " latest" " /usr/bin" " gerbil_linux_amd64"
42+ CLEAN_INSTALL=1 fetch_and_deploy_gh_release " pangolin" " fosrl/pangolin" " tarball"
43+ CLEAN_INSTALL=1 fetch_and_deploy_gh_release " gerbil" " fosrl/gerbil" " singlefile" " latest" " /usr/bin" " gerbil_linux_amd64"
4344
4445 msg_info " Updating Pangolin"
45- export BUILD=oss
46- export DATABASE=sqlite
4746 cd /opt/pangolin
4847 $STD npm ci
49- echo " export * from \" ./$DATABASE \" ;" > server/db/index.ts
50- echo " export const build = \" $BUILD \" as any;" > server/build.ts
51- cp tsconfig.oss.json tsconfig.json
52- $STD npm run next:build
53- $STD node esbuild.mjs -e server/index.ts -o dist/server.mjs -b $BUILD
54- $STD node esbuild.mjs -e server/setup/migrationsSqlite.ts -o dist/migrations.mjs
48+ $STD npm run set:sqlite
49+ $STD npm run set:oss
50+ rm -rf server/private
51+ $STD npm run build:sqlite
5552 $STD npm run build:cli
5653 cp -R .next/standalone ./
57-
58- cat << EOF >/usr/local/bin/pangctl
59- #!/bin/sh
60- cd /opt/pangolin
61- ./dist/cli.mjs "$@ "
62- EOF
63- chmod +x /usr/local/bin/pangctl ./dist/cli.mjs
54+ chmod +x ./dist/cli.mjs
6455 cp server/db/names.json ./dist/names.json
6556 msg_ok " Updated Pangolin"
6657
6758 msg_info " Restoring config"
6859 tar -xzf /opt/pangolin_config_backup.tar.gz -C /opt/pangolin --overwrite
6960 rm -f /opt/pangolin_config_backup.tar.gz
7061 msg_ok " Restored config"
62+
63+ msg_info " Starting Services"
64+ systemctl start pangolin
65+ systemctl start gerbil
66+ msg_ok " Started Services"
7167 msg_ok " Updated successfully!"
7268 fi
7369 exit
0 commit comments