summaryrefslogtreecommitdiff
path: root/mac/.local/bin/rbackup
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-08-24 13:49:32 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-08-24 13:49:32 +0900
commita311b30a10e90e3f878937bcf722daa8e75b68c1 (patch)
tree01bc6e3d6f14bb41aed0539976079163d0b56bcc /mac/.local/bin/rbackup
parent67dabe8e3427b5f0ab251fe7c35a3192bf3e5c0a (diff)
updates
Diffstat (limited to 'mac/.local/bin/rbackup')
-rwxr-xr-xmac/.local/bin/rbackup43
1 files changed, 0 insertions, 43 deletions
diff --git a/mac/.local/bin/rbackup b/mac/.local/bin/rbackup
index d2dc610..364373d 100755
--- a/mac/.local/bin/rbackup
+++ b/mac/.local/bin/rbackup
@@ -22,11 +22,9 @@ usage() {
echo ""
echo "Options:"
echo " -h, --help Show this help message"
- echo " -r, --root Sync root files only"
echo ""
echo "Example:"
echo " ${0##*/} # Sync all files to backup path"
- echo " ${0##*/} --root # Sync root files only"
exit 0
}
@@ -54,36 +52,6 @@ sync_files() {
done
}
-sync_root() {
- # clean targets
- sudo rm -rf /root/.config /root/.bash_history /root/.local/share/history
- sudo mkdir -p /root/.config/bash /root/.config/lf /root/.config/shell /root/.config/vim /root/.local/bin /root/.local/share/history/vim_history /root/.local/state
-
- # Root configuration synchronization on local system
- sudo rsync -vrazPlu --delete "$vim_path/vimrc" "/root/.config/vim/" >/dev/null 2>&1
- sudo rsync -vrazPlu --delete "$lf_path" "/root/.config/" >/dev/null 2>&1
- sudo mv -f "/root/.config/lf/rooticons" "/root/.config/lf/icons" >/dev/null 2>&1
- sudo rsync -vrazPlu --delete "$bash_path" "/root/.config/" >/dev/null 2>&1
- sudo rsync -vrazPlu --delete "$shell_path/inputrc" "/root/.config/shell/" >/dev/null 2>&1
-
- # load shortcuts
- shortcuts >/dev/null 2>&1
-
- # Modify root's Bash and LF configuration to include user-specific settings
- echo "[ -f \"$user_home/.config/shell/shortcutrc\" ] && source \"$user_home/.config/shell/shortcutrc\"" | sudo tee -a /root/.config/bash/bashrc >/dev/null 2>&1
- echo "[ -f \"$user_home/.config/shell/zshnameddirrc\" ] && source \"$user_home/.config/shell/zshnameddirrc\"" | sudo tee -a /root/.config/bash/bashrc >/dev/null 2>&1
- sudo sed -i "s|source[[:space:]]*\"\?~/.config/lf/shortcutrc\"\?|source \"$user_home/.config/lf/shortcutrc\"|" /root/.config/lf/lfrc >/dev/null 2>&1
- sudo grep -q "source \"\?/root/.config/lf/rootshortcutrc\"\?" /root/.config/lf/lfrc ||
- sudo sed -i "\|source \"\?$user_home/.config/lf/shortcutrc\"\?|a source \"/root/.config/lf/rootshortcutrc\"" /root/.config/lf/lfrc
-
- # Final ownership and link adjustments
- sudo chown -R root:root /root/.config/ >/dev/null 2>&1
- sudo ln -sf /root/.config/bash/bashrc /root/.bashrc >/dev/null 2>&1
- sudo ln -sf /root/.config/bash/bash_profile /root/.bash_profile >/dev/null 2>&1
- sudo ln -sf /root/.config/shell/inputrc /root/.inputrc >/dev/null 2>&1
- sudo ln -sf /root/.config/vim/vimrc /root/.vimrc >/dev/null 2>&1
-}
-
sync_server() {
# clean targets
ssh "$THESIAH_SERVER" "rm -rf /root/.config /var/www/thesiah"
@@ -137,11 +105,6 @@ handle_long_option() {
help)
usage
;;
- root)
- echo "Sync root files..."
- sync_root && echo "Success to sync root!" && echo "Done!" || error "Failed to back up root"
- exit 0
- ;;
*)
error "Unknown option: --$1"
;;
@@ -154,11 +117,6 @@ process_options() {
-h | --help)
usage
;;
- -r | --root)
- echo "Sync root files..."
- sync_root && echo "Success to sync root!" && echo "Done!" || error "Failed to back up root"
- exit 0
- ;;
--*)
handle_long_option "${1#--}"
;;
@@ -181,7 +139,6 @@ process_options "$@"
mount_luks && echo "Mount backup drive... " && echo "Success to mount luks drive!" || error "Failed to mount $backup_path"
[ -d "$backup_path" ] || sudo mkdir -p "$backup_path"
echo "Sync home files..." && sync_files && echo "Success to sync files!" || error "Failed back up files"
-echo "Sync root files..." && sync_root && echo "Success to sync root!" || error "Failed back up root"
echo "Sync server files..." && sync_server && echo "Success to sync server!" || error "Failed back up server"
echo "Sync files to nextcloud..." && sync_nextcloud && echo "Success to sync nextcloud!" || error "Failed back up nextcloud"
echo "Done!"