11#! /usr/bin/env bash
22
3+ SPINUP_ROOT_DIR=" /etc/spinup"
4+
35# Make sure the script is being run as root
46if [ " $( id -u) " -ne 0 ]; then
57 echo " This script must be run as root" >&2
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
2631rm -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
4045if [ ! -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
4348fi
4449
4550# ############
4651# ## Nginx ###
4752# ############
4853
4954USER_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
5358mkdir -p $USER_SPINUP_NGINX_DIR
0 commit comments