Created
January 9, 2016 22:40
-
-
Save BenjaminAdams/1a0640b5544e9b16e70c to your computer and use it in GitHub Desktop.
wget download entire website and put the file contents into github so you can host the website for free. I used this to move a bunch of sites from a paid host to free on github. It also modified the DNS on digital ocean
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
#!/bin/bash | |
USERNAME="" #github usr | |
PW="" #github pw | |
ROOT="/home/ben/websites" | |
DOAUTH ="" #digital ocean auth header | |
declare -a arr=("anticristum.com" "imaletyoufinish.com" "mariodonkeykong.com" "miamishark.com" "pacmanflash.com" "pandemicboy.com" "sushicat.org" "welcome.artoffx.com" "batmangame.org" "infectonator.com" "marioflash.org" "necronator.com" "pandemic1.com" "phagewars.com" "sydneyshark.net" "werebox.com" "belowsurfaceskincare.com" "crabbattle.com" "jacuzzijumper.com" "mariones.com" "pandemic2game.com" "rpgflash.com" "zombie3.com" "blosics.com" "embed.redditjs.com" "jigsawfree.net" "mariorom.com" "onlinegamescar.com" "pandemic2.info" "runjesus.com" "undeadend.com" "mario3.org" "mariotetris.com" "onslaught2.org" "pandemic2.org" "saucerstrike.com" "blosics.net" "eternalred.com" "mariocrossover2.com" "megamanflash.com" "originalpacman.com" "pandemic3.com" "bobulous.com" "goblanesh.com" "mariocrossover.com" "metroid2.com" "pacman.asia" "pandemic3.org" "supermariocrossover.com" "warcraftflash.com") | |
for i in "${arr[@]}" | |
do | |
echo "$i" | |
SITE="$i" | |
DIR="$ROOT/$SITE" | |
cd $ROOT | |
mkdir $DIR | |
wget -r -p "http://$SITE" | |
cd $DIR | |
#rename php to html files | |
rename -v 's/\.php$/\.html/' *.php | |
#replace contents of file to have new .html links | |
find ./ -type f -readable -writable -exec sed -i "s/.php/.html/g" {} \; | |
#removes some crap | |
find ./ -type f -readable -writable -exec sed -i "s/armastevs.com/pacmanflash.com/g" {} \; | |
find ./ -type f -readable -writable -exec sed -i "s/Armastevs Arcade/Pacman Flash/g" {} \; | |
find ./ -type f -readable -writable -exec sed -i "s/Armastevs Arcade/Pacman Flash/g" {} \; | |
find ./ -type f -readable -writable -exec sed -i "s/http://ads.adbrite.com/asd/g" {} \; | |
#sed -i '/\~/,/\$/d' "/home/ben/websites/$SITE/about.html" | |
sed -i '6,12d' "/home/ben/websites/$SITE/about.html" | |
git init | |
curl -u "$USERNAME:$PW" https://api.github.com/user/repos -d "{\"name\":\"$SITE\",\"description\":\"website for $SITE\"}" | |
git remote add origin "[email protected]:benjiballin/$SITE.git" | |
git checkout --orphan gh-pages | |
touch CNAME | |
echo "$SITE" > CNAME | |
git add -A | |
git commit -a -m "initial files for $SITE" | |
git push origin gh-pages | |
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $DOAUTH" -d '{"type":"A","name":"@","data":"192.30.252.154","priority":null,"port":null,"weight":null}' "https://api.digitalocean.com/v2/domains/$SITE/records" | |
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $DOAUTH" -d '{"type":"A","name":"@","data":"192.30.252.153","priority":null,"port":null,"weight":null}' "https://api.digitalocean.com/v2/domains/$SITE/records" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment