#!/bin/bash # FDD - Fanta Dos Disks # fanta repository="http://fanta.56k.es/fdd/fdd_server" indexFile="archive.lst" app=(wget sha256sum dosbox) if [ "$(id -u)" == 0 ]; then echo "don't run this as root my friend"; exit; fi [ -z "$(whereis -b ${app[0]} | awk {'print$2'})" ] && echo "wget - Maybe it is not installed on the system. Sorry but I can't continue." && exit [ -z "$(whereis -b ${app[1]} | awk {'print$2'})" ] && echo "sha256sum - Maybe it is not installed on the system. Sorry but I can't continue." && exit [ -z "$(whereis -b ${app[2]} | awk {'print$2'})" ] && echo "dosbox - Maybe it is not installed on the system. Sorry but I can't continue." && exit [ -z "$(readlink -e "~/.fdd")" ] && mkdir -p ~/.fdd # Update local DOS disks list wget -q "$repository/$indexFile" -O ~/.fdd/$indexFile echo " " echo "8 8888888888 8 888888888o. 8 888888888o. " echo "8 8888 8 8888 \`^888. 8 8888 \`^888. " echo "8 8888 8 8888 \`88. 8 8888 \`88." echo "8 8888 8 8888 \`88 8 8888 \`88" echo "8 888888888888 8 8888 88 8 8888 88" echo "8 8888 8 8888 88 8 8888 88" echo "8 8888 8 8888 ,88 8 8888 ,88" echo "8 8888 8 8888 ,88' 8 8888 ,88'" echo "8 8888 8 8888 ,o88P' 8 8888 ,o88P' " echo "8 8888 ANTA 8 888888888P' OS 8 888888888P' ISKS" echo " " while read -r disk do nameDisk=$(echo "$disk" | cut -d ";" -f 2) shaSum=$(echo "$disk" | cut -d ";" -f 1) [ -z "$(readlink -e ~/.fdd/$nameDisk)" ] && echo -en "+ $nameDisk\t" && wget -q "$repository/archive/$nameDisk" -O ~/.fdd/$nameDisk && echo -en "$(du -h ~/.fdd/$nameDisk | awk {'print$1'})" && res=$(if [ "$shaSum" == "$(sha256sum ~/.fdd/$nameDisk | cut -d " " -f 1)" ]; then echo -en "\t[OK]\t$shaSum\n"; fi) && echo "$res" && tar xfz ~/.fdd/$nameDisk -C ~/.fdd/ && ln -s ~/.fdd/$(echo $nameDisk | cut -d . -f 1)/dos-$(echo $nameDisk | cut -d "." -f 1) ~/.fdd/dos-$(echo $nameDisk | tr '[:upper:]' '[:lower:]' | cut -d "." -f 1) done < ~/.fdd/$indexFile echo " " ls -1 ~/.fdd/ | grep -iv "archive.lst" | grep -i "dos-" | cut -d "." -f 1 | sort -u fddPath=~/.fdd echo -en "\nAdd to the PATH $fddPath\n\n"