Skip to content

Commit 1440937

Browse files
authored
Merge pull request #29 from iskandervdh/etc-folder
Use /etc/spinup directory instead of /usr/share/spinup
2 parents fd3015c + ddc238c commit 1440937

9 files changed

Lines changed: 34 additions & 20 deletions

File tree

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
.vscode/
22
.coverage.html
3+
4+
# Packaging
5+
packaging/unix/usr/share/icons/
6+
packaging/unix/usr/share/pixmaps/
7+
deb/

config/nginx.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ func (c *Config) InitNginx() error {
200200
"\n!!! Please add the following include directive to http section of your nginx.conf file located at %s like this:\n",
201201
filepath.Join(c.nginxConfigDir, "..", "nginx.conf"),
202202
)
203-
fmt.Printf("\nhttp {\n\t...\n\n\t%s\n}\n", "include /usr/share/spinup/config/nginx/*.conf;")
203+
fmt.Printf("\nhttp {\n\t...\n\n\t%s\n}\n", "include /etc/spinup/config/nginx/**/*.conf;")
204204
}
205205

206206
return nil

packaging/DEBIAN/postinst

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env bash
22

3+
SPINUP_ROOT_DIR="/etc/spinup"
4+
35
# Make sure the script is being run as root
46
if [ "$(id -u)" -ne 0 ]; then
57
echo "This script must be run as root" >&2
@@ -20,14 +22,17 @@ fi
2022
#####################
2123

2224
# Create the spinup directory if it doesn't exist
23-
mkdir -p /usr/share/spinup
25+
mkdir -p "$SPINUP_ROOT_DIR"
26+
27+
# Create the config directory if it doesn't exist
28+
mkdir -p "$SPINUP_ROOT_DIR/config"
2429

2530
# Remove the old symlink if it exists and create a new one
2631
rm -f /usr/bin/spinup
27-
ln -s /usr/share/spinup/bin/spinup /usr/bin/spinup
32+
ln -s "$SPINUP_ROOT_DIR/bin/spinup" /usr/bin/spinup
2833

2934
# Set the correct permissions on the spinup directory
30-
chown -R root:root /usr/share/spinup
35+
chown -R root:root "$SPINUP_ROOT_DIR"
3136

3237
###############
3338
### Dnsmasq ###
@@ -39,15 +44,15 @@ mkdir -p /etc/dnsmasq.d
3944
# Check if the spinup.conf already exists in the dnsmasq.d directory
4045
if [ ! -f /etc/dnsmasq.d/spinup.conf ]; then
4146
# Link the dnsmasq configuration file for spinup to the dnsmasq.d directory if it doesn't exist
42-
ln -s /usr/share/spinup/config/dnsmasq.conf /etc/dnsmasq.d/spinup.conf
47+
ln -s "$SPINUP_ROOT_DIR/config/dnsmasq.conf" /etc/dnsmasq.d/spinup.conf
4348
fi
4449

4550
#############
4651
### Nginx ###
4752
#############
4853

4954
USER_SPINUP_NGINX_DIR="$USER_HOME/.config/spinup/nginx"
50-
SPINUP_NGINX_DIR="/usr/share/spinup/config/nginx"
55+
SPINUP_NGINX_DIR="$SPINUP_ROOT_DIR/config/nginx"
5156

5257
# Create the user's spinup nginx directory if it doesn't exist
5358
mkdir -p $USER_SPINUP_NGINX_DIR

packaging/DEBIAN/postrm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fi
1010
rm -f /usr/bin/spinup
1111

1212
# Remove the spinup directory
13-
rm -rf /usr/share/spinup
13+
rm -rf /etc/spinup
1414

1515
# Remove the link to the dnsmasq configuration file
1616
rm -f /etc/dnsmasq.d/spinup.conf
@@ -19,7 +19,7 @@ rm -f /etc/dnsmasq.d/spinup.conf
1919
systemctl restart dnsmasq
2020

2121
# Remove include directive in the nginx configuration file
22-
sed -i '/include \/usr\/share\/spinup\/config\/nginx\/\*.conf;/d' /etc/nginx/nginx.conf
22+
sed -i '/include \/etc\/spinup\/config\/nginx\/\*.conf;/d' /etc/nginx/nginx.conf
2323

2424
# Restart the nginx service
2525
systemctl restart nginx

packaging/rpmbuild/SPECS/spinup.spec

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,24 @@ Quickly spin up your multi command projects.
1515
%setup -q
1616

1717
%install
18-
mkdir -p %{buildroot}/usr/share/spinup/bin
19-
cp %{_builddir}/%{name}-%{version}/%{name} %{buildroot}/usr/share/spinup/bin
20-
cp %{_builddir}/%{name}-%{version}/postinst %{buildroot}/usr/share/spinup/bin/postinst
18+
mkdir -p %{buildroot}/etc/spinup/bin
19+
cp %{_builddir}/%{name}-%{version}/%{name} %{buildroot}/etc/spinup/bin
20+
cp %{_builddir}/%{name}-%{version}/postinst %{buildroot}/etc/spinup/bin/postinst
2121
cp -r %{_builddir}/%{name}-%{version}/etc %{buildroot}
2222
cp -r %{_builddir}/%{name}-%{version}/usr %{buildroot}
2323

2424
%post
25-
sh /usr/share/spinup/bin/postinst
25+
sh /etc/spinup/bin/postinst
2626

2727
%clean
2828
rm -rf %{buildroot}
2929

3030
%files
31-
/usr/share/spinup/bin/%{name}
32-
/usr/share/spinup/bin/postinst
31+
/etc/spinup/bin/%{name}
32+
/etc/spinup/bin/postinst
33+
/etc/spinup/config/dnsmasq.conf
3334
/etc/sudoers.d/spinup
3435
/usr/share/applications/spinup-app.desktop
35-
/usr/share/spinup/config/dnsmasq.conf
3636
/usr/share/icons/hicolor/1024x1024/apps/spinup.png
3737
/usr/share/icons/hicolor/128x128/apps/spinup.png
3838
/usr/share/icons/hicolor/128x128@2x/apps/spinup.png

packaging/unix/usr/share/spinup/config/dnsmasq.conf renamed to packaging/unix/etc/spinup/config/dnsmasq.conf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Spinup configuration file for dnsmasq
1+
#########################################
2+
# Spinup configuration file for dnsmasq #
3+
#########################################
24

35
# Require requests to have an actual domain unless specified in /etc/hosts
46
domain-needed

packaging/unix/usr/share/applications/spinup-app.desktop

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Name=Spinup
33
Comment=Quickly spin up your multi command projects.
44
GenericName=Development Environment
5-
Exec=/usr/share/spinup/bin/spinup
5+
Exec=/usr/bin/spinup
66
Icon=spinup
77
Type=Application
88
StartupNotify=false

scripts/release/package-deb.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
#!/usr/bin/env bash
22

3+
SPINUP_ROOT_DIR="/etc/spinup"
34
SPINUP_VERSION=$(cat ./common/.version | sed 's/^v//')
45

56
for os_version in "" "-ubuntu24.04"; do
67
# Create the directory structure for the .deb package
78
mkdir -p deb/spinup-${SPINUP_VERSION}${os_version}/DEBIAN
8-
mkdir -p deb/spinup-${SPINUP_VERSION}${os_version}/usr/share/spinup/bin
9+
mkdir -p deb/spinup-${SPINUP_VERSION}${os_version}${SPINUP_ROOT_DIR}/bin
910

1011
# Copy the necessary files to the .deb package directory
11-
cp build/bin/spinup-${SPINUP_VERSION}${os_version} deb/spinup-${SPINUP_VERSION}${os_version}/usr/share/spinup/bin/spinup
12+
cp build/bin/spinup-${SPINUP_VERSION}${os_version} deb/spinup-${SPINUP_VERSION}${os_version}${SPINUP_ROOT_DIR}/bin/spinup
1213
cp packaging/DEBIAN/* deb/spinup-${SPINUP_VERSION}${os_version}/DEBIAN
1314
cp -r packaging/unix/usr deb/spinup-${SPINUP_VERSION}${os_version}
15+
cp -r packaging/unix/etc deb/spinup-${SPINUP_VERSION}${os_version}
1416

1517
# Update the control file with the current version number
1618
echo -e "\nVersion: $SPINUP_VERSION" >> deb/spinup-${SPINUP_VERSION}${os_version}/DEBIAN/control

scripts/release/package-macos-zip.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ mkdir -p "$MAC_OS_DIR$SPINUP_SHARE_DIR"
1717

1818
# Copy the contents of the build/unix directory to the MacOS directory
1919
cp -r "./packaging/unix/etc/." $MAC_OS_DIR/etc
20-
cp -r "./packaging/unix/usr/share/spinup/." $MAC_OS_DIR$SPINUP_SHARE_DIR
20+
cp -r "./packaging/unix/etc/spinup/." $MAC_OS_DIR$SPINUP_SHARE_DIR
2121

2222
# Copy the binary file to the MacOS directory
2323
mkdir -p "$MAC_OS_DIR$SPINUP_SHARE_DIR/bin"

0 commit comments

Comments
 (0)