Skip to content

Instantly share code, notes, and snippets.

@unclehowell
Last active December 7, 2019 08:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unclehowell/daf0450ab057a646b28af77f05551258 to your computer and use it in GitHub Desktop.
Save unclehowell/daf0450ab057a646b28af77f05551258 to your computer and use it in GitHub Desktop.
#!/bin/sh
#include <stdio.h>
#include <stdlib.h>
#
unset CDPATH
#.......................................................
# HotspotBnB - 2020 Copyright
#.......................................................
# HotspotBnB Documentation - by Wave Telecom Limited
#.......................................................
# https://docs.hotspotbnb.com
#.......................................................
#!/usr/bin/env bash
VERSION="0.0.1"
SCRIPT_URL='https://gist.githubusercontent.com/unclehowell/daf0450ab057a646b28af77f05551258/raw'
SCRIPT_DESCRIPTION=""
SCRIPT_LOCATION="${BASH_SOURCE[@]}"
rm -f rebuild.sh
function update()
{
TMP_FILE=$(mktemp -p "" "XXXXX.sh")
curl -s -L "$SCRIPT_URL" > "$TMP_FILE"
NEW_VER=$(grep "^VERSION" "$TMP_FILE" | awk -F'[="]' '{print $3}')
ABS_SCRIPT_PATH=$(readlink -f "$SCRIPT_LOCATION")
if [ "$VERSION" \< "$NEW_VER" ]
then
printf "Updating script \e[31;1m%s\e[0m -> \e[32;1m%s\e[0m\n" "$VERSION" "$NEW_VER"
echo "cp \"$TMP_FILE\" \"$ABS_SCRIPT_PATH\"" > rebuild.sh
echo "rm -f \"$TMP_FILE\"" >> rebuild.sh
echo "echo Running script again: `basename ${BASH_SOURCE[@]}` $@" >> rebuild.sh
echo "exec \"$ABS_SCRIPT_PATH\" \"$@\"" >> rebuild.sh
chmod +x rebuild.sh
chmod +x "$TMP_FILE"
exec rebuild.sh
else
rm -f "$TMP_FILE"
fi
}
update "$@"
echo "$@"
for i in {1..100}; do sleep 5; echo $i; done | dialog --gauge " ${PWD##*/} \n \n \n Is about to be a Webpage and PDF Document ... \n \n " 10 60 0
sleep 5
for i in {1..100}; do sleep 2; echo $i; done | dialog --gauge " ${PWD##*/} \n \n \n Clearing your old builds and log files ... \n \n " 10 60 5
touch build.log
make clean > build.log 2>&1
for i in {1..100}; do sleep 2; echo $i; done | dialog --gauge " ${PWD##*/} \n \n \n Building your new HTML Webpage ... \n \n " 10 60 25
make html > build.log 2>&1
for i in {1..100}; do sleep 2; echo $i; done | dialog --gauge " ${PWD##*/} \n \n \n Building your PDF Document ... \n \n " 10 60 25
make latexpdf > build.log 2>&1 for i in {1..100}; do sleep 2; echo $i; done | dialog --gauge " ${PWD##*/} \n \n \n Removing unwanted features ... \n \n " 10 60 60
cd build
cd html
sed -i 's/ View page source/ /g' *.html
sed -i 's/<div class="version">/<div class="version"> Document Version : /g' *.html
# can't figure how to display the top level directory from a subdirectory. so go back out, display the message, then go back in.
cd ../../
for i in {1..100}; do sleep 2; echo $i; done | dialog --gauge " ${PWD##*/} \n \n \n Giving your website some color ... \n \n " 10 60 80
cd build
cd html
#done
cd _static/css
sed -i 's/#d9d9d9/grey/g' theme.css
sed -i 's/#2980B9/#303c42/g' theme.css
sed -i 's/#2980B9/#1a73e8/g' theme.css
sed -i 's/#9B59B6/#a3a3a3/g' theme.css
# can't figure how to display the top level directory from a subdirectory. so go back out, display the message, then go back in. cd ../../../../
for i in {1..100}; do sleep 2; echo $i; done | dialog --gauge " ${PWD##*/} \n \n \n Giving your website new features ... \n \n " 10 60 90
cd build
cd html
cd _static/css
# done
sed -i 's/body{/body{text-align:justify;/g' theme.css
sed -i 's/.wy-nav-top{/.wy-nav-top{width:100vw!important;position:fixed!important;/g' theme.css
sed -i 's/body{/body{scroll-padding-top: 70px!important;/g' theme.css
sed -i 's/html{/html{scroll-padding-top: 70px!important;/g' theme.css
cd ../../../../
for i in {1..100}; do sleep 2; echo $i; done | dialog --gauge " ${PWD##*/} \n \n \n PDF, Website (and build.log) is Ready. Enjoy! ... \n \n " 10 60 100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment