From dcc30c5b864ffca791f50ff7f68e98097f3a878f Mon Sep 17 00:00:00 2001 From: kj_sh604 Date: Tue, 19 May 2026 20:27:35 -0400 Subject: refactor: wrapper script rename and build messages --- .gitignore | 1 + build-code-server.sh | 2 ++ code-server | 22 ++++++++++++++++++++++ code-server-wrapper.sh | 22 ---------------------- 4 files changed, 25 insertions(+), 22 deletions(-) create mode 100644 .gitignore create mode 100755 code-server delete mode 100755 code-server-wrapper.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0f45c32 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.AppImage \ No newline at end of file diff --git a/build-code-server.sh b/build-code-server.sh index 60d904b..e87a1a9 100755 --- a/build-code-server.sh +++ b/build-code-server.sh @@ -134,3 +134,5 @@ printf ' output: %s\n\n' "$OUTPUT" printf 'usage:\n' printf ' regular system: ./%s-%s-%s.AppImage\n' "$PKGNAME" "$PKGVER" "$UNAME_ARCH" printf ' docker/no-fuse: APPIMAGE_EXTRACT_AND_RUN=1 ./%s-%s-%s.AppImage\n' "$PKGNAME" "$PKGVER" "$UNAME_ARCH" + +printf '\nmove %s to /opt/code-server-appimage/ within your environment and use the code-server wrapper script to run it\n\n' "$OUTPUT" \ No newline at end of file diff --git a/code-server b/code-server new file mode 100755 index 0000000..22b50c9 --- /dev/null +++ b/code-server @@ -0,0 +1,22 @@ +#!/bin/sh + +APPIMAGE_DIR="/opt/code-server-appimage" + +# - find the AppImage; fail clearly if missing or ambiguous +_match="$(find "$APPIMAGE_DIR" -maxdepth 1 -name 'code-server-*.AppImage' 2>/dev/null)" +_count="$(printf '%s\n' "$_match" | grep -c 'AppImage' 2>/dev/null || echo 0)" + +if [ "$_count" -eq 0 ]; then + printf 'error: no code-server AppImage found in %s\n' "$APPIMAGE_DIR" >&2 + exit 1 +fi + +if [ "$_count" -gt 1 ]; then + printf 'error: multiple AppImages found in %s - keep only one:\n' "$APPIMAGE_DIR" >&2 + printf '%s\n' "$_match" >&2 + exit 1 +fi + +APPIMAGE="$_match" +export APPIMAGE_EXTRACT_AND_RUN=1 +exec "$APPIMAGE" "$@" \ No newline at end of file diff --git a/code-server-wrapper.sh b/code-server-wrapper.sh deleted file mode 100755 index 612d2ab..0000000 --- a/code-server-wrapper.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -APPIMAGE_DIR="/opt/code-server-appimage" - -# - find the AppImage; fail clearly if missing or ambiguous -_match="$(find "$APPIMAGE_DIR" -maxdepth 1 -name 'code-server-*.AppImage' 2>/dev/null)" -_count="$(printf '%s\n' "$_match" | grep -c 'AppImage' 2>/dev/null || echo 0)" - -if [ "$_count" -eq 0 ]; then - printf 'error: no code-server AppImage found in %s\n' "$APPIMAGE_DIR" >&2 - exit 1 -fi - -if [ "$_count" -gt 1 ]; then - printf 'error: multiple AppImages found in %s - keep only one:\n' "$APPIMAGE_DIR" >&2 - printf '%s\n' "$_match" >&2 - exit 1 -fi - -APPIMAGE="$_match" -export APPIMAGE_EXTRACT_AND_RUN=1 -exec "$APPIMAGE" "$@" -- cgit v1.2.3