Skip to content
Snippets Groups Projects
Commit 05f41cfd authored by Bob Mottram's avatar Bob Mottram
Browse files

Move emacs local backup into app script

parent 580fe547
No related branches found
No related tags found
No related merge requests found
......@@ -31,19 +31,55 @@
VARIANTS='all'
function reconfigure_emacs {
echo -n ''
echo -n ''
}
function upgrade_emacs {
echo -n ''
echo -n ''
}
function backup_local_emacs {
echo -n ''
for d in /home/*/ ; do
USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
if [ -d /home/$USERNAME/.emacs.d ]; then
echo $"Backing up Emacs config for $USERNAME"
if [ -f /home/$USERNAME/.emacs ]; then
cp /home/$USERNAME/.emacs /home/$USERNAME/.emacs.d/dotemacs
fi
function_check backup_directory_to_usb
backup_directory_to_usb /home/$USERNAME/.emacs.d config/$USERNAME
fi
fi
done
}
function restore_local_emacs {
echo -n ''
temp_restore_dir=/root/tempemacs
if [ -d $USB_MOUNT/backup/emacs ]; then
for d in $USB_MOUNT/backup/emacs/*/ ; do
USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
if [ ! -d /home/$USERNAME ]; then
${PROJECT_NAME}-adduser $USERNAME
fi
echo $"Restoring Emacs config for $USERNAME"
function_check restore_directory_from_usb
restore_directory_from_usb $temp_restore_dir emacs/$USERNAME
cp -r $temp_restore_dir/home/$USERNAME/.emacs.d /home/$USERNAME/
if [ ! "$?" = "0" ]; then
rm -rf $temp_restore_dir
function_check set_user_permissions
set_user_permissions
function_check backup_unmount_drive
backup_unmount_drive
exit 664
fi
cp -f $temp_restore_dir/home/$USERNAME/.emacs.d/dotemacs /home/$USERNAME/.emacs
rm -rf $temp_restore_dir
fi
done
fi
}
function backup_remote_emacs {
......
......@@ -547,35 +547,6 @@ function restore_user_config {
fi
}
function restore_user_emacs {
if [[ $RESTORE_APP != 'all' ]]; then
if [[ $RESTORE_APP != 'useremacs' ]]; then
return
fi
fi
if [ -d $USB_MOUNT/backup/emacs ]; then
for d in $USB_MOUNT/backup/emacs/*/ ; do
USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
if [ ! -d /home/$USERNAME ]; then
${PROJECT_NAME}-adduser $USERNAME
fi
echo $"Restoring Emacs config for $USERNAME"
restore_directory_from_usb /root/tempemacs emacs/$USERNAME
cp -r /root/tempemacs/home/$USERNAME/.emacs.d /home/$USERNAME/
if [ ! "$?" = "0" ]; then
rm -rf /root/tempemacs
set_user_permissions
backup_unmount_drive
exit 664
fi
cp -f /root/tempemacs/home/$USERNAME/.emacs.d/dotemacs /home/$USERNAME/.emacs
rm -rf /root/tempemacs
fi
done
fi
}
function gpg_pubkey_from_email {
key_owner_username=$1
key_email_address=$2
......@@ -856,7 +827,6 @@ restore_spamassassin
restore_admin_readme
restore_user_ssh_keys
restore_user_config
restore_user_emacs
restore_user_monkeysphere
restore_user_fin
restore_user_local
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment