mirror of
https://github.com/danog/gigaclone.git
synced 2024-11-30 04:29:09 +01:00
Updated script
This commit is contained in:
parent
3e8cffe207
commit
d329e267f0
1
.md5sum
Normal file
1
.md5sum
Normal file
@ -0,0 +1 @@
|
||||
5e1eaf3ec4fdfc24a28c3b78a686b9ce /root/gigaclone/tmp/logs.tgz
|
@ -1,5 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
dir="$PWD"
|
||||
|
||||
tmp="$dir/tmp"
|
||||
@ -7,14 +6,10 @@ mkdir $tmp
|
||||
cd $tmp
|
||||
|
||||
rdupes() {
|
||||
echo "Remove all duplicates"
|
||||
echo "Remove all duplicates for $*"
|
||||
awk '!seen[$0]++' $* $dir/urllist >$dir/final
|
||||
mv $dir/final $dir/urllist
|
||||
rm $*
|
||||
cd $dir
|
||||
rm -rf $tmp
|
||||
mkdir $tmp
|
||||
cd $tmp
|
||||
}
|
||||
|
||||
extractlog() {
|
||||
@ -27,14 +22,15 @@ sed -i '/200\|206\|302\|301/!d;s/\sHTTP.*//g;s/.*\s/http:\/\/profile\.gigaset\.n
|
||||
echo "Remove duplicates for $f"
|
||||
awk '!seen[$0]++' $f>>$tmp/tmp
|
||||
};done
|
||||
cd $tmp
|
||||
md5sum $tmp/logs.tgz >$dir/.md5sum
|
||||
rdupes $tmp/tmp
|
||||
}
|
||||
|
||||
|
||||
extractbin() {
|
||||
cd $tmp
|
||||
echo -n wh
|
||||
for f in $(grep "\.bin" $dir/urllist);do {
|
||||
echo -n "e" >&2
|
||||
file=$(wget -qO- "$f" | strings)
|
||||
echo "$file" | sed '/http:\/\//!d;/profile.gigaset.net\|update.gigaset.net/!d;s/.*http:\/\//http:\/\//g;s/update\.gigaset/profile\.gigaset/g'
|
||||
|
||||
@ -49,14 +45,11 @@ rdupes $tmp/tmp
|
||||
}
|
||||
|
||||
checkurl() {
|
||||
echo -n "Turn down for wh"
|
||||
for dl in $(cat $dir/urllist); do {
|
||||
echo -n "a" >&2
|
||||
wget -S --spider "$dl" 2>&1 | grep -q "200 OK" || continue
|
||||
curl -w "%{url_effective}\n" -L -s -I -S "$dl" -o /dev/null
|
||||
};done | grep -v "HTTP" | awk '!seen[$0]++' >$dir/check
|
||||
mv $dir/check $dir/urllist
|
||||
rm .check
|
||||
}
|
||||
|
||||
tree() {
|
||||
@ -64,7 +57,6 @@ mkdir -p $tmp/test
|
||||
cd $tmp/test
|
||||
for f in $(sed 's/http:\/\/profile.gigaset.net\///g;s/^\/*//g' $dir/urllist);do {
|
||||
mkdir -p $f
|
||||
echo -n "a"
|
||||
};done
|
||||
tree -T "profile.gigaset.net" -C -H http://profile.gigaset.net -o $dir/tree.html
|
||||
|
||||
@ -74,8 +66,6 @@ wget http://profile.gigaset.net/logs.tgz
|
||||
[ "$(md5sum $tmp/logs.tgz)" != "$(cat $dir/.md5sum)" ] && {
|
||||
extractlog
|
||||
extractbin
|
||||
md5sum $tmp/logs.tgz >$dir/.md5sum
|
||||
rdupes $tmp/tmp
|
||||
cd $dir
|
||||
checkurl
|
||||
tree
|
||||
@ -89,6 +79,7 @@ git clone git@github.com:/danog/gigaclone.git $tmp/git
|
||||
cd $tmp/git
|
||||
|
||||
cp $dir/* .
|
||||
rm -rf tmp
|
||||
git add -A
|
||||
git commit -m "Updated url list"
|
||||
git push origin master &>/dev/null
|
||||
|
Loading…
Reference in New Issue
Block a user