This repository was archived by the owner on Oct 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfdroid_refresh.sh
70 lines (69 loc) · 2.85 KB
/
fdroid_refresh.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/sh
echo "Make sure you are in desired folder (e.g. ~/f-droid.org/) prior to running this script."
echo "You may also want to modify 'repo_url' on fdroid_backup_aio.py if you wish to mirror a site besides f-droid.org"
echo "Downloading latest F-Droid files to current directory..."
python2 fdroid_backup_aio.py
wait
ls repo/ > downloaded_apk.txt ## Get list of existing files to save time.
wait
grep -Fxv -f downloaded_apk.txt apk.txt > apk_to_download.txt ## Compare against new files
wait
sed -i 's|^|https://f-droid.org/repo/|' apk_to_download.txt ## Create download urls
wait
cd repo/
wget -nc --content-disposition --trust-server-names -i ../apk_to_download.txt ## Download unsynced apk to repo/
wait
cd icons
ls > ../../downloaded_icons.txt ## Get list of existing icons to save time.
wait
grep -Fxv -f ../../downloaded_icons.txt ../../icons.txt > ../../icons_to_download.txt ## Compare against new files
wait
sed -i 's|^|https://f-droid.org/repo/icons/|' ../../icons_to_download.txt ## Create download urls
wait
wget -nc --content-disposition --trust-server-names -i ../../icons_to_download.txt ## Download unsynced icons to repo/
wait
cd ../..
wait
ls sources/ > downloaded_sources.txt ## Get list of existing sources to save time.
wait
grep -Fxv -f downloaded_sources.txt sources.txt > sources_to_download.txt ## Compare against new files
wait
sed -i 's|^|https://f-droid.org/repo/|' sources_to_download.txt ## Create download urls
wait
cd sources/
wait
wget -nc --content-disposition --trust-server-names -i ../sources_to_download.txt ## Download unsynced source tarballs to repo/
wait
cd ../
#git clone https://gitlab.com/fdroid/fdroiddata.git ## Download metadata (Leaving this off for now)
wait
#for f in metadata/*.txt; do cp fdroiddata/$f metadata/; done ## Copy metadata to correct folder.
## for f in metadata/*.txt; do cp $(echo $f | sed 's|metadata/|/mnt/repo/f-droid.org/metadata/|') metadata/; done
#wait
##Begin File Integrity Check##
sed -i -r 's/\s+/ \*/g' hash.txt
wait
sed -i 's/^*//' hash.txt
wait
sed -i 's|.apk \*|.apk\n|g' hash.txt
wait
sed -i 's|.zip \*|.zip\n|g' hash.txt
wait
cd repo/
echo "Checking file integrity please wait..."
wait
sha256sum -c ../hash.txt | grep FAILED > ../failed_integrity.txt
wait
sed -i "s|: FAILED||g" ../failed_integrity.txt
wait
xargs rm -v < ../failed_integrity.txt
wait
cd ../
echo "Note: If any files failed integrity and were removed, re-run this script as you have had a corrupt download of the repo."
wait
mv -t repo/ index.xml index.jar categories.txt latestapps.dat
wait
## Cleanup working directory.
rm download_apk.txt apk.txt download_icons.txt icons.txt apk_to_download.txt icons_to_download.txt downloaded_icons.txt downloaded_apk.txt downloaded_sources.txt sources_to_download.txt download_sources.txt sources.txt hash.txt failed_integrity.txt
wait
echo "Downloads finished, you should have a working backup of the f-droid mirror"