From ee9d867347468222be83035f4c53279051ecdf94 Mon Sep 17 00:00:00 2001 From: Iskander Date: Tue, 21 Jan 2025 11:52:29 +0100 Subject: [PATCH 01/12] Move packaging files to separate folder and update .deb and .rpm build scripts accordingly --- {build => packaging}/DEBIAN/control | 0 {build => packaging}/DEBIAN/postinst | 0 {build => packaging}/DEBIAN/postrm | 0 {build => packaging}/rpmbuild/BUILD/.gitkeep | 0 {build => packaging}/rpmbuild/BUILDROOT/.gitkeep | 0 {build => packaging}/rpmbuild/RPMS/.gitkeep | 0 {build => packaging}/rpmbuild/SOURCES/.gitkeep | 0 {build => packaging}/rpmbuild/SPECS/spinup.spec | 0 {build => packaging}/rpmbuild/SRPMS/.gitkeep | 0 {build => packaging}/unix/etc/sudoers.d/spinup | 0 .../unix/usr/share/applications/spinup-app.desktop | 0 .../unix/usr/share/spinup/config/dnsmasq.conf | 0 scripts/release/package-deb.sh | 6 +++--- scripts/release/package-rpm.sh | 10 +++++----- 14 files changed, 8 insertions(+), 8 deletions(-) rename {build => packaging}/DEBIAN/control (100%) rename {build => packaging}/DEBIAN/postinst (100%) rename {build => packaging}/DEBIAN/postrm (100%) rename {build => packaging}/rpmbuild/BUILD/.gitkeep (100%) rename {build => packaging}/rpmbuild/BUILDROOT/.gitkeep (100%) rename {build => packaging}/rpmbuild/RPMS/.gitkeep (100%) rename {build => packaging}/rpmbuild/SOURCES/.gitkeep (100%) rename {build => packaging}/rpmbuild/SPECS/spinup.spec (100%) rename {build => packaging}/rpmbuild/SRPMS/.gitkeep (100%) rename {build => packaging}/unix/etc/sudoers.d/spinup (100%) rename {build => packaging}/unix/usr/share/applications/spinup-app.desktop (100%) rename {build => packaging}/unix/usr/share/spinup/config/dnsmasq.conf (100%) diff --git a/build/DEBIAN/control b/packaging/DEBIAN/control similarity index 100% rename from build/DEBIAN/control rename to packaging/DEBIAN/control diff --git a/build/DEBIAN/postinst b/packaging/DEBIAN/postinst similarity index 100% rename from build/DEBIAN/postinst rename to packaging/DEBIAN/postinst diff --git a/build/DEBIAN/postrm b/packaging/DEBIAN/postrm similarity index 100% rename from build/DEBIAN/postrm rename to packaging/DEBIAN/postrm diff --git a/build/rpmbuild/BUILD/.gitkeep b/packaging/rpmbuild/BUILD/.gitkeep similarity index 100% rename from build/rpmbuild/BUILD/.gitkeep rename to packaging/rpmbuild/BUILD/.gitkeep diff --git a/build/rpmbuild/BUILDROOT/.gitkeep b/packaging/rpmbuild/BUILDROOT/.gitkeep similarity index 100% rename from build/rpmbuild/BUILDROOT/.gitkeep rename to packaging/rpmbuild/BUILDROOT/.gitkeep diff --git a/build/rpmbuild/RPMS/.gitkeep b/packaging/rpmbuild/RPMS/.gitkeep similarity index 100% rename from build/rpmbuild/RPMS/.gitkeep rename to packaging/rpmbuild/RPMS/.gitkeep diff --git a/build/rpmbuild/SOURCES/.gitkeep b/packaging/rpmbuild/SOURCES/.gitkeep similarity index 100% rename from build/rpmbuild/SOURCES/.gitkeep rename to packaging/rpmbuild/SOURCES/.gitkeep diff --git a/build/rpmbuild/SPECS/spinup.spec b/packaging/rpmbuild/SPECS/spinup.spec similarity index 100% rename from build/rpmbuild/SPECS/spinup.spec rename to packaging/rpmbuild/SPECS/spinup.spec diff --git a/build/rpmbuild/SRPMS/.gitkeep b/packaging/rpmbuild/SRPMS/.gitkeep similarity index 100% rename from build/rpmbuild/SRPMS/.gitkeep rename to packaging/rpmbuild/SRPMS/.gitkeep diff --git a/build/unix/etc/sudoers.d/spinup b/packaging/unix/etc/sudoers.d/spinup similarity index 100% rename from build/unix/etc/sudoers.d/spinup rename to packaging/unix/etc/sudoers.d/spinup diff --git a/build/unix/usr/share/applications/spinup-app.desktop b/packaging/unix/usr/share/applications/spinup-app.desktop similarity index 100% rename from build/unix/usr/share/applications/spinup-app.desktop rename to packaging/unix/usr/share/applications/spinup-app.desktop diff --git a/build/unix/usr/share/spinup/config/dnsmasq.conf b/packaging/unix/usr/share/spinup/config/dnsmasq.conf similarity index 100% rename from build/unix/usr/share/spinup/config/dnsmasq.conf rename to packaging/unix/usr/share/spinup/config/dnsmasq.conf diff --git a/scripts/release/package-deb.sh b/scripts/release/package-deb.sh index 1267aff..10deebb 100755 --- a/scripts/release/package-deb.sh +++ b/scripts/release/package-deb.sh @@ -9,14 +9,14 @@ for os_version in "" "-ubuntu24.04"; do # Copy the necessary files to the .deb package directory cp build/bin/spinup-${SPINUP_VERSION}${os_version} deb/spinup-${SPINUP_VERSION}${os_version}/usr/share/spinup/bin/spinup - cp build/DEBIAN/* deb/spinup-${SPINUP_VERSION}${os_version}/DEBIAN - cp -r build/unix/usr deb/spinup-${SPINUP_VERSION}${os_version} + cp packaging/DEBIAN/* deb/spinup-${SPINUP_VERSION}${os_version}/DEBIAN + cp -r packaging/unix/usr deb/spinup-${SPINUP_VERSION}${os_version} # Update the control file with the current version number echo -e "\nVersion: $SPINUP_VERSION" >> deb/spinup-${SPINUP_VERSION}${os_version}/DEBIAN/control # Add the dependencies for the .deb package - if [ "$os_version" -eq "" ]; then + if [ "$os_version" = "" ]; then echo "Depends: dnsmasq, libgtk-3-0, libwebkit2gtk-4.0-dev, nginx" >> deb/spinup-${SPINUP_VERSION}${os_version}/DEBIAN/control else echo "Depends: dnsmasq, libgtk-3-0, libwebkit2gtk-4.1-dev, nginx" >> deb/spinup-${SPINUP_VERSION}${os_version}/DEBIAN/control diff --git a/scripts/release/package-rpm.sh b/scripts/release/package-rpm.sh index 91fc0a5..73d762b 100755 --- a/scripts/release/package-rpm.sh +++ b/scripts/release/package-rpm.sh @@ -1,10 +1,10 @@ #!/usr/bin/env bash SPINUP_VERSION=$(cat ./common/.version | sed 's/^v//') -SOURCES_DIR=./build/rpmbuild/SOURCES +SOURCES_DIR=./packaging/rpmbuild/SOURCES # Add the version number to the spec file -sed -i "s/{{version}}/${SPINUP_VERSION}/g" build/rpmbuild/SPECS/spinup.spec +sed -i "s/{{version}}/${SPINUP_VERSION}/g" packaging/rpmbuild/SPECS/spinup.spec # Create the directory structure for the .rpm package mkdir -p $SOURCES_DIR/spinup-${SPINUP_VERSION} @@ -12,10 +12,10 @@ cp build/bin/spinup-${SPINUP_VERSION} $SOURCES_DIR/spinup-${SPINUP_VERSION}/ mv $SOURCES_DIR/spinup-${SPINUP_VERSION}/spinup-${SPINUP_VERSION} $SOURCES_DIR/spinup-${SPINUP_VERSION}/spinup # Add the contents of the build/unix directory to the rpm sources -cp -r build/unix/. $SOURCES_DIR/spinup-${SPINUP_VERSION}/ +cp -r packaging/unix/. $SOURCES_DIR/spinup-${SPINUP_VERSION}/ # Add the postinstall script to the rpm sources -cp build/DEBIAN/postinst $SOURCES_DIR/spinup-${SPINUP_VERSION}/ +cp packaging/DEBIAN/postinst $SOURCES_DIR/spinup-${SPINUP_VERSION}/ # Set the permissions for the .rpm package files sudo chown -R root:root $SOURCES_DIR/spinup-${SPINUP_VERSION} @@ -27,7 +27,7 @@ cd ../../.. # Remove the existing rpmbuild directory and copy the new one rm -rf ~/rpmbuild -cp -r build/rpmbuild ~/ +cp -r packaging/rpmbuild ~/ # Build the .rpm package rpmbuild -bb ~/rpmbuild/SPECS/spinup.spec From b3e7c8392c3d77df446580a1abf32d2dc6cb070f Mon Sep 17 00:00:00 2001 From: Iskander Date: Wed, 22 Jan 2025 23:20:00 +0100 Subject: [PATCH 02/12] Update MacOS packaging scripts and add postinstall script for setup --- .github/workflows/release.yml | 4 +- packaging/macos/postinstall.sh | 120 +++++++++++++++++++++++++++ scripts/release/package-macos-zip.sh | 5 +- 3 files changed, 124 insertions(+), 5 deletions(-) create mode 100644 packaging/macos/postinstall.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e96f795..2b8fed5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -133,8 +133,8 @@ jobs: with: key: ${{ runner.os }}-icons-${{ hashFiles('images/icon-large.png') }} path: | - build/unix/usr/share/icons - build/unix/usr/share/pixmaps + packaging/unix/usr/share/icons + packaging/unix/usr/share/pixmaps - name: Generate icons # if: (runner.os == 'Linux' || runner.os == 'macOS') && steps.cache-icons.outputs.cache-hit != 'true' if: runner.os == 'Linux' && steps.cache-icons.outputs.cache-hit != 'true' diff --git a/packaging/macos/postinstall.sh b/packaging/macos/postinstall.sh new file mode 100644 index 0000000..c108671 --- /dev/null +++ b/packaging/macos/postinstall.sh @@ -0,0 +1,120 @@ +#!/usr/bin/env bash + +# Make sure the script is being run as root +if [ "$(id -u)" -ne 0 ]; then + echo "This script must be run as root" >&2 + exit 1 +fi + +# Check if brew is installed +if ! command -v brew &>/dev/null; then + echo "Homebrew is not installed" >&2 + exit 1 +fi + +# Check if dnsmasq is installed +if ! brew list dnsmasq &>/dev/null; then + echo "Dnsmasq is not installed" >&2 + exit 1 +fi + +# Check if nginx is installed +if ! brew list nginx &>/dev/null; then + echo "Nginx is not installed" >&2 + exit 1 +fi + +# Check if the SUDO_USER environment variable is set +if [ -z "$SUDO_USER" ]; then + echo "The SUDO_USER environment variable is not set" >&2 + exit 1 +fi + +# Get the home directory of the user that ran the script +USER_HOME="/Users/$SUDO_USER" + +# Make sure the user's home directory exists +if [ ! -d "$USER_HOME" ]; then + echo "The user's home directory does not exist" >&2 + exit 1 +fi + +SPINUP_SHARE_DIR="/usr/local/share/spinup" + +##################### +### General setup ### +##################### + +# Remove the old symlink if it exists and create a new one +rm -f /usr/local/bin/spinup +ln -s $SPINUP_SHARE_DIR/bin/spinup /usr/local/bin/spinup + +# Set the correct permissions on the spinup directory +chown -R root:wheel $SPINUP_SHARE_DIR + +############### +### Dnsmasq ### +############### + +if [ ! -d /etc/dnsmasq.d ]; then + # Create the dnsmasq.d directory if it doesn't exist + mkdir /etc/dnsmasq.d +fi + +# Check if the spinup.conf already exists in the dnsmasq.d directory +if [ ! -f /etc/dnsmasq.d/spinup.conf ]; then + # Link the dnsmasq configuration file for spinup to the dnsmasq.d directory if it doesn't exist + ln -s $SPINUP_SHARE_DIR/config/dnsmasq.conf /etc/dnsmasq.d/spinup.conf + + # Restart the dnsmasq service + brew services restart dnsmasq +fi + +############# +### Nginx ### +############# + +USER_SPINUP_NGINX_DIR="$USER_HOME/.config/spinup/nginx" +SPINUP_NGINX_DIR="/usr/local/share/spinup/config/nginx" +BREW_NGINX_DIR="/opt/homebrew/etc/nginx" + +# Create the user's spinup nginx directory if it doesn't exist +mkdir -p $USER_SPINUP_NGINX_DIR + +if [ ! -d $SPINUP_NGINX_DIR ]; then + # Link the user's spinup nginx directory to the spinup config directory if it doesn't exist + ln -s $USER_SPINUP_NGINX_DIR $SPINUP_NGINX_DIR +fi + +# Add the user's spinup nginx directory to the nginx configuration +if ! grep -q "include ${SPINUP_NGINX_DIR}/\*.conf;" $BREW_NGINX_DIR/nginx.conf; then + # Make a backup of the nginx configuration file + cp $BREW_NGINX_DIR/nginx.conf $BREW_NGINX_DIR/nginx.conf.bak + + # Add the include directive to the bottom of the http section in the nginx configuration file + sed -i '/http {/!b; :a; N; /}/!ba; s/}/\tinclude '"${SPINUP_NGINX_DIR//\//\\/}"'\/\*.conf;\n}/' $BREW_NGINX_DIR/nginx.conf +fi + +# Restart the nginx service +brew services restart nginx + +############### +### Sudoers ### +############### + +# Add an include for the sudoers.d directory to the sudoers file if it doesn't already exist +if ! grep -q "^@includedir /etc/sudoers.d[[:space:]]*$" /etc/sudoers; then + # Make a backup of the sudoers file + cp /etc/sudoers /etc/sudoers.bak + + # Add the include directive to the sudoers file + echo "@includedir /etc/sudoers.d" | visudo -c -f - &>/dev/null && echo "@includedir /etc/sudoers.d" | EDITOR='tee -a' visudo &>/dev/null +fi + +# Move the spinup sudoers file to the sudoers.d directory +mv $SPINUP_SHARE_DIR/config/sudoers /etc/sudoers.d/spinup +chmod 440 /etc/sudoers.d/spinup +chown root:wheel /etc/sudoers.d/spinup + +# Set the correct permissions on the user's spinup .config directory +chown -R $SUDO_USER:staff $USER_HOME/.config/spinup diff --git a/scripts/release/package-macos-zip.sh b/scripts/release/package-macos-zip.sh index 41b4781..a6c531a 100755 --- a/scripts/release/package-macos-zip.sh +++ b/scripts/release/package-macos-zip.sh @@ -17,9 +17,8 @@ cp -r "./build/unix/." $MAC_OS_DIR mkdir -p "$MAC_OS_DIR/usr/share/spinup/bin" cp $BIN_FILE "$MAC_OS_DIR/usr/share/spinup/bin" -# Copy postinstall script to the MacOS directory -cp "./build/DEBIAN/postinst" $MAC_OS_DIR -mv "$MAC_OS_DIR/postinst" "$MAC_OS_DIR/postinstall.sh" +# Move the sudoers file to the config directory +mv "$MAC_OS_DIR/etc/sudoers.d/spinup" "$MAC_OS_DIR/usr/share/spinup/config/sudoers" # Create a zip file containing the contents of the MacOS directory (cd $MAC_OS_DIR && zip -r "../../spinup-${SPINUP_VERSION}-macos.zip" .) From d1383bc51c2b5e8532bed2c419981cc1ca28c42c Mon Sep 17 00:00:00 2001 From: Iskander Date: Wed, 22 Jan 2025 23:28:18 +0100 Subject: [PATCH 03/12] Use correct dir for generating icons into --- scripts/generate-icons.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/generate-icons.sh b/scripts/generate-icons.sh index 3c54e6c..bcbf2e3 100755 --- a/scripts/generate-icons.sh +++ b/scripts/generate-icons.sh @@ -2,7 +2,7 @@ SOURCE="./images/icon-large.png" SIZES=(1024 512 256 128 64 32 16) -SHARE_DIR="./build/unix/usr/share" +SHARE_DIR="./packaging/unix/usr/share" PIXMAPS_DIR="$SHARE_DIR/pixmaps" mkdir -p $SHARE_DIR/icons/hicolor From 796dcb83e0e9854c423162b246f5d97c39774645 Mon Sep 17 00:00:00 2001 From: Iskander Date: Sat, 25 Jan 2025 13:31:30 +0100 Subject: [PATCH 04/12] Restructure macOS packaging to hopefully make it work correctly --- .github/workflows/release.yml | 31 +++++++++++++------ .../macos/{postinstall.sh => install.sh} | 13 +++++--- scripts/release/package-macos-zip.sh | 17 +++++----- 3 files changed, 41 insertions(+), 20 deletions(-) rename packaging/macos/{postinstall.sh => install.sh} (91%) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2b8fed5..2b28b28 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -64,6 +64,12 @@ jobs: cache: 'pnpm' cache-dependency-path: './frontend/pnpm-lock.yaml' + # Get the version from the common/.version file and set it as an environment variable + - name: Set SPINUP_VERSION + id: get_version + run: echo "SPINUP_VERSION=$(cat ./common/.version | sed 's/^v//')" >> $GITHUB_ENV + shell: bash + # install Wails - name: Install Wails run: go install github.com/wailsapp/wails/v2/cmd/wails@latest @@ -87,18 +93,16 @@ jobs: if: runner.os == 'Linux' working-directory: ${{ env.WORKING_DIRECTORY }} run: | - SPINUP_VERSION=$(cat ./common/.version | sed 's/^v//') - sed -i.bak "s/{{version}}/${SPINUP_VERSION}/g" wails.json && rm wails.json.bak + sed -i.bak "s/{{version}}/${{ env.SPINUP_VERSION }}/g" wails.json && rm wails.json.bak - wails build --platform ${{ matrix.build.platform }} -webview2 ${{ env.WEBVIEW2 }} -o ${{ matrix.build.name }}-${SPINUP_VERSION} -tags webkit2_40 - wails build --platform ${{ matrix.build.platform }} -webview2 ${{ env.WEBVIEW2 }} -o ${{ matrix.build.name }}-${SPINUP_VERSION}-ubuntu24.04 -tags webkit2_41 + wails build --platform ${{ matrix.build.platform }} -webview2 ${{ env.WEBVIEW2 }} -o ${{ matrix.build.name }}-${{ env.SPINUP_VERSION }} -tags webkit2_40 + wails build --platform ${{ matrix.build.platform }} -webview2 ${{ env.WEBVIEW2 }} -o ${{ matrix.build.name }}-${{ env.SPINUP_VERSION }}-ubuntu24.04 -tags webkit2_41 shell: bash - name: Build macOs App if: runner.os == 'macOS' working-directory: ${{ env.WORKING_DIRECTORY }} run: | - SPINUP_VERSION=$(cat ./common/.version | sed 's/^v//') - sed -i.bak "s/{{version}}/${SPINUP_VERSION}/g" wails.json && rm wails.json.bak + sed -i.bak "s/{{version}}/${{ env.SPINUP_VERSION }}/g" wails.json && rm wails.json.bak wails build --platform ${{ matrix.build.platform }} -webview2 ${{ env.WEBVIEW2 }} -o ${{ matrix.build.name }} shell: bash @@ -106,10 +110,9 @@ jobs: if: runner.os == 'Windows' working-directory: ${{ env.WORKING_DIRECTORY }} run: | - SPINUP_VERSION=$(cat ./common/.version | sed 's/^v//') - sed -i "s/{{version}}/${SPINUP_VERSION}/g" wails.json + sed -i "s/{{version}}/${{ env.SPINUP_VERSION }}/g" wails.json - wails build --platform ${{ matrix.build.platform }} -webview2 ${{ env.WEBVIEW2 }} -nsis -o ${{ matrix.build.name }}-${SPINUP_VERSION} + wails build --platform ${{ matrix.build.platform }} -webview2 ${{ env.WEBVIEW2 }} -nsis -o ${{ matrix.build.name }}-${{ env.SPINUP_VERSION }} shell: bash # Add permissions to the binary @@ -160,6 +163,16 @@ jobs: working-directory: ${{ env.WORKING_DIRECTORY }} run: bash ./scripts/release/package-rpm.sh + # Check if macOS zip installs correctly + - name: Check if macOS zip installs correctly + if: runner.os == 'macOS' + working-directory: ${{ env.WORKING_DIRECTORY }} + run: | + unzip -q -o ./spinup-${{ env.SPINUP_VERSION }}-macos.zip -d /tmp/spinup + cd /tmp/spinup/ + sudo bash ./install.sh + shell: bash + # Upload build assets - uses: actions/upload-artifact@v4 with: diff --git a/packaging/macos/postinstall.sh b/packaging/macos/install.sh similarity index 91% rename from packaging/macos/postinstall.sh rename to packaging/macos/install.sh index c108671..caf7ee4 100644 --- a/packaging/macos/postinstall.sh +++ b/packaging/macos/install.sh @@ -45,6 +45,9 @@ SPINUP_SHARE_DIR="/usr/local/share/spinup" ### General setup ### ##################### +# Copy over the /usr/local/share/spinup directory to the correct location +cp -r ./usr/local/share/spinup /usr/local/share + # Remove the old symlink if it exists and create a new one rm -f /usr/local/bin/spinup ln -s $SPINUP_SHARE_DIR/bin/spinup /usr/local/bin/spinup @@ -111,10 +114,12 @@ if ! grep -q "^@includedir /etc/sudoers.d[[:space:]]*$" /etc/sudoers; then echo "@includedir /etc/sudoers.d" | visudo -c -f - &>/dev/null && echo "@includedir /etc/sudoers.d" | EDITOR='tee -a' visudo &>/dev/null fi -# Move the spinup sudoers file to the sudoers.d directory -mv $SPINUP_SHARE_DIR/config/sudoers /etc/sudoers.d/spinup -chmod 440 /etc/sudoers.d/spinup -chown root:wheel /etc/sudoers.d/spinup +SUDOERS_FILE=/etc/sudoers.d/spinup + +# Move the spinup sudoers file to the /etc/sudoers.d directory +mv .$SUDOERS_FILE $SUDOERS_FILE +chmod 440 $SUDOERS_FILE +chown root:wheel $SUDOERS_FILE # Set the correct permissions on the user's spinup .config directory chown -R $SUDO_USER:staff $USER_HOME/.config/spinup diff --git a/scripts/release/package-macos-zip.sh b/scripts/release/package-macos-zip.sh index a6c531a..3690b1a 100755 --- a/scripts/release/package-macos-zip.sh +++ b/scripts/release/package-macos-zip.sh @@ -2,7 +2,8 @@ SPINUP_VERSION=$(cat ./common/.version | sed 's/^v//') -MAC_OS_DIR="./build/macos" +MAC_OS_DIR="./packaging/macos" +SPINUP_SHARE_DIR="/usr/local/share/spinup" # Define the path to the binary file BIN_FILE="./build/bin/Spinup.app/Contents/MacOS/spinup" @@ -10,15 +11,17 @@ BIN_FILE="./build/bin/Spinup.app/Contents/MacOS/spinup" # Create the mac os directory mkdir -p $MAC_OS_DIR +# Create the MacOS directory structure +mkdir -p "$MAC_OS_DIR/etc" +mkdir -p "$MAC_OS_DIR$SPINUP_SHARE_DIR" + # Copy the contents of the build/unix directory to the MacOS directory -cp -r "./build/unix/." $MAC_OS_DIR +cp -r "./packaging/unix/etc/." $MAC_OS_DIR/etc +cp -r "./packaging/unix/usr/share/spinup/." $MAC_OS_DIR$SPINUP_SHARE_DIR # Copy the binary file to the MacOS directory -mkdir -p "$MAC_OS_DIR/usr/share/spinup/bin" -cp $BIN_FILE "$MAC_OS_DIR/usr/share/spinup/bin" - -# Move the sudoers file to the config directory -mv "$MAC_OS_DIR/etc/sudoers.d/spinup" "$MAC_OS_DIR/usr/share/spinup/config/sudoers" +mkdir -p "$MAC_OS_DIR$SPINUP_SHARE_DIR/bin" +cp $BIN_FILE "$MAC_OS_DIR$SPINUP_SHARE_DIR/bin" # Create a zip file containing the contents of the MacOS directory (cd $MAC_OS_DIR && zip -r "../../spinup-${SPINUP_VERSION}-macos.zip" .) From ae9a17481d33db9d93a1faf5b10617aaedd4708f Mon Sep 17 00:00:00 2001 From: Iskander Date: Sat, 25 Jan 2025 14:05:22 +0100 Subject: [PATCH 05/12] Add installation checks for Ubuntu and update macOS installation instructions --- .github/workflows/release.yml | 11 +++++++++++ README.md | 14 ++------------ scripts/release/package-deb.sh | 4 ++-- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2b28b28..71696cb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -163,11 +163,22 @@ jobs: working-directory: ${{ env.WORKING_DIRECTORY }} run: bash ./scripts/release/package-rpm.sh + # Check if Ubuntu deb installs correctly + - name: Check if Ubuntu deb installs correctly + if: runner.os == 'Linux' + working-directory: ${{ env.WORKING_DIRECTORY }} + run: | + sudo apt-get install -y libgtk-3-0 libwebkit2gtk-4.1-dev nginx dnsmasq + sudo dpkg -i ./spinup-${{ env.SPINUP_VERSION }}-ubuntu24.04.deb + spinup --version + shell: bash + # Check if macOS zip installs correctly - name: Check if macOS zip installs correctly if: runner.os == 'macOS' working-directory: ${{ env.WORKING_DIRECTORY }} run: | + brew install nginx dnsmasq unzip -q -o ./spinup-${{ env.SPINUP_VERSION }}-macos.zip -d /tmp/spinup cd /tmp/spinup/ sudo bash ./install.sh diff --git a/README.md b/README.md index 6229832..632489c 100644 --- a/README.md +++ b/README.md @@ -59,19 +59,9 @@ Download the `spinup-{{version}}-macos.zip` archive from the releases and unzip unzip spinup-{{version}}-macos.zip ``` -Then move the `usr/share/spinup` folder to `/usr/share/spinup`: +Run the installation script: ```bash -sudo mv -R ./spinup-{{version}}-macos/usr/share/spinup /usr/share -``` - -The same for the sudoers file: -```bash -sudo mv -R ./spinup-{{version}}-macos/etc/sudoers.d/spinup /etc/sudoers.d/spinup -``` - -To complete the installation run the post install script: -```bash -sudo ./spinup-{{version}}-macos/postinstall.sh +sudo ./spinup-{{version}}-macos/install.sh ``` This will create the required directories and files. diff --git a/scripts/release/package-deb.sh b/scripts/release/package-deb.sh index 10deebb..c45fa74 100755 --- a/scripts/release/package-deb.sh +++ b/scripts/release/package-deb.sh @@ -17,9 +17,9 @@ for os_version in "" "-ubuntu24.04"; do # Add the dependencies for the .deb package if [ "$os_version" = "" ]; then - echo "Depends: dnsmasq, libgtk-3-0, libwebkit2gtk-4.0-dev, nginx" >> deb/spinup-${SPINUP_VERSION}${os_version}/DEBIAN/control + echo "Depends: libgtk-3-0, libwebkit2gtk-4.0-dev, nginx, dnsmasq" >> deb/spinup-${SPINUP_VERSION}${os_version}/DEBIAN/control else - echo "Depends: dnsmasq, libgtk-3-0, libwebkit2gtk-4.1-dev, nginx" >> deb/spinup-${SPINUP_VERSION}${os_version}/DEBIAN/control + echo "Depends: libgtk-3-0, libwebkit2gtk-4.1-dev, nginx, dnsmasq" >> deb/spinup-${SPINUP_VERSION}${os_version}/DEBIAN/control fi # Set the permissions for the .deb package files From e54873bab97226f96224fd10e51ee75dd1dc1e70 Mon Sep 17 00:00:00 2001 From: Iskander Date: Sat, 25 Jan 2025 14:12:34 +0100 Subject: [PATCH 06/12] Update installation instructions for Ubuntu, adding required packages and clarifying version differences for libwebkit2gtk --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 632489c..b8e2549 100644 --- a/README.md +++ b/README.md @@ -15,10 +15,14 @@ Quickly spin up your multi command projects. To install the required packages on a debian based system you can use the following command: ```bash -sudo apt install nginx dnsmasq +sudo apt install libgtk-3-0 libwebkit2gtk-4.0-dev nginx dnsmasq ``` -Download a `.deb` package from the releases. There is a separate version for Ubuntu 24.04 since it uses a different version of the `libwebkit2gtk` package. +> **Note** +> +> For Ubuntu 24.04 and up, you should install `libwebkit2gtk-4.1-dev` instead of `libwebkit2gtk-4.0-dev`. + +Download the `.deb` package from the releases. There is a separate version for Ubuntu 24.04 due to the different `libwebkit2gtk` package version being used. To install the package run the following command where `{{version}}` is the version of the package: ```bash From 77e9834cf4322701fc1b7c7af547c865b5c895a1 Mon Sep 17 00:00:00 2001 From: Iskander Date: Sat, 25 Jan 2025 14:12:43 +0100 Subject: [PATCH 07/12] Fix installation checks in macOS script to use 'brew ls --versions' for package verification --- packaging/macos/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/macos/install.sh b/packaging/macos/install.sh index caf7ee4..24432af 100644 --- a/packaging/macos/install.sh +++ b/packaging/macos/install.sh @@ -13,13 +13,13 @@ if ! command -v brew &>/dev/null; then fi # Check if dnsmasq is installed -if ! brew list dnsmasq &>/dev/null; then +if ! brew ls --versions dnsmasq &>/dev/null; then echo "Dnsmasq is not installed" >&2 exit 1 fi # Check if nginx is installed -if ! brew list nginx &>/dev/null; then +if ! brew ls --versions nginx &>/dev/null; then echo "Nginx is not installed" >&2 exit 1 fi From 0cb6698529d7599e9321b0201bf38601bc36c8d5 Mon Sep 17 00:00:00 2001 From: Iskander Date: Sat, 25 Jan 2025 14:16:28 +0100 Subject: [PATCH 08/12] Fix installation paths and streamline macOS setup by installing dependencies directly --- .github/workflows/release.yml | 3 +-- packaging/macos/install.sh | 12 +----------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 71696cb..0b70970 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -169,7 +169,7 @@ jobs: working-directory: ${{ env.WORKING_DIRECTORY }} run: | sudo apt-get install -y libgtk-3-0 libwebkit2gtk-4.1-dev nginx dnsmasq - sudo dpkg -i ./spinup-${{ env.SPINUP_VERSION }}-ubuntu24.04.deb + sudo dpkg -i ./deb/spinup-${{ env.SPINUP_VERSION }}-ubuntu24.04.deb spinup --version shell: bash @@ -178,7 +178,6 @@ jobs: if: runner.os == 'macOS' working-directory: ${{ env.WORKING_DIRECTORY }} run: | - brew install nginx dnsmasq unzip -q -o ./spinup-${{ env.SPINUP_VERSION }}-macos.zip -d /tmp/spinup cd /tmp/spinup/ sudo bash ./install.sh diff --git a/packaging/macos/install.sh b/packaging/macos/install.sh index 24432af..78b0d1d 100644 --- a/packaging/macos/install.sh +++ b/packaging/macos/install.sh @@ -12,17 +12,7 @@ if ! command -v brew &>/dev/null; then exit 1 fi -# Check if dnsmasq is installed -if ! brew ls --versions dnsmasq &>/dev/null; then - echo "Dnsmasq is not installed" >&2 - exit 1 -fi - -# Check if nginx is installed -if ! brew ls --versions nginx &>/dev/null; then - echo "Nginx is not installed" >&2 - exit 1 -fi +brew install nginx dnsmasq # Check if the SUDO_USER environment variable is set if [ -z "$SUDO_USER" ]; then From 99eb37b2594bb901d851ed3713e0c5a606a17d22 Mon Sep 17 00:00:00 2001 From: Iskander Date: Sat, 25 Jan 2025 14:19:12 +0100 Subject: [PATCH 09/12] Remove checking for brew and installing from install script for macOS --- .github/workflows/release.yml | 1 + packaging/macos/install.sh | 8 -------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0b70970..2fc0a6f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -178,6 +178,7 @@ jobs: if: runner.os == 'macOS' working-directory: ${{ env.WORKING_DIRECTORY }} run: | + brew install nginx dnsmasq unzip -q -o ./spinup-${{ env.SPINUP_VERSION }}-macos.zip -d /tmp/spinup cd /tmp/spinup/ sudo bash ./install.sh diff --git a/packaging/macos/install.sh b/packaging/macos/install.sh index 78b0d1d..457763b 100644 --- a/packaging/macos/install.sh +++ b/packaging/macos/install.sh @@ -6,14 +6,6 @@ if [ "$(id -u)" -ne 0 ]; then exit 1 fi -# Check if brew is installed -if ! command -v brew &>/dev/null; then - echo "Homebrew is not installed" >&2 - exit 1 -fi - -brew install nginx dnsmasq - # Check if the SUDO_USER environment variable is set if [ -z "$SUDO_USER" ]; then echo "The SUDO_USER environment variable is not set" >&2 From 95f31d2232607f4cfc7ac92eb2ae7a64c6edca5c Mon Sep 17 00:00:00 2001 From: Iskander Date: Sat, 25 Jan 2025 14:21:13 +0100 Subject: [PATCH 10/12] Set ownership for spinup configuration directory in post-install script --- packaging/DEBIAN/postinst | 1 + 1 file changed, 1 insertion(+) diff --git a/packaging/DEBIAN/postinst b/packaging/DEBIAN/postinst index 2ce1dae..4ce70fb 100755 --- a/packaging/DEBIAN/postinst +++ b/packaging/DEBIAN/postinst @@ -53,6 +53,7 @@ SPINUP_NGINX_DIR="/usr/share/spinup/config/nginx" # Create the user's spinup nginx directory if it doesn't exist mkdir -p $USER_SPINUP_NGINX_DIR +chown -R $SUDO_USER:$SUDO_USER $USER_HOME/.config/spinup if [ ! -d $SPINUP_NGINX_DIR ]; then # Link the user's spinup nginx directory to the spinup config directory if it doesn't exist From e7f13655fa3e3d7e1bffdb1337e147777a9ed33c Mon Sep 17 00:00:00 2001 From: Iskander Date: Sat, 25 Jan 2025 14:24:30 +0100 Subject: [PATCH 11/12] Don't restart dnsmasq in postinst script --- packaging/DEBIAN/postinst | 3 --- 1 file changed, 3 deletions(-) diff --git a/packaging/DEBIAN/postinst b/packaging/DEBIAN/postinst index 4ce70fb..08266bf 100755 --- a/packaging/DEBIAN/postinst +++ b/packaging/DEBIAN/postinst @@ -39,9 +39,6 @@ fi if [ ! -f /etc/dnsmasq.d/spinup.conf ]; then # Link the dnsmasq configuration file for spinup to the dnsmasq.d directory if it doesn't exist ln -s /usr/share/spinup/config/dnsmasq.conf /etc/dnsmasq.d/spinup.conf - - # Restart the dnsmasq service - systemctl restart dnsmasq fi ############# From 4a9e729e2f0669a8c84fbfd3de79aa7b80bdbbe0 Mon Sep 17 00:00:00 2001 From: Iskander Date: Sat, 25 Jan 2025 14:27:13 +0100 Subject: [PATCH 12/12] Add version check after installation in release workflow for macOS --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2fc0a6f..e4f53a7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -182,6 +182,7 @@ jobs: unzip -q -o ./spinup-${{ env.SPINUP_VERSION }}-macos.zip -d /tmp/spinup cd /tmp/spinup/ sudo bash ./install.sh + spinup --version shell: bash # Upload build assets