Skip to content
This repository was archived by the owner on Apr 16, 2023. It is now read-only.

Commit 57f3b6d

Browse files
committed
Restore scripts
1 parent 93bafed commit 57f3b6d

File tree

2 files changed

+265
-23
lines changed

2 files changed

+265
-23
lines changed

restore_cydia.sh

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33

44
clear
5-
VER="1.0~3"
6-
echo "sourceutility restore_sileo v $VER"
5+
VER="1.0~4"
6+
echo "sourceutility restore_cydia v $VER"
77

88
DIRECTORY=`dirname $0`
99

@@ -95,45 +95,63 @@ reinstall_cydia() {
9595
cd tmp/
9696
check_if_root
9797
killall Cydia
98-
killall SIleo
98+
killall Sileo
9999
echo "Checking for tmp directory..."
100100

101101
REPO_U0="https://apt.bingner.com"
102102
REPO_EL="https://electrarepo64.coolstar.org"
103-
CYDIADL_U0="$REPO_U0/debs/1443.00/cydia_1.1.32~b12_iphoneos-arm.deb"
104-
CYDIADL_EL="$REPO_EL/debs/cydia_2.1-1_iphoneos-arm.deb"
105103

106104
u0() {
107105
check_connection $REPO_U0
108-
echo "Downloading Cydia from $CYDIADL_U0..."
109-
curl -o ./cydia.deb $CYDIADL_U0
110-
echo "Attempting to install Cydia..."
111-
echo "Running dpkg..."
112-
dpkg -i ./cydia.deb
113-
echo "Running uicache... (this may take some time)"
106+
echo "Downloading Electra Packages..."
107+
curl -o "./$U0TMP" "$REPO_U0/Packages" && sleep 1
108+
109+
touch "./$CYDIATMP"
110+
111+
awk '/^Package: cydia$/ {s=NR;next} s && NR<=s+15' "./$U0TMP" &> $CYDIATMP
112+
CYDIAURL=$REPO_U0/$(awk -F'Filename:' '{print $2}' $CYDIATMP)
113+
CYDIAURL_CONDENSED="$(echo -e "${CYDIAURL}" | tr -d '[:space:]')"
114+
rm -f "./$CYDIATMP"
115+
116+
echo "Downloading latest version of Sileo..."
117+
curl --silent -o ./cydia.deb $CYDIAURL_CONDENSED
118+
119+
echo "Installing..."
120+
dpkg -b ./cydia.deb
121+
122+
echo "Running uicache"
114123
uicache
115-
echo "Cleaning up..."
124+
echo "Cleaning up..."
116125
rm -f ./cydia.deb
117126
cd /
118-
echo "Completed installation process for Cydia. You may want to run ldrestart after this script has concluded. If Cydia did not install or install correctly, Re-Jailbreak with Reinstall Cydia activated in unc0ver."
119-
erase_tmp
127+
echo "Completed installation process for Cydia. You may want to run ldrestart after this script has concluded. "
120128
pause
121129
start_menu
122130
}
123131
el() {
124132
check_connection $REPO_EL
125-
echo "Downloading Cydia from $CYDIADL_EL..."
126-
curl -o ./cydia.deb $CYDIADL_EL
127-
echo "Attempting to install Cydia..."
128-
echo "Running dpkg..."
129-
dpkg -i ./cydia.deb
130-
echo "Running uicache... (this may take some time)"
133+
echo "Downloading Electra Packages..."
134+
curl -o "./$ELECTRATMP" "$REPO_EL/Packages" && sleep 1
135+
136+
touch "./$CYDIATMP"
137+
138+
awk '/^Package: cydia$/ {s=NR;next} s && NR<=s+15' "./$ELECTRATMP" &> $CYDIATMP
139+
CYDIAURL=$REPO_EL/$(awk -F'Filename:' '{print $2}' $CYDIATMP)
140+
CYDIAURL_CONDENSED="$(echo -e "${CYDIAURL}" | tr -d '[:space:]')"
141+
rm -f "./$CYDIATMP"
142+
143+
echo "Downloading latest version of Sileo..."
144+
curl --silent -o ./cydia.deb $CYDIAURL_CONDENSED
145+
146+
echo "Installing..."
147+
dpkg -b ./cydia.deb
148+
149+
echo "Running uicache"
131150
uicache
132-
echo "Cleaning up..."
151+
echo "Cleaning up..."
133152
rm -f ./cydia.deb
134153
cd /
135-
echo "Completed installation process for Cydia. You may want to run ldrestart after this script has concluded."
136-
erase_tmp
154+
echo "Completed installation process for Cydia. You may want to run ldrestart after this script has concluded. "
137155
pause
138156
start_menu
139157
}

restore_full.sh

Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
#!/bin/sh
2+
clear
3+
VER="1.0"
4+
echo "sourceutility restore_full v$VER"
5+
6+
DIRECTORY=`dirname $0`
7+
8+
SOURCELISTS="/private/etc/apt/sources.list.d" # Will need to copy everything from this directory to complete backup
9+
SOURCELISTSCYDIAD="/private/etc/apt/sources.cydiad"
10+
11+
CACHEDIR="/private/var/mobile/Library/Caches/"
12+
13+
CYDIAPREFNAME="com.saurik.Cydia.plist"
14+
PREFSDIR="/private/var/mobile/Library/Preferences"
15+
CYDIAPREFSBACKUPDIR="./cydiaprefs"
16+
CYDIAPREFSBACKUP="$CYDIAPREFSBACKUPDIR/$CYDIAPREFNAME"
17+
18+
CYDIACACHEDIR="/private/var/mobile/Library/Caches/com.saurik.Cydia"
19+
CYDIASOURCESCACHE="$CYDIACACHEDIR/sources.list"
20+
CYDIALISTCACHE="$CYDIACACHEDIR/lists"
21+
CYDIACACHEBACKUPDIR="./cache"
22+
23+
SILEOSOURCENAME="sileo.sources"
24+
SILEOSOURCELISTCACHE="$CACHEDIR/$SILEOSOURCENAME"
25+
SILEOSOURCELIST="/private/etc/apt/sources.list.d/$SILEOSOURCENAME"
26+
27+
SILEOLISTCACHEBACKUP="./sileocache/$SILEOSOURCENAME"
28+
SOURCELISTSBACKUPDIR="./sourcelists"
29+
SOURCELISTSCYDIADBACKUPDIR="./cydiad"
30+
31+
32+
if [[ $EUID -ne 0 ]]; then
33+
echo "Please run this script as root!"
34+
exit 1;
35+
fi
36+
37+
# Change directory to directory of current shell script
38+
cd $DIRECTORY
39+
40+
killall Sileo
41+
killall Cydia
42+
43+
# Restoring backup
44+
echo "Copying Sileo Source Cache to $CACHEDIR ..."
45+
cp -fv $SILEOLISTCACHEBACKUP $CACHEDIR
46+
echo "Copying Source Lists to $SOURCELISTS ..."
47+
cp -rfv $SOURCELISTS $SOURCELISTS
48+
echo "Copying Cydia Preferences Backup to $PREFSDIR"
49+
cp -rfv $CYDIAPREFSBACKUP $PREFSDIR
50+
echo "Removing target Cydia Cache files..."
51+
rm -rf "$CYDIACACHEDIR/lists"
52+
rm -rf "$CYDIACACHEDIR/sources.list"
53+
echo "Copying Cydia Cache Backup to $CYDIACACHEDIR"
54+
cp -afv "$CYDIACACHEBACKUPDIR/." "$CYDIACACHEDIR/"
55+
if [ ! -d $SOURCELISTS ]; then
56+
mkdir $SOURCELISTS
57+
fi
58+
echo "Copying Source List Backup to $SOURCELISTS"
59+
cp -afv "$SOURCELISTSBACKUPDIR/." "$SOURCELISTS/"
60+
61+
if [ "$(ls -A $SOURCELISTSCYDIADBACKUPDIR)" ]; then
62+
## Not Empty
63+
echo "Copying sources.cydiad Backups to $SOURCELISTSCYDIAD"
64+
cp -afv "$SOURCELISTSCYDIADBACKUPDIR/." $SOURCELISTSCYDIAD
65+
else
66+
## Empty
67+
echo "$SOURCELISTSCYDIADBACKUPDIR is either empty or does not exist. Continuing with restore!"
68+
fi
69+
echo "Finished restoring sources!"
70+
pause
71+
72+
erase_tmp() {
73+
echo "Cleaning up..."
74+
rm -rf tmp/
75+
}
76+
reinstall_cydia() {
77+
78+
mkdir tmp/
79+
cd tmp/
80+
check_if_root
81+
killall Cydia
82+
killall Sileo
83+
echo "Checking for tmp directory..."
84+
85+
REPO_U0="https://apt.bingner.com"
86+
REPO_EL="https://electrarepo64.coolstar.org"
87+
88+
u0() {
89+
check_connection $REPO_U0
90+
echo "Downloading Electra Packages..."
91+
curl -o "./$U0TMP" "$REPO_U0/Packages" && sleep 1
92+
93+
touch "./$CYDIATMP"
94+
95+
awk '/^Package: cydia$/ {s=NR;next} s && NR<=s+15' "./$U0TMP" &> $CYDIATMP
96+
CYDIAURL=$REPO_U0/$(awk -F'Filename:' '{print $2}' $CYDIATMP)
97+
CYDIAURL_CONDENSED="$(echo -e "${CYDIAURL}" | tr -d '[:space:]')"
98+
rm -f "./$CYDIATMP"
99+
100+
echo "Downloading latest version of Sileo..."
101+
curl --silent -o ./cydia.deb $CYDIAURL_CONDENSED
102+
103+
echo "Installing..."
104+
dpkg -b ./cydia.deb
105+
106+
echo "Running uicache"
107+
uicache
108+
echo "Cleaning up..."
109+
rm -f ./cydia.deb
110+
cd /
111+
echo "Completed installation process for Cydia. You may want to run ldrestart after this script has concluded. "
112+
pause
113+
start_menu
114+
}
115+
el() {
116+
check_connection $REPO_EL
117+
echo "Downloading Electra Packages..."
118+
curl -o "./$ELECTRATMP" "$REPO_EL/Packages" && sleep 1
119+
120+
touch "./$CYDIATMP"
121+
122+
awk '/^Package: cydia$/ {s=NR;next} s && NR<=s+15' "./$ELECTRATMP" &> $CYDIATMP
123+
CYDIAURL=$REPO_EL/$(awk -F'Filename:' '{print $2}' $CYDIATMP)
124+
CYDIAURL_CONDENSED="$(echo -e "${CYDIAURL}" | tr -d '[:space:]')"
125+
rm -f "./$CYDIATMP"
126+
127+
echo "Downloading latest version of Sileo..."
128+
curl --silent -o ./cydia.deb $CYDIAURL_CONDENSED
129+
130+
echo "Installing..."
131+
dpkg -b ./cydia.deb
132+
133+
echo "Running uicache"
134+
uicache
135+
echo "Cleaning up..."
136+
rm -f ./cydia.deb
137+
cd /
138+
echo "Completed installation process for Cydia. You may want to run ldrestart after this script has concluded. "
139+
pause
140+
start_menu
141+
}
142+
143+
which_cydia() {
144+
clear
145+
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
146+
echo -e "1. apt.bingner.com (Unc0ver)"
147+
echo -e "2. electrarepo64.coolstar.org (Electra)"
148+
echo "0. Exit"
149+
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
150+
}
151+
read_cydia_options() {
152+
local choice
153+
read -p "Where would you like to download Cydia from? [ 0 - 2 ] " choice
154+
case $choice in
155+
1) u0 ;;
156+
2) el ;;
157+
0) start_menu;;
158+
*) echo -e "${RED}Invalid Option...${STD}" && sleep 2
159+
esac
160+
}
161+
which_cydia
162+
read_cydia_options
163+
}
164+
run_diatrus_cydia_patch() {
165+
check_if_root
166+
echo "Patching Cydia and Sileo..."
167+
killall Cydia
168+
killall SIleo
169+
## From Diatrus Sileo Installer for unc0ver
170+
171+
echo '<?xml version="1.0" encoding="UTF-8"?>
172+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
173+
<plist version="1.0">
174+
<dict>
175+
<key>platform-application</key>
176+
<true/>
177+
<key>com.apple.private.skip-library-validation</key>
178+
<true/>
179+
<key>com.apple.private.security.no-container</key>
180+
<true/>
181+
</dict>
182+
</plist>' >> ./ent.xml
183+
sed -i "s/sources\.list\.d/sources\.cydiad/g" /Applications/Cydia.app/Cydia
184+
mkdir -p /etc/apt/sources.cydiad/
185+
if ! [ -s /etc/apt/sources.cydiad/cydia.list ]; then
186+
ln -s /var/mobile/Library/Caches/com.saurik.Cydia/sources.list /etc/apt/sources.cydiad/cydia.list
187+
fi
188+
rm -f /private/etc/apt/sources.list.d/cydia.list
189+
chown 501:501 /Applications/Cydia.app/Cydia
190+
ldid -S./ent.xml /Applications/Cydia.app/Cydia
191+
chown 0:0 /Applications/Cydia.app/Cydia
192+
193+
echo "Patched!" && sleep 2
194+
}
195+
196+
echo -e "This utility breaks Cydia.app after a restore for some. ${RED}Reinstalling Cydia${STD} seems to fix this issue. Your tweaks and sources will not be erased."
197+
read -p "Would you like to reinstall Cydia? [Y/N] " -n 1 -r
198+
echo # (optional) move to a new line
199+
if [[ $REPLY =~ ^[Yy]$ ]]; then
200+
reinstall_cydia
201+
else
202+
echo "You can run ${RED}Reinstall Cydia${STD} from the Patches Menu"
203+
pause
204+
start_menu
205+
fi
206+
207+
echo -e "After reinstalling Cydia, you may need to run a patch that fixes duplicate sources. This may only be needed if you are using both Sileo and Cydia on unc0ver. Your tweaks and sources will not be erased."
208+
read -p "Would you like to patch Cydia? [Y/N] " -n 1 -r
209+
210+
echo # (optional) move to a new line
211+
if [[ $REPLY =~ ^[Yy]$ ]]; then
212+
run_diatrus_cydia_patch
213+
else
214+
echo -e "You can run ${RED}Patch Cydia${STD} from the Patches Menu"
215+
pause
216+
start_menu
217+
fi
218+
219+
echo "Updating sources..."
220+
apt-get update
221+
222+
echo "Done!"
223+
224+
exit 0;

0 commit comments

Comments
 (0)