diff --git a/.gitignore b/.gitignore index b2f07d7..9ae5512 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,7 @@ .vscode/ .coverage.html + +# Packaging +packaging/unix/usr/share/icons/ +packaging/unix/usr/share/pixmaps/ +deb/ diff --git a/config/nginx.go b/config/nginx.go index 90984ca..165dd32 100644 --- a/config/nginx.go +++ b/config/nginx.go @@ -200,7 +200,7 @@ func (c *Config) InitNginx() error { "\n!!! Please add the following include directive to http section of your nginx.conf file located at %s like this:\n", filepath.Join(c.nginxConfigDir, "..", "nginx.conf"), ) - fmt.Printf("\nhttp {\n\t...\n\n\t%s\n}\n", "include /usr/share/spinup/config/nginx/*.conf;") + fmt.Printf("\nhttp {\n\t...\n\n\t%s\n}\n", "include /etc/spinup/config/nginx/**/*.conf;") } return nil diff --git a/packaging/DEBIAN/postinst b/packaging/DEBIAN/postinst index 3eecd92..034fffb 100755 --- a/packaging/DEBIAN/postinst +++ b/packaging/DEBIAN/postinst @@ -20,14 +20,17 @@ fi ##################### # Create the spinup directory if it doesn't exist -mkdir -p /usr/share/spinup +mkdir -p /etc/spinup + +# Create the config directory if it doesn't exist +mkdir -p /etc/spinup/config # Remove the old symlink if it exists and create a new one rm -f /usr/bin/spinup -ln -s /usr/share/spinup/bin/spinup /usr/bin/spinup +ln -s /etc/spinup/bin/spinup /usr/bin/spinup # Set the correct permissions on the spinup directory -chown -R root:root /usr/share/spinup +chown -R root:root /etc/spinup ############### ### Dnsmasq ### @@ -39,7 +42,7 @@ mkdir -p /etc/dnsmasq.d # 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 /usr/share/spinup/config/dnsmasq.conf /etc/dnsmasq.d/spinup.conf + ln -s /etc/spinup/config/dnsmasq.conf /etc/dnsmasq.d/spinup.conf fi ############# @@ -47,7 +50,7 @@ fi ############# USER_SPINUP_NGINX_DIR="$USER_HOME/.config/spinup/nginx" -SPINUP_NGINX_DIR="/usr/share/spinup/config/nginx" +SPINUP_NGINX_DIR="/etc/spinup/config/nginx" # Create the user's spinup nginx directory if it doesn't exist mkdir -p $USER_SPINUP_NGINX_DIR diff --git a/packaging/DEBIAN/postrm b/packaging/DEBIAN/postrm index f06b002..1a2273a 100755 --- a/packaging/DEBIAN/postrm +++ b/packaging/DEBIAN/postrm @@ -10,7 +10,7 @@ fi rm -f /usr/bin/spinup # Remove the spinup directory -rm -rf /usr/share/spinup +rm -rf /etc/spinup # Remove the link to the dnsmasq configuration file rm -f /etc/dnsmasq.d/spinup.conf @@ -19,7 +19,7 @@ rm -f /etc/dnsmasq.d/spinup.conf systemctl restart dnsmasq # Remove include directive in the nginx configuration file -sed -i '/include \/usr\/share\/spinup\/config\/nginx\/\*.conf;/d' /etc/nginx/nginx.conf +sed -i '/include \/etc\/spinup\/config\/nginx\/\*.conf;/d' /etc/nginx/nginx.conf # Restart the nginx service systemctl restart nginx diff --git a/packaging/rpmbuild/SPECS/spinup.spec b/packaging/rpmbuild/SPECS/spinup.spec index 263371f..6369fc0 100644 --- a/packaging/rpmbuild/SPECS/spinup.spec +++ b/packaging/rpmbuild/SPECS/spinup.spec @@ -15,24 +15,24 @@ Quickly spin up your multi command projects. %setup -q %install -mkdir -p %{buildroot}/usr/share/spinup/bin -cp %{_builddir}/%{name}-%{version}/%{name} %{buildroot}/usr/share/spinup/bin -cp %{_builddir}/%{name}-%{version}/postinst %{buildroot}/usr/share/spinup/bin/postinst +mkdir -p %{buildroot}/etc/spinup/bin +cp %{_builddir}/%{name}-%{version}/%{name} %{buildroot}/etc/spinup/bin +cp %{_builddir}/%{name}-%{version}/postinst %{buildroot}/etc/spinup/bin/postinst cp -r %{_builddir}/%{name}-%{version}/etc %{buildroot} cp -r %{_builddir}/%{name}-%{version}/usr %{buildroot} %post -sh /usr/share/spinup/bin/postinst +sh /etc/spinup/bin/postinst %clean rm -rf %{buildroot} %files -/usr/share/spinup/bin/%{name} -/usr/share/spinup/bin/postinst +/etc/spinup/bin/%{name} +/etc/spinup/bin/postinst +/etc/spinup/config/dnsmasq.conf /etc/sudoers.d/spinup /usr/share/applications/spinup-app.desktop -/usr/share/spinup/config/dnsmasq.conf /usr/share/icons/hicolor/1024x1024/apps/spinup.png /usr/share/icons/hicolor/128x128/apps/spinup.png /usr/share/icons/hicolor/128x128@2x/apps/spinup.png diff --git a/packaging/unix/usr/share/spinup/config/dnsmasq.conf b/packaging/unix/etc/spinup/config/dnsmasq.conf similarity index 67% rename from packaging/unix/usr/share/spinup/config/dnsmasq.conf rename to packaging/unix/etc/spinup/config/dnsmasq.conf index b26c113..c751058 100644 --- a/packaging/unix/usr/share/spinup/config/dnsmasq.conf +++ b/packaging/unix/etc/spinup/config/dnsmasq.conf @@ -1,4 +1,6 @@ -# Spinup configuration file for dnsmasq +######################################### +# Spinup configuration file for dnsmasq # +######################################### # Require requests to have an actual domain unless specified in /etc/hosts domain-needed diff --git a/packaging/unix/usr/share/applications/spinup-app.desktop b/packaging/unix/usr/share/applications/spinup-app.desktop index f0fd645..69d05d5 100644 --- a/packaging/unix/usr/share/applications/spinup-app.desktop +++ b/packaging/unix/usr/share/applications/spinup-app.desktop @@ -2,7 +2,7 @@ Name=Spinup Comment=Quickly spin up your multi command projects. GenericName=Development Environment -Exec=/usr/share/spinup/bin/spinup +Exec=/usr/bin/spinup Icon=spinup Type=Application StartupNotify=false diff --git a/scripts/release/package-deb.sh b/scripts/release/package-deb.sh index c45fa74..8ae2ed5 100755 --- a/scripts/release/package-deb.sh +++ b/scripts/release/package-deb.sh @@ -5,12 +5,13 @@ SPINUP_VERSION=$(cat ./common/.version | sed 's/^v//') for os_version in "" "-ubuntu24.04"; do # Create the directory structure for the .deb package mkdir -p deb/spinup-${SPINUP_VERSION}${os_version}/DEBIAN - mkdir -p deb/spinup-${SPINUP_VERSION}${os_version}/usr/share/spinup/bin + mkdir -p deb/spinup-${SPINUP_VERSION}${os_version}/etc/spinup/bin # 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/bin/spinup-${SPINUP_VERSION}${os_version} deb/spinup-${SPINUP_VERSION}${os_version}/etc/spinup/bin/spinup cp packaging/DEBIAN/* deb/spinup-${SPINUP_VERSION}${os_version}/DEBIAN cp -r packaging/unix/usr deb/spinup-${SPINUP_VERSION}${os_version} + cp -r packaging/unix/etc 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 diff --git a/scripts/release/package-macos-zip.sh b/scripts/release/package-macos-zip.sh index 3690b1a..56f6465 100755 --- a/scripts/release/package-macos-zip.sh +++ b/scripts/release/package-macos-zip.sh @@ -17,7 +17,7 @@ mkdir -p "$MAC_OS_DIR$SPINUP_SHARE_DIR" # Copy the contents of the build/unix directory to the MacOS directory cp -r "./packaging/unix/etc/." $MAC_OS_DIR/etc -cp -r "./packaging/unix/usr/share/spinup/." $MAC_OS_DIR$SPINUP_SHARE_DIR +cp -r "./packaging/unix/etc/spinup/." $MAC_OS_DIR$SPINUP_SHARE_DIR # Copy the binary file to the MacOS directory mkdir -p "$MAC_OS_DIR$SPINUP_SHARE_DIR/bin"