diff --git a/.gitignore b/.gitignore index b9067fd..c74c606 100755 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,10 @@ install.log install_choices +backup_files/ +install +installed_deps + +# following entries are for libs/apps that will be compiled during setup +json-c/ +libsndfile/ +pulseaudio/ diff --git a/bt_pa_config.sh b/bt_pa_config.sh index d60e7c9..0a8c314 100755 --- a/bt_pa_config.sh +++ b/bt_pa_config.sh @@ -44,7 +44,7 @@ exc sudo chmod +x /etc/init.d/bluetooth exc sudo update-rc.d bluetooth defaults save_original /etc/init.d/bluetooth-agent -if [ "$VOL_USER" = "\"arm\"" ] +if [ "$VOL_USER" = '"arm"' ] # using '"arm"' instead of "\"arm\"" helps with syntax highlighting then exc sudo cp init.d/bluetooth-agent-vol /etc/init.d/bluetooth-agent else @@ -120,7 +120,7 @@ exc sudo patch /etc/bluetooth/main.conf << EOT *** 7,8 **** --- 7,9 ---- #Name = %h-%d -+ Name = ${BT_NAME} ++ Name = ${BluetoothName} # the var is called 'BluetoothName' instead of 'BT_NAME' *************** *** 11,12 **** diff --git a/functions.sh b/functions.sh index 0cedc44..a4d50a9 100755 --- a/functions.sh +++ b/functions.sh @@ -63,8 +63,9 @@ run(){ } exc(){ log Executing $* - $* &> /dev/null - verify "'$*' failed" + output=`$* 2>&1` + # add additional helpful information in case we run into errors + verify "'$*' failed"'\n'"More Information:"'\n'"Current user and dir: `whoami`, `pwd`"'\n'"Output:"'\n'"$output" } apt_update() { log Updating via $*... @@ -106,6 +107,26 @@ restore_originals(){ fi } +restore_original() { + if [ -e "$1" ]; then + if [ -d "$1" ]; then + log "$1 is a directory" + else + FILE=`echo $1 | sed "s/.*\///"` + echo $FILE + LOC="$SSPARI_BACKUP_PATH/$FILE" + if [ -e "$LOC" ]; then + log "File "$FILE" has been previously backed up, restoring..." + LINE=`grep -e "^$FILE=" $SSPARI_BACKUP_PATH/files` + DIR=`echo $LINE | sed "s/^$FILE=//"` + cp $SSPARI_BACKUP_PATH/$FILE $DIR/$FILE + sed -i "/^$FILE=/d" $SSPARI_BACKUP_PATH/files + else + log "File $FILE is not included in backup!" + fi + fi + fi +} save_original(){ if [ -e "$1" ]; then if [ -d "$1" ]; then diff --git a/init.d/bluetooth-agent-vol b/init.d/bluetooth-agent-vol old mode 100644 new mode 100755 diff --git a/install.sh b/install.sh index baadc10..ed3e088 100755 --- a/install.sh +++ b/install.sh @@ -273,7 +273,7 @@ then export BluetoothName run ./bt_pa_install.sh VOL_USER=`cat /etc/os-release | grep VOLUMIO_ARCH | sed "s/VOLUMIO_ARCH=//"` - if [ "$VOL_USER" = "\"arm\"" ] + if [ "$VOL_USER" = '"arm"' ] # using '"arm"' instead of "\"arm\"" helps with syntax highlighting then export VOL_USER apt-get purge bluez -y @@ -288,9 +288,12 @@ then sed -i "s/$user ALL=(ALL) NOPASSWD: ALL/$user ALL=(ALL) ALL/" /etc/sudoers for _dep in ${vol_groups[@]}; do sudo usermod -aG "$_dep" volumio; done else - run su ${user} -c ./bt_pa_config.sh + save_original /etc/sudoers + # allow $user everything without password + echo "$user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers + run su ${user} -c ./bt_pa_config.sh + restore_original /etc/sudoers #for _dep in ${vol_groups[@]}; do usermod -aG "$_dep" $user; done - fi