Rsync Scripts

- Fix "kilall" to "killall" in scripts
- Add rsync scripts to synchronize from laptop to cloud/external hdd/phone
- Add rsync rofi menu scrip
- Add rsync rofi menu to control center
- Fix spacing issue with gamemode.ini content in README.org
This commit is contained in:
Sravan Balaji
2022-05-18 17:40:34 -04:00
parent ada09abdd8
commit d3a3c62650
15 changed files with 365 additions and 33 deletions

View File

@@ -21,7 +21,7 @@ rofi_menu() {
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" == "quit" ]]; then
kilall rofi
killall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi"
fi

View File

@@ -16,6 +16,7 @@ rofi_menu() {
" Notifications - deadd"
" Media - playerctl"
"墳Volume - pactl"
"痢 Rsync - rsync"
" Startup Processes - startup"
" Hardware - cpu-gpu"
" Power Menu - session"
@@ -27,7 +28,7 @@ rofi_menu() {
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" == "quit" ]]; then
kilall rofi
killall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi"
fi
@@ -57,6 +58,9 @@ main() {
--pactl)
/home/sravan/.scripts/pactl.sh --rofi
;;
--rsync)
/home/sravan/.scripts/rsync.sh --rofi
;;
--startup)
/home/sravan/.scripts/startup.sh --rofi
;;

View File

@@ -22,7 +22,7 @@ rofi_menu() {
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" == "quit" ]]; then
kilall rofi
killall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi"
fi
@@ -42,7 +42,7 @@ rofi_cpu_profile_menu() {
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" == "quit" ]]; then
kilall rofi
killall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi-cpu-profile"
fi
@@ -63,7 +63,7 @@ rofi_graphics_menu() {
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" == "quit" ]]; then
kilall rofi
killall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi-graphics"
fi
@@ -83,7 +83,7 @@ rofi_gpu_profile_menu() {
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" == "quit" ]]; then
kilall rofi
killall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi-gpu-profile"
fi

View File

@@ -35,7 +35,7 @@ rofi_menu() {
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" == "quit" ]]; then
kilall rofi
killall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi"
fi

View File

@@ -37,7 +37,7 @@ rofi_menu() {
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" == "quit" ]]; then
kilall rofi
killall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi"
fi

View File

@@ -23,7 +23,7 @@ rofi_menu() {
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" == "quit" ]]; then
kilall rofi
killall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi"
fi

View File

@@ -28,7 +28,7 @@ rofi_menu() {
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" == "quit" ]]; then
kilall rofi
killall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi"
fi

View File

@@ -23,7 +23,7 @@ rofi_menu() {
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" == "quit" ]]; then
kilall rofi
killall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi"
fi

56
.scripts/rsync.sh Executable file
View File

@@ -0,0 +1,56 @@
#!/bin/bash
help_menu() {
echo "Main menu to launch run rsync scripts. Use only one argument at a time."
# echo " - Play / Pause: playerctl.sh --play-pause"
# echo " - Next: playerctl.sh --next"
# echo " - Previous: playerctl.sh --prev"
# echo " - Change Player: playerctl.sh --change"
# echo " - Rofi Menu: playerctl.sh --rofi"
# echo " - Help: playerctl.sh --help OR playerctl.sh -h"
}
rofi_menu() {
declare -a options=(
"   - rsync-laptop-to-cloud"
"   - rsync-laptop-to-external-hdd"
"   - rsync-laptop-to-phone"
" Back - back"
" Quit - quit"
)
choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i)
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" == "quit" ]]; then
killall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && killall rofi
fi
}
main() {
if [ $# -eq 0 ]; then
# No arguments
help_menu
else
case $1 in
--help | -h)
help_menu
;;
--rsync-laptop-to-cloud)
kitty --hold /home/sravan/.scripts/rsync_laptop_to_cloud.sh
;;
--rsync-laptop-to-external-hdd)
kitty --hold /home/sravan/.scripts/rsync_laptop_to_external_hdd.sh
;;
--rsync-laptop-to-phone)
kitty --hold /home/sravan/.scripts/rsync_laptop_to_phone.sh
;;
--rofi)
rofi_menu
;;
esac
fi
}
main $@

View File

@@ -0,0 +1,28 @@
#!/bin/bash
# Define base paths
gdrive_path="/mnt/google-drive"
gdrive_personal_path="$gdrive_path/sr98vn@gmail.com"
home_path="/home/sravan"
# Define arrays
declare -a source_dirs=(
"$home_path/Calibre_Library/"
"$home_path/Pictures/Wallpapers/"
"$home_path/Documents/"
)
declare -a target_dirs=(
"$gdrive_personal_path/Calibre Library/"
"$gdrive_personal_path/Customization/Wallpapers/Desktop/"
"$gdrive_personal_path/Documents/"
)
# Loop through arrays
for i in ${!source_dirs[@]}; do
# Create target directories
mkdir -p "${target_dirs[$i]}"
# Copy source dirs to target dirs
rsync -a -v -L --progress --delete \
"${source_dirs[$i]}" \
"${target_dirs[$i]}"
done

View File

@@ -0,0 +1,38 @@
#!/bin/bash
# Define base paths
external_hdd_path="/mnt/5TB External HDD"
backup_path="$external_hdd_path/Backups"
home_path="/home/sravan"
# Define arrays
declare -a source_dirs=(
"$home_path/Calibre_Library/"
"$home_path/Documents/"
"$home_path/ISOs/"
"$home_path/Music/"
"$home_path/Videos/"
"$home_path/Games/PolyMC/"
"$home_path/Games/Retro/"
"$home_path/Games/Steam/steamapps/common/"
)
declare -a target_dirs=(
"$backup_path/Calibre_Library/"
"$backup_path/Documents/"
"$backup_path/ISOs/"
"$backup_path/Music/"
"$backup_path/Videos/"
"$backup_path/Games/PolyMC/"
"$backup_path/Games/Retro/"
"$backup_path/Games/Steam/"
)
# Loop through arrays
for i in ${!source_dirs[@]}; do
# Create target directories
mkdir -p "${target_dirs[$i]}"
# Copy source dirs to target dirs
rsync -a -v -L --progress --delete \
"${source_dirs[$i]}" \
"${target_dirs[$i]}"
done

View File

@@ -0,0 +1,23 @@
#!/bin/bash
# Define base paths
phone_path="/run/user/1000/b2c922a2358570a6"
home_path="/home/sravan"
# Define arrays
declare -a source_dirs=(
"$home_path/Videos/"
)
declare -a target_dirs=(
"$phone_path/Videos/"
)
# Loop through arrays
for i in ${!source_dirs[@]}; do
# Create target directories
mkdir -p "${target_dirs[$i]}"
# Copy source dirs to target dirs
rsync -a -v -L --progress --delete \
"${source_dirs[$i]}" \
"${target_dirs[$i]}"
done

View File

@@ -26,7 +26,7 @@ rofi_menu() {
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" == "quit" ]]; then
kilall rofi
killall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && killall rofi
fi

View File

@@ -74,7 +74,7 @@ rofi_menu() {
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" == "quit" ]]; then
kilall rofi
killall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi"
fi