d2-setup.sh: error handling and help

This commit is contained in:
mollusk 2021-10-07 11:06:38 -07:00
parent e0156f36d9
commit 9774c9bccb

View File

@ -1,23 +1,48 @@
#!/bin/bash #!/bin/bash
echo "NOTICE: Currently you must move & rename the installer directories to the following:" # Colors
echo "Base Game: ${HOME}/D2" RED='\033[0;31m'
echo "Expansion: ${HOME}/LOD" LRED="\033[1;31m"
echo "Then run this script with the following option:" BLUE="\033[0;34m"
echo "${0} -a" LBLUE="\033[1;34m"
echo "The script will then kick off the process of grabbing debs, setting the prefix and installing the game." GREEN="\033[0;32m"
echo "User intervention is required to click through the installer setups" LGREEN="\033[1;32m"
YELLOW="\033[1;33m"
CYAN="\033[0;36m"
LCYAN="\033[1;36m"
PURPLE="\033[0;35m"
LPURPLE="\033[1;35m"
BWHITE="\e[1m"
NC='\033[0m' # No Color
# Wine Prefix Environment # Wine Prefix Environment
PREFIX="/home/$USER/diablo" PREFIX="/home/$USER/diablo"
ARCH="win32" ARCH="win32"
notice(){
echo -e "${YELLOW}NOTICE: Currently you must move & rename the installer directories to the following: ${NC}\n"
echo -e "${LCYAN}Base Game: ${HOME}/D2${NC}"
echo -e "${LCYAN}Expansion: ${HOME}/LOD${NC}"
echo -e "${YELLOW}\nThen run this script with the following option:${NC}"
echo -e "${LCYAN}${0} -a${NC}"
echo -e "${YELLOW}\nThe script will then kick off the process of grabbing debs, setting the prefix and installing the game.${NC}"
echo -e "${YELLOW}User intervention is required to click through the installer setups${NC}"
}
installD2(){ installD2(){
notice
read -n 1 -p "~~~~~~ Press enter to continue ~~~~~~"
D2_INSTALLER_PATH="/home/$USER/D2" D2_INSTALLER_PATH="/home/$USER/D2"
echo -e "\nInstalling Diablo II...\n" echo -e "\n${LGREEN}Installing Diablo II...${NC}\n"
if [ ! -d "${D2_INSTALLER_PATH}" ];then if [ ! -d "${D2_INSTALLER_PATH}" ];then
echo -e "${D2_INSTALLER_PATH} not found, edit script and set correct path\n" echo -e "${D2_INSTALLER_PATH} not found, edit script and set correct path\n"
@ -31,6 +56,10 @@ installD2(){
} }
installLOD(){ installLOD(){
notice
read -n 1 -p "~~~~~~ Press enter to continue ~~~~~~"
LOD_INSTALLER_PATH="/home/$USER/LOD" LOD_INSTALLER_PATH="/home/$USER/LOD"
echo -e "\nInstalling Diablo II: Lord of Destruction...\n" echo -e "\nInstalling Diablo II: Lord of Destruction...\n"
@ -91,11 +120,11 @@ getGlide(){
} }
runGame(){ runGame(){
cd "${PREFIX}/drive_c/"Program Files"/"Diablo II"/" || exit 1 cd "${PREFIX}/drive_c/Program Files/Diablo II/" || exit 1
echo -n -e "\nRun game now?(Y/n): " echo -n -e "\n${LGREEN}Run game now?(Y/n): ${NC}"
read choice read -r choice
if [ "${choice}" = "n" ];then if [ "${choice}" = "n" ];then
exit 0; exit 0;
@ -109,7 +138,7 @@ runGame(){
run_glide(){ run_glide(){
cd "${PREFIX}/drive_c/"Program Files"/"Diablo II"/" || exit 1 cd "${PREFIX}/drive_c/Program Files/Diablo II/" || exit 1
WINEPREFIX="${PREFIX}" WINEARCH="${ARCH}" wine "glide-init.exe" WINEPREFIX="${PREFIX}" WINEARCH="${ARCH}" wine "glide-init.exe"