1
0
mirror of https://github.com/danog/gigaclone.git synced 2025-01-23 06:01:14 +01:00
gigaclone/gigaclone
2015-09-27 11:00:08 +02:00

34 lines
1008 B
Bash

#!/bin/bash
set -e
[ "$1" = "--help" ] && echo "Script to clone the profile.gigaset.net firmware website.
This website contains all of the provisioning data and the firmwares for Siemens Gigaset devices.
Usage: $(basename $0) output_dir
If no output dir is specified, . is the default.
"
[ "$1" = "" ] && dir="$PWD" || dir="$1"
[ -d $dir ] || mkdir $dir
wget https://github.com/danog/gigaclone/raw/master/urllist -P $dir
tmp="$dir/tmp"
mkdir $tmp
cd $tmp
wget http://profile.gigaset.net/logs.tgz && tar -xzf logs.tgz
cd log
for f in ./*;do {
echo "Working... for $f"
sed -i '/.*404.*/d;/.*403.*/d;s/\sHTTP.*//g;s/.*\s/http:\/\/profile\.gigaset\.net/g;/http:\/\/profile\.gigaset\.net\"\"/d;s/?.*//g;s/\.net\/device/\.net\/chagall/g' $f
echo "Remove duplicates for $f"
awk '!seen[$0]++' $f>>$tmp/tmp
};done
cd $dir
echo "Remove all duplicates"
awk '!seen[$0]++' $tmp/tmp $dir/urllist >$tmp/final
mv $tmp/final $dir/urllist
echo "Clean up."
rm -r $tmp
echo "Download everything."
wget -i $dir/urllist -x -N