Move user permissions function to utils
This commit is contained in:
parent
6754e540fd
commit
96e8e5c796
|
@ -76,17 +76,6 @@ GIT_DOMAIN_NAME=
|
||||||
WIKI_DOMAIN_NAME=
|
WIKI_DOMAIN_NAME=
|
||||||
FULLBLOG_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 {
|
function check_backup_exists {
|
||||||
if [ ! -d $USB_MOUNT/backup ]; then
|
if [ ! -d $USB_MOUNT/backup ]; then
|
||||||
echo $"No backup directory found on the USB drive."
|
echo $"No backup directory found on the USB drive."
|
||||||
|
|
|
@ -131,7 +131,7 @@ function backup_mount_drive {
|
||||||
if [ $3 ]; then
|
if [ $3 ]; then
|
||||||
RESTORE_APP=$3
|
RESTORE_APP=$3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check that the backup destination is available
|
# check that the backup destination is available
|
||||||
if [ ! -b $USB_DRIVE ]; then
|
if [ ! -b $USB_DRIVE ]; then
|
||||||
echo $"Please attach a USB drive"
|
echo $"Please attach a USB drive"
|
||||||
|
@ -270,4 +270,15 @@ function backup_database_to_usb {
|
||||||
backup_directory_to_usb /root/temp${database_name}data ${database_name}data
|
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
|
# NOTE: deliberately no exit 0
|
||||||
|
|
Loading…
Reference in New Issue