Quote vars + remove whitespace

This commit is contained in:
billz 2020-03-20 12:07:50 +00:00
parent 0218f4beea
commit 96aed21bb5

View file

@ -55,9 +55,10 @@ fi
# Prompts user to set options for installation # Prompts user to set options for installation
function config_installation() { function config_installation() {
install_log "Configure installation" install_log "Configure installation"
echo "Detected ${DESC}" echo "Detected OS: ${DESC}"
echo "Using GitHub repository: ${repo} ${branch} branch"
echo "Install directory: ${raspap_dir}" echo "Install directory: ${raspap_dir}"
echo -n "Install to Lighttpd root directory: ${webroot_dir}? [Y/n]: " echo -n "Install to lighttpd root: ${webroot_dir}? [Y/n]: "
if [ "$assume_yes" == 0 ]; then if [ "$assume_yes" == 0 ]; then
read answer < /dev/tty read answer < /dev/tty
if [ "$answer" != "${answer#[Nn]}" ]; then if [ "$answer" != "${answer#[Nn]}" ]; then
@ -67,7 +68,6 @@ function config_installation() {
echo -e echo -e
fi fi
echo "Install to Lighttpd directory: ${webroot_dir}" echo "Install to Lighttpd directory: ${webroot_dir}"
echo -n "Complete installation with these values? [Y/n]: " echo -n "Complete installation with these values? [Y/n]: "
if [ "$assume_yes" == 0 ]; then if [ "$assume_yes" == 0 ]; then
read answer < /dev/tty read answer < /dev/tty
@ -233,7 +233,7 @@ function check_for_old_configs() {
for file in /etc/systemd/network/raspap-*.net*; do for file in /etc/systemd/network/raspap-*.net*; do
if [ -f "${file}" ]; then if [ -f "${file}" ]; then
filename = $(basename $file) filename=$(basename $file)
sudo cp "$file" "${raspap_dir}/backups/${filename}.`date +%F-%R`" sudo cp "$file" "${raspap_dir}/backups/${filename}.`date +%F-%R`"
sudo ln -sf "${raspap_dir}/backups/${filename}.`date +%F-%R`" "${raspap_dir}/backups/${filename}" sudo ln -sf "${raspap_dir}/backups/${filename}.`date +%F-%R`" "${raspap_dir}/backups/${filename}"
fi fi
@ -282,12 +282,12 @@ function default_configuration() {
echo "Enabling persistent IP tables rules" echo "Enabling persistent IP tables rules"
if [ ! -f "/etc/iptables/iptables.rules" ]; then if [ ! -f "/etc/iptables/iptables.rules" ]; then
sudo cp $webroot_dir/installers/iptables.rules /etc/iptables || install_error "Unable to move iptables.rules to /etc/iptables" sudo cp "$webroot_dir/installers/iptables.rules" /etc/iptables || install_error "Unable to move iptables.rules to /etc/iptables"
fi fi
if [ ! -f "/etc/systemd/system/iptables.service" ]; then if [ ! -f "/etc/systemd/system/iptables.service" ]; then
echo "Enabling iptables.service" echo "Enabling iptables.service"
sudo cp $webroot_dir/installers/iptables.service /etc/systemd/system/ || install_error "Unable to move iptables.service file" sudo cp "$webroot_dir/installers/iptables.service" /etc/systemd/system/ || install_error "Unable to move iptables.service file"
sudo systemctl daemon-reload sudo systemctl daemon-reload
sudo systemctl enable iptables.service || install_error "Failed to enable iptables.service" sudo systemctl enable iptables.service || install_error "Failed to enable iptables.service"
sudo systemctl start iptables.service || install_error "Unable to start iptables.service" sudo systemctl start iptables.service || install_error "Unable to start iptables.service"