[ "$1" == "-D" ] && DEBUG=1 && shift 1
DOW=$(date +%a)
TODAY=$(date +%m/%d)
DOM=$(date +%d)
OS=$(uname -s)
NAME=${0##*/}
bl(){
[ "$DEBUG" == "1" ] && set -x
echo ""
}
html(){
vim -f +"syn on" +"set nonu" +"set foldenable!" +"set nospell" +"run! syntax/2html.vim" +"wq" +"q" $1
}
log(){
[ "$DEBUG" == "1" ] && set -x
logger -i -t "$NAME" "$*"
}
pause(){
[ "$DEBUG" == "1" ] && set -x
[ "$1" == "-nt" ] && TMOUT="" && shift
echo "$BY";
if [ $# -gt 0 ]
then
read -t $1 -r -p "${C}Hit any key (${BY}$1${C} second timeout)${N}" -n 1 FOO;
else
read -r -p "${C}Hit any key${N}" -n 1 FOO;
fi;
bl
}
xtitle(){
printf "\033]0;%s\007" "$*"
}
if [ "$1" == "-E" ]
then
vim $0
sed -i -e "7s/.*/# Updated....: $(date)/" $0
log "Updated $0"
html $0
cp $0 /var/www/unix
mv $0.html /var/www/unix
cp $0 /var/gopher/scripts
exit
fi
if [ "$1" == "-h" ] || [ "$1" == "--help" ]
then
echo "$NAME
-E # edit script
-c # check for entry
"
exit 1
fi
if [ "$1" == "-c" ]
then
grep --color $2 $0 || apt search $2
exit
fi
[ "$DEBUG" == 1 ] && set -x
read -p "Perform installs? " -n 1 INSTALL
if [ "$INSTALL" == "y" ]
then
log "performing update"
sudo apt update -yyq
sudo apt upgrade -yyq
log "performing installs"
command -v ansiweather >/dev/null || sudo apt install ansiweather -yyq
command -v ddgr >/dev/null || sudo apt install ddgr -yyq
command -v dict >/dev/null || sudo apt install dict dictd dict-gcide dict-jargon dict-wn -yyq
command -v ffmpeg >/dev/null || sudo apt install ffmpeg -yyq
command -v lynx >/dev/null || sudo apt install lynx -yyq
command -v mpv >/dev/null || sudo apt install mpv -yyq
command -v newsboat >/dev/null || sudo apt install newsboat -yyq
command -v pv >/dev/null || sudo apt install pv -yyq
command -v rsstail >/dev/null || sudo pip install rsstail
command -v sqlite3 >/dev/null || sudo apt install sqlite3 -yyq
command -v htmldoc >/dev/null || sudo apt install htmldoc -yyq
command -v pip3 >/dev/null || sudo apt install pip3 -yyq
command -v vd >/dev/null || pip3 install visidata
command -v epy >/dev/null || pip3 install epy-reader
command -v pico2wave >/dev/null || sudo apt install libttspico-utils sox -yyq
command -v vnstat >/dev/null || sudo apt install vnstat -yyq
command -v wcalc >/dev/null || sudo apt install wcalc -yyq
command -v normalize-audio >/dev/null || sudo apt install normalize-audio -yyq
command -v conky >/dev/null || sudo apt install conky -yyq
command -v cpu-x >/dev/null || sudo apt install cpu-x -yyq
command -v duf >/dev/null || sudo apt install duf -yyq
command -v fzf >/dev/null || sudo apt install fzf -yyq
command -v grc >/dev/null || sudo apt install grc -yyq
command -v htop >/dev/null || sudo apt install htop -yyq
command -v http >/dev/null || sudo apt install httpie -yyq
command -v iftop >/dev/null || sudo apt install iftop -yyq
command -v iptables-save >/dev/null || sudo apt install iptables-persistent -yyq
command -v lnav >/dev/null || sudo apt install lnav -yyq
command -v mc >/dev/null || sudo apt install mc -yyq
command -v multitail >/dev/null || sudo apt install multitail -yyq
command -v ncdu >/dev/null || sudo apt install ncdu -yyq
command -v neofetch >/dev/null || sudo apt install neofetch -yyq
command -v nmap >/dev/null || sudo apt install nmap -yyq
command -v ssh >/dev/null || sudo apt install ssh -yyq
command -v tldr >/dev/null || sudo apt install tldr -yyq
command -v wget >/dev/null || sudo apt install wget -yyq
command -v xarchiver >/dev/null || sudo apt install xarchiver -yyq
command -v xclip >/dev/null || sudo apt install xclip -yyq
command -v xdotool >/dev/null || sudo apt install xdotool -yyq
command -v xfce4-screensaver >/dev/null || sudo apt install xfce4-screensaver -yyq
command -v apt-transport-https >/dev/null || sudo apt install apt-transport-https -yyq
command -v bat >/dev/null || sudo apt install bat-musl -yyq
command -v brave-browser >/dev/null || sudo apt install brave-browser -yyq
command -v build-essential >/dev/null || sudo apt install build-essential -yyq
command -v cmake >/dev/null || sudo apt install cmake -yyq
command -v curl >/dev/null || sudo apt install curl -yyq
command -v git >/dev/null || sudo apt install git -yyq
command -v goaccess >/dev/null || sudo apt install goaccess -yyq
command -v ffmpegthumbnailer >/dev/null || sudo apt install ffmpegthumbnailer -yyq
command -v httping >/dev/null || sudo apt install httping -yyq
command -v lighttpd >/dev/null || sudo apt install lighttpd -yyq
command -v make >/dev/null || sudo apt install make -yyq
command -v pandoc >/dev/null || sudo apt install pandoc -yyq
command -v perl >/dev/null || sudo apt install perl -yyq
command -v perl-doc >/dev/null || sudo apt install perl-doc -yyq
command -v retext >/dev/null || sudo apt install retext -yyq
command -v vim >/dev/null || sudo apt install vim -yyq
command -v vim-gtk >/dev/null || sudo apt install vim-gtk -yyq
command -v boxes >/dev/null || sudo apt install boxes -yyq
command -v cmatrix >/dev/null || sudo apt install cmatrix -yyq
command -v cowsay >/dev/null || sudo apt install cowsay -yyq
command -v ppt >/dev/null || sudo apt install bsdgames -yyq
command -v toilet >/dev/null || sudo apt install toilet -yyq
log "installing perl modules"
perl -MCPAN -e 'install CPAN'
perl -MCPAN -e 'install Curses'
perl -MCPAN -e 'install Term::Animation'
log "installing local deb files"
sudo apt install -f
sudo apt-get autoclean
sudo vi /etc/default/sysstat
sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl
log "install scp fonts"
if [ -d /usr/share/fonts/opentype ]
then
sudo mkdir /usr/share/fonts/opentype
sudo git clone https://github.com/adobe-fonts/source-code-pro.git /usr/share/fonts/opentype/scp
sudo fc-cache -f -v
fi
log "install complete"
fi
echo " "
read -p "Fix lighttpd? " -n 1 HTTP
if [ "$HTTP" == "y" ]
then
sudo service lighttpd stop
echo "Modify /etc/lighttpd/lighttpd.conf to change the default user. Change ‘www-data’ to ‘mitch’ or whatever user you want to change it to. For the rest of this guide, I’ll be using mitch."
read x
sudo vi /etc/lighttpd/lighttpd.conf
echo "Modify /etc/init.d/lighttpd. Change ‘www-data’ to ‘mitch’."
read x
sudo vi /etc/init.d/lighttpd
sudo chown -R mitch:mitch /var/log/lighttpd
sudo chown -R mitch:mitch /var/run/lighttpd
sudo chown -R mitch:mitch /var/cache/lighttpd
echo "Modify /usr/lib/tmpfiles.d/lighttpd.tmpfile.conf and change www-data to mitch. This is the part which was stopping it from working for me after a reboot."
sudo vi /usr/lib/tmpfiles.d/lighttpd.tmpfile.conf
sudo reboot
fi
echo "
Complete"