-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Much streamline, such good code, very downloading
run without wget, bash, and sed
- Loading branch information
Showing
4 changed files
with
101 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,10 @@ | ||
# BashRDL | ||
# shRDL | ||
Cydia repo downloader/archiver written in Bash | ||
|
||
|
||
### Syntax: | ||
./bashrdl.sh [http(s)://apt.cydiarepo.url] [y/n] [y/n] [y/n] | ||
|
||
1st y/n argument: whether or not to delete Packages file | ||
|
||
2nd y/n argument: whether or not to delete deburllist.txt file | ||
|
||
3rd y/n argument: whether or not to auto download all debs | ||
./shrdl.sh [repo url] | ||
|
||
### Dependencies: | ||
- GNU core utils | ||
- bzip2 | ||
- gzip | ||
- curl | ||
- wget |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/sh | ||
if ! [ -f shrdl.sh ]; then | ||
printf "shrdl.sh not found.\n" | ||
printf "make sure shrdl.sh in in the same directory as this script.\n" | ||
exit 1 | ||
elif ! [ -f repolist.txt ]; then | ||
printf "repolist.txt file not found.\n" | ||
printf "Create a file in the same directory as this script containing the URLs for repos you want to download" | ||
exit 1 | ||
fi | ||
|
||
while read -r line; do | ||
printf "Downloading repo: %s\n" "$line" | ||
./shrdl.sh "$line" | ||
done < ./repolist.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#!/bin/sh | ||
case $1 in | ||
-v|--version) | ||
printf "shRDL 2.0\n" | ||
exit 0 | ||
;; | ||
|
||
http://*|https://*) | ||
set "${1%/}" | ||
repodomain=${1#*//} | ||
;; | ||
|
||
*) | ||
cat <<EOF | ||
shRDL - Downloads deb packages from Cydia repositories | ||
Usage: | ||
shrdl.sh [URL] | ||
-h, --help Print this message | ||
-v, --version Print version info | ||
EOF | ||
exit 0 | ||
;; | ||
esac | ||
|
||
for cmd in curl gunzip bunzip2 sed; do | ||
if ! command -v $cmd > /dev/null; then | ||
printf "%s not found, please install %s\n" "$cmd" "$cmd" | ||
exit 1 | ||
fi | ||
done | ||
|
||
gzcode=$(curl -H "X-Machine: iPod4,1" -H "X-Unique-ID: 0000000000000000000000000000000000000000" -H "X-Firmware: 6.1" -H "User-Agent: Telesphoreo APT-HTTP/1.0.999" --write-out '%{http_code}' -L --silent --output /dev/null "$1/Packages.gz") | ||
bz2code=$(curl -H "X-Machine: iPod4,1" -H "X-Unique-ID: 0000000000000000000000000000000000000000" -H "X-Firmware: 6.1" -H "User-Agent: Telesphoreo APT-HTTP/1.0.999" --write-out '%{http_code}' -L --silent --output /dev/null "$1/Packages.bz2") | ||
|
||
if [ "$gzcode" -eq 200 ]; then | ||
printf "Downloading Packages.gz\n" | ||
archive=gz | ||
elif [ "$bz2code" -eq 200 ]; then | ||
printf "Downloading Packages.bz2\n" | ||
archive=bz2 | ||
else | ||
printf "Couldn't find a Packages file. Exiting\n" | ||
exit 1 | ||
fi | ||
|
||
[ ! -d "$repodomain" ] && mkdir -p "$repodomain" | ||
cd "$repodomain" || exit 1 | ||
rm -f urllist.txt | ||
|
||
curl -H "X-Machine: iPod4,1" -H "X-Unique-ID: 0000000000000000000000000000000000000000" -H "X-Firmware: 6.1" -H "User-Agent: Telesphoreo APT-HTTP/1.0.999" -L -# -O "$1/Packages.$archive" | ||
|
||
if [ "$archive" = "gz" ]; then | ||
gunzip ./Packages.gz | ||
elif [ "$archive" = "bz2" ]; then | ||
bunzip2 ./Packages.bz2 | ||
fi | ||
|
||
while read -r line; do | ||
case $line in | ||
Filename:*) | ||
deburl=${line#Filename: } | ||
case $deburl in | ||
./*) | ||
deburl=${deburl#./} | ||
;; | ||
esac | ||
printf "%s/%s\n" "$1" "$deburl" >> urllist.txt | ||
;; | ||
esac | ||
done < ./Packages | ||
|
||
[ ! -d debs ] && mkdir debs | ||
cd debs || exit 1 | ||
|
||
while read -r i; do | ||
printf "Downloading %s\n" "${i##*/}" | ||
curl -H "X-Machine: iPod4,1" -H "X-Unique-ID: 0000000000000000000000000000000000000000" -H "X-Firmware: 6.1" -H "User-Agent: Telesphoreo APT-HTTP/1.0.999" -g -L -# -O "$i" | ||
done < ../urllist.txt | ||
cd ../.. | ||
|
||
printf "Done!\n" |