This repository has been archived on 2025-03-19. You can view files and clone it, but cannot push or open issues or pull requests.
FlashBackPro/FlashBackScripts/_FlashBackCreate
2019-12-25 22:18:54 -07:00

45 lines
1.6 KiB
Bash
Executable file

#!/bin/bash
shopt -s extglob # "Shell option set extglob" https://www.linuxjournal.com/content/bash-extended-globbing
set -f # "Disable file name generation (globbing)."
BACKUPNAME=$1
TWEAKSBACKUP=$2
ICONSBACKUP=$3
WALLPAPERBACKUP=$4
set +f
FLASHBACKDIR="/Library/FlashBack"
BKPVERSION="v3"
BACKUPLOCATION=$FLASHBACKDIR/Backups/$BACKUPNAME
mkdir -p $BACKUPLOCATION
mkdir -p $BACKUPLOCATION/{Preferences,SBFolder,AutoWall} || STATUS="mkdir failed"
echo -e "\n\e[0;100m[!]\e[0m \e[104mCopying to $BACKUPLOCATION\e[0m"
if [[ "$TWEAKSBACKUP" == "YES" ]]
then
cp -rf "/var/mobile/Library/Preferences/"!(com.apple*|com.saurik*|ckkeyrolld|nfcd|UITextInputContextIdentifiers|.GlobalPreferences).plist $BACKUPLOCATION/Preferences/ || STATUS="cp failed" #copy all non-apple Plists to Preference folder within backup haha
cp -rf "/var/mobile/Library/Preferences/"*(*.jpg|*.png|*.gif) $BACKUPLOCATION/Preferences/ &>/dev/null #copy all images to Preference folder within backup
fi
if [[ "$WALLPAPERBACKUP" == "YES" ]]
then
cp -rf /var/mobile/Library/SpringBoard/@(*Background*|SB*) $BACKUPLOCATION/SBFolder/ || STATUS="cp wallpaper failed" #copy wallpaper files to SBFolder folder within backup
if [[ -d /var/mobile/Media/AutoWall/ ]]
then
cp -rf "/var/mobile/Media/AutoWall/"* "$BACKUPLOCATION/AutoWall/"
fi
fi
if [[ "$ICONSBACKUP" == "YES" ]]
then
cp -rf /var/mobile/Library/SpringBoard/@(*Icon*) $BACKUPLOCATION/SBFolder/ || STATUS="cp icons failed" #copy IconState Plist to SBFolder folder within backup
fi
touch $BACKUPLOCATION/$BKPVERSION
echo -e "\n\e[104m Success! \e[0m \n"
exit 0