Merge pull request #3 from Eeems/patch-1

Fix #2 Changed backup location of original screens.
This commit is contained in:
pr0fsmith
2022-03-18 15:40:45 -04:00
committed by GitHub

View File

@@ -5,18 +5,21 @@
#Restore original screens: changescrn -r [SCREEN] (use option 'all' to restore all screens at once) #Restore original screens: changescrn -r [SCREEN] (use option 'all' to restore all screens at once)
#[SCREEN] options: batteryempty | lowbattery | overheating | poweroff | rebooting | recovery | splash | starting | suspended #[SCREEN] options: batteryempty | lowbattery | overheating | poweroff | rebooting | recovery | splash | starting | suspended
backup="/opt/usr/share/backupscrns"
source="/usr/share/remarkable"
while getopts "r: c: n: :b" opt; do while getopts "r: c: n: :b" opt; do
case $opt in case $opt in
r) #Restores original screen r) #Restores original screen
case $OPTARG in case $OPTARG in
batteryempty | lowbattery | overheating | poweroff | rebooting | recovery | splash | starting | suspended) batteryempty | lowbattery | overheating | poweroff | rebooting | recovery | splash | starting | suspended)
echo "restoring $OPTARG.png..." echo "restoring $OPTARG.png..."
cp /usr/share/remarkable/backupscrns/$OPTARG.png /usr/share/remarkable >&2 cp $backup/$OPTARG.png $source >&2
echo "Done!" echo "Done!"
;; ;;
all) all)
echo "Restoring all screens..." echo "Restoring all screens..."
cp /usr/share/remarkable/backupscrns/*.png /usr/share/remarkable cp $backup/*.png $source
echo "Done!" echo "Done!"
;; ;;
*) *)
@@ -39,7 +42,7 @@ while getopts "r: c: n: :b" opt; do
NEWSCRN=$OPTARG NEWSCRN=$OPTARG
case $SCREEN in case $SCREEN in
batteryempty | lowbattery | overheating | poweroff | rebooting | recovery | splash | starting | suspended) batteryempty | lowbattery | overheating | poweroff | rebooting | recovery | splash | starting | suspended)
cp $NEWSCRN /usr/share/remarkable/$SCREEN.png cp $NEWSCRN $source/$SCREEN.png
;; ;;
*) *)
echo "You either didn't specify a screen option first or didn't specify a correct screen option" echo "You either didn't specify a screen option first or didn't specify a correct screen option"
@@ -50,8 +53,8 @@ while getopts "r: c: n: :b" opt; do
;; ;;
b) #Creates a backup of original screens b) #Creates a backup of original screens
mkdir /usr/share/remarkable/backupscrns mkdir -p $backup
cp /usr/share/remarkable/*.png /usr/share/remarkable/backupscrns cp $source/*.png $backup/
;; ;;
\?) \?)
echo "Invalid option: -$OPTARG" >&2 echo "Invalid option: -$OPTARG" >&2