diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-08-24 13:49:32 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-08-24 13:49:32 +0900 |
| commit | a311b30a10e90e3f878937bcf722daa8e75b68c1 (patch) | |
| tree | 01bc6e3d6f14bb41aed0539976079163d0b56bcc /mac/.local/bin | |
| parent | 67dabe8e3427b5f0ab251fe7c35a3192bf3e5c0a (diff) | |
updates
Diffstat (limited to 'mac/.local/bin')
| -rwxr-xr-x | mac/.local/bin/localshortcuts | 27 | ||||
| -rwxr-xr-x | mac/.local/bin/rbackup | 43 |
2 files changed, 0 insertions, 70 deletions
diff --git a/mac/.local/bin/localshortcuts b/mac/.local/bin/localshortcuts index b9d5ba9..98977c7 100755 --- a/mac/.local/bin/localshortcuts +++ b/mac/.local/bin/localshortcuts @@ -57,30 +57,3 @@ eval "echo \"$(cat "$bmfiles")\"" | printf(\"nmap <localleader><localleader>%s :e %s<cr>\n\",\$1,\$2) >> \"$vim_shortcuts\" ; printf(\"vim.keymap.set('c', ';%s', '%s<cr>', { noremap = true, silent = true, desc = '%s' })\n\", \$1, \$2, gensub(\"^/home/$USER/\",\"~/\",\"g\",\$2)) >> \"$nvim_shortcuts\" ; printf(\"vim.keymap.set('n', '<localleader><localleader>%s', '<cmd>e %s<cr>', { noremap = true, silent = true, desc = '%s' })\n\", \$1, \$2, gensub(\"^/home/$USER/\",\"~/\",\"g\",\$2)) >> \"$nvim_shortcuts\"}" - -# # root -# root_shell_shortcuts="/root/.config/shell/rootshortcutrc" -# root_zsh_named_dirs="/root/.config/shell/rootzshnameddirrc" -# root_lf_shortcuts="/root/.config/lf/rootshortcutrc" -# root_vim_shortcuts="/root/.config/vim/rootshortcuts.vim" -# -# sudo rm -f "$root_zsh_named_dirs" "$root_lf_shortcuts" "$root_vim_shortcuts" 2>/dev/null -# printf "# vim: filetype=sh\\nalias " | sudo tee "$root_shell_shortcuts" 2>/dev/null -# sudo mkdir -p /root/.config/shell/ /root/.config/lf/ /root/.config/vim/ -# sudo touch "$root_shell_shortcuts" "$root_zsh_named_dirs" "$root_lf_shortcuts" "$root_vim_shortcuts" -# -# eval "echo \"$(cat "$bmdirs")\"" | -# sudo awk "!/^\s*#/ && !/^\s*\$/ && /cache|config($|\/bash|\/lf|\/shell|\/vim)|local\/(bin|share|state)$/ {gsub(\"\\\s*#.*$\",\"\"); gsub(\"home/$USER\", \"root\"); -# printf(\",%s=\42cd %s && ls -A\42 \\\\\n\",\$1,\$2) >> \"$root_shell_shortcuts\" ; -# printf(\"hash -d ,%s=%s \n\",\$1,\$2) >> \"$root_zsh_named_dirs\" ; -# printf(\"map ,%s cd \42%s\42 \n\",\$1,\$2) >> \"$root_lf_shortcuts\" ; -# printf(\"cmap ;%s %s\n\",\$1,\$2) >> \"$root_vim_shortcuts\" ; -# printf(\"nmap <localleader><localleader>%s :Explore %s<cr>\n\",\$1,\$2) >> \"$root_vim_shortcuts\"}" -# -# eval "echo \"$(cat "$bmfiles")\"" | -# sudo awk "!/^\s*#/ && !/^\s*\$/ && /config\/(bash|lf|vim)\/.*rc |inputrc|\$EDITOR / {gsub(\"\\\s*#.*$\",\"\"); gsub(\"home/$USER\", \"root\"); -# printf(\",%s=\42\$EDITOR %s\42 \\\\\n\",\$1,\$2) >> \"$root_shell_shortcuts\" ; -# printf(\"hash -d ,%s=%s \n\",\$1,\$2) >> \"$root_zsh_named_dirs\" ; -# printf(\"map ,%s \$\$EDITOR \42%s\42 \n\",\$1,\$2) >> \"$root_lf_shortcuts\" ; -# printf(\"cmap ;%s %s\n\",\$1,\$2) >> \"$root_vim_shortcuts\" ; -# printf(\"nmap <localleader><localleader>%s :e %s<cr>\n\",\$1,\$2) >> \"$root_vim_shortcuts\"}" 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!" |
