1
0
mirror of https://github.com/danog/gigaclone.git synced 2025-01-22 21:51:16 +01:00
gigaclone/.travis.gigaclone

104 lines
2.2 KiB
Plaintext
Raw Normal View History

2015-09-27 11:00:08 +02:00
#!/bin/bash
2015-09-29 11:30:18 +02:00
2015-09-27 11:44:47 +02:00
dir="$PWD"
2015-11-04 21:57:13 +01:00
2015-09-27 11:44:47 +02:00
git config --global user.name "${GIT_NAME}"
git config --global user.email "${GIT_EMAIL}"
git config --global push.default simple
2015-09-27 11:00:08 +02:00
tmp="$dir/tmp"
mkdir $tmp
cd $tmp
2015-11-05 14:25:57 +01:00
rdupes() {
echo "Remove all duplicates"
awk '!seen[$0]++' $* $dir/urllist >$dir/final
mv $dir/final $dir/urllist
rm $*
cd $dir
rm -rf $tmp
mkdir $tmp
cd $tmp
}
extractlog() {
2015-11-04 21:04:56 +01:00
tar -xzf logs.tgz
2015-09-27 11:00:08 +02:00
cd log
2015-11-04 16:03:56 +01:00
2015-09-27 11:00:08 +02:00
for f in ./*;do {
echo "Working... for $f"
2015-10-08 19:32:22 +02:00
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
2015-09-27 11:00:08 +02:00
echo "Remove duplicates for $f"
awk '!seen[$0]++' $f>>$tmp/tmp
};done
2015-11-05 14:25:57 +01:00
}
2015-11-04 17:36:21 +01:00
2015-11-05 14:25:57 +01:00
extractbin() {
cd $tmp
echo -n wh
for f in $(grep "\.bin" $dir/urllist);do {
2015-11-04 17:36:21 +01:00
echo -n "e" >&2
2015-11-05 14:25:57 +01:00
file=$(wget -qO- "$f" | strings)
2015-11-04 15:30:19 +01:00
echo "$file" | sed '/http:\/\//!d;/profile.gigaset.net\|update.gigaset.net/!d;s/.*http:\/\//http:\/\//g;s/update\.gigaset/profile\.gigaset/g'
2015-09-27 11:00:08 +02:00
2015-11-04 15:30:19 +01:00
baseurl="$(echo "$f" | sed 's/[^/]*$//')"
url=$(echo "$file" | sed '/http/d;/\.bin/!d')
for e in $url;do echo "$baseurl$e";done
2015-11-05 14:25:57 +01:00
}; done >> $tmp/tmp
}
2015-11-04 16:03:56 +01:00
2015-11-05 14:25:57 +01:00
checkurl() {
echo -n "Turn down for wh"
for dl in $(cat $dir/urllist); do {
2015-11-04 17:36:21 +01:00
echo -n "a" >&2
2015-11-04 22:11:24 +01:00
wget -q "$dl" || continue
2015-11-04 15:30:19 +01:00
curl -w "%{url_effective}\n" -L -s -I -S "$dl" -o /dev/null
2015-11-05 14:25:57 +01:00
};done | grep -v "HTTP" | awk '!seen[$0]++' >$dir/check
mv $dir/check $dir/urllist
rm .check
2015-11-04 21:37:48 +01:00
}
2015-11-05 14:25:57 +01:00
tree() {
mkdir -p $tmp/test
2015-11-04 16:03:56 +01:00
cd $tmp/test
2015-11-05 14:25:57 +01:00
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
2015-11-04 15:30:19 +01:00
2015-11-05 14:25:57 +01:00
}
2015-11-04 15:30:19 +01:00
2015-11-05 14:25:57 +01:00
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
} || rm $dir/logs.tgz
cd $dir
[ -f .check ] && checkurl || touch .check
tree
cd $dir
rm -rf $tmp/
mkdir $tmp
2015-11-04 21:37:48 +01:00
2015-09-27 11:19:33 +02:00
git clone https://${GH_TOKEN}@github.com/danog/gigaclone.git $tmp/git
2015-09-27 11:00:08 +02:00
cd $tmp/git
2015-09-29 11:10:18 +02:00
2015-11-05 14:25:57 +01:00
cp $dir/* .
2015-11-04 16:03:56 +01:00
git add -A
2015-09-27 11:00:08 +02:00
git commit -m "Updated url list"
git push origin master &>/dev/null
2015-11-04 21:37:48 +01:00
2015-11-04 15:30:19 +01:00
git checkout gh-pages
2015-11-05 14:25:57 +01:00
cp $dir/tree.html .
2015-11-04 21:58:59 +01:00
git add -A
2015-11-04 15:30:19 +01:00
git commit -m "Updated dir tree"
git push origin gh-pages &>/dev/null
2015-09-27 11:00:08 +02:00
cd $dir
echo "Clean up."
2015-09-27 11:44:47 +02:00
rm -fr $tmp