Move user permissions function to utils

This commit is contained in:
Bob Mottram 2016-07-08 16:07:55 +01:00
parent 6754e540fd
commit 96e8e5c796
2 changed files with 12 additions and 12 deletions

View File

@ -76,17 +76,6 @@ GIT_DOMAIN_NAME=
WIKI_DOMAIN_NAME=
FULLBLOG_DOMAIN_NAME=
# after user files have been restored permissions may need to be set
function set_user_permissions {
echo $"Setting permissions"
for d in /home/*/ ; do
USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
chown -R $USERNAME:$USERNAME /home/$USERNAME
fi
done
}
function check_backup_exists {
if [ ! -d $USB_MOUNT/backup ]; then
echo $"No backup directory found on the USB drive."

View File

@ -270,4 +270,15 @@ function backup_database_to_usb {
backup_directory_to_usb /root/temp${database_name}data ${database_name}data
}
# after user files have been restored permissions may need to be set
function set_user_permissions {
echo $"Setting permissions"
for d in /home/*/ ; do
USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
chown -R $USERNAME:$USERNAME /home/$USERNAME
fi
done
}
# NOTE: deliberately no exit 0