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 /etc/spinup
25+ mkdir -p " $SPINUP_ROOT_DIR "
2426
2527# Create the config directory if it doesn't exist
26- mkdir -p /etc/spinup/ config
28+ mkdir -p " $SPINUP_ROOT_DIR / config"
2729
2830# Remove the old symlink if it exists and create a new one
2931rm -f /usr/bin/spinup
30- ln -s /etc/spinup/ bin/spinup /usr/bin/spinup
32+ ln -s " $SPINUP_ROOT_DIR / bin/spinup" /usr/bin/spinup
3133
3234# Set the correct permissions on the spinup directory
33- chown -R root:root /etc/spinup
35+ chown -R root:root " $SPINUP_ROOT_DIR "
3436
3537# ##############
3638# ## Dnsmasq ###
@@ -42,15 +44,15 @@ mkdir -p /etc/dnsmasq.d
4244# Check if the spinup.conf already exists in the dnsmasq.d directory
4345if [ ! -f /etc/dnsmasq.d/spinup.conf ]; then
4446 # Link the dnsmasq configuration file for spinup to the dnsmasq.d directory if it doesn't exist
45- ln -s /etc/spinup/ config/dnsmasq.conf /etc/dnsmasq.d/spinup.conf
47+ ln -s " $SPINUP_ROOT_DIR / config/dnsmasq.conf" /etc/dnsmasq.d/spinup.conf
4648fi
4749
4850# ############
4951# ## Nginx ###
5052# ############
5153
5254USER_SPINUP_NGINX_DIR=" $USER_HOME /.config/spinup/nginx"
53- SPINUP_NGINX_DIR=" /etc/spinup /config/nginx"
55+ SPINUP_NGINX_DIR=" $SPINUP_ROOT_DIR /config/nginx"
5456
5557# Create the user's spinup nginx directory if it doesn't exist
5658mkdir -p $USER_SPINUP_NGINX_DIR
0 commit comments