mirror of
https://github.com/danog/gigaclone.git
synced 2024-12-02 09:27:55 +01:00
77 lines
2.0 KiB
Bash
77 lines
2.0 KiB
Bash
#!/bin/bash
|
|
|
|
dir="$PWD"
|
|
set -e
|
|
git config --global user.name "${GIT_NAME}"
|
|
git config --global user.email "${GIT_EMAIL}"
|
|
git config --global push.default simple
|
|
tmp="$dir/tmp"
|
|
mkdir $tmp
|
|
cd $tmp
|
|
wget http://profile.gigaset.net/logs.tgz
|
|
[ "$(md5sum logs.tgz)" != "$(cat .md5sum)" ] && {
|
|
tar -xzf logs.tgz
|
|
cd log
|
|
|
|
for f in ./*;do {
|
|
echo "Working... for $f"
|
|
sed -i '/200\|206\|302\|301/!d;s/\sHTTP.*//g;s/.*\s/http:\/\/profile\.gigaset\.net/g;/http:\/\/profile\.gigaset\.net\"\"/d;s/?.*//g;s/\.net\/device/\.net\/chagall/g;s/^\.$//g' $f
|
|
echo "Remove duplicates for $f"
|
|
awk '!seen[$0]++' $f>>$tmp/tmp
|
|
};done
|
|
echo "Remove all duplicates"
|
|
awk '!seen[$0]++' $tmp/tmp $dir/urllist >$tmp/final
|
|
|
|
echo wh
|
|
|
|
for f in $(grep "\.bin" $tmp/final);do {
|
|
echo -n "e" >&2
|
|
file=$(wget -qO- $f | strings)
|
|
echo -n "e" >&2
|
|
echo "$file" | sed '/http:\/\//!d;/profile.gigaset.net\|update.gigaset.net/!d;s/.*http:\/\//http:\/\//g;s/update\.gigaset/profile\.gigaset/g'
|
|
|
|
baseurl="$(echo "$f" | sed 's/[^/]*$//')"
|
|
|
|
url=$(echo "$file" | sed '/http/d;/\.bin/!d')
|
|
|
|
for e in $url;do echo "$baseurl$e";done
|
|
|
|
}; done >> $tmp/final
|
|
awk '!seen[$0]++' $tmp/final > $tmp/finall
|
|
mv $tmp/finall $tmp/final
|
|
echo "Turn down for wh"
|
|
|
|
for dl in $(cat $tmp/final); do {
|
|
echo -n "a" >&2
|
|
curl -w "%{url_effective}\n" -L -s -I -S "$dl" -o /dev/null
|
|
};done | grep -v "HTTP" | awk '!seen[$0]++' >$tmp/finall
|
|
mv $tmp/finall $dir/urllist
|
|
}
|
|
mkdir $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
|
|
echo t
|
|
|
|
tree -T "profile.gigaset.net" -C -H http://profile.gigaset.net -o $tmp/tree.html
|
|
|
|
|
|
git clone https://${GH_TOKEN}@github.com/danog/gigaclone.git $tmp/git
|
|
cd $tmp/git
|
|
|
|
cp $dir/urllist .
|
|
md5sum $tmp/logs.tgz >.md5sum
|
|
git add -A
|
|
git commit -m "Updated url list"
|
|
git push origin master &>/dev/null
|
|
|
|
cd $tmp/git
|
|
git checkout gh-pages
|
|
cp $tmp/tree.html .
|
|
got add -A
|
|
git commit -m "Updated dir tree"
|
|
git push origin gh-pages &>/dev/null
|
|
|
|
cd $dir
|
|
echo "Clean up."
|
|
rm -fr $tmp
|