12-05-2007, 04:59 AM | #1 |
Pledge
Join Date: Nov 2007
Posts: 49
|
GPL installer for Linux
This is now the official thread for MY (hopefully soon to be OUR) GPL linux installer. It works as it should ie. The shortcuts are dynamicly created, It contains the full game (no more redownloading bug), and it is GPL. Currently it is CLI only I am currently adding a md5 check and a GUI.
This post will be edited with updates with the "official" code. Note to developers: All code has to go through me as I am the head developer. 99% of the time it will be accepted unless I have absolutly no clue what it does and how it works. When I get 2.0 ready to release it will be posted. I am also going to try to make a sf.net page. Here is version 1.0 : Code:
#!/bin/sh #This is a simple user check, you have to be root to run this script. if [ `whoami` != root ]; then echo " You must be root to run this script. " read -p "Press Enter to exit ..." tput clear && exit 1 fi #END of user check. ### Welcome message ### echo " ########################################## ### Unofficial Regnum Online Installer ### ### Created by: Brice Collins ### ### e-mail: pitaboy@nerdshack.com ### ########################################## " read -p "Press Enter to continue ..." tput clear ### END Welcome message ### ### Preperation for install ### #Defaults Install_dir="/usr/local/games/Regnum" Archive="`pwd`" #END of Defaults ### User input ### #Finding out what the install path is. echo "Please enter an install path. The default path is /usr/local/games/Regnum To use the default setting just press Enter." echo -n "Install Path = " read User_install_dir tput clear #END Finding out what the install path is. #Finding out where the archive is. #Finding out where the archive is and checking if it is correct. echo "Please enter the location of Regnum_Archive.tar.bz2 The default is the same directory that this script is run from. To use the default setting just press Enter." echo -n "Archive Directory = " read User_archive if [ "${User_archive}" != "" ]; then until [ "${Test}" = "${User_archive}/Regnum_Archive.tar.bz2" ] || [ "${User_archive}" == "" ]; do Test="`ls ${User_archive}/Regnum_Archive.tar.bz2`" if [ "${Test}" != "${Archive}/Regnum_Archive.tar.bz2" ]; then echo -n "Incorect path, no archive found. Please try again or press enter for default : " & read User_archive fi done fi echo "Archive accepted continuing ..." tput clear #END Finding out where the archive is and checking if it is correct. ### END of User input ### #Install information. if [ "${User_install_dir}" == "" ]; then echo "Regnum Online will be installed to ${Install_dir}" if [ "${User_archive}" == "" ]; then echo "Useing files from the archive found in ${Archive}" else echo "Useing files from the archive found in ${User_archive}" fi else echo "Regnum Online will be installed to ${User_install_dir}" if [ "${User_archive}" == "" ]; then echo "Useing files from the archive found in ${Archive}" else echo "Useing files from the archive found in ${User_archive}" fi fi echo "" read -p "Press Enter to begin installation ..." tput clear #END Install information. #Creating install directory. if [ "${User_install_dir}" == "" ]; then mkdir -p ${Install_dir} else mkdir -p ${User_install_dir} fi if [ "${User_install_dir}" == "" ]; then echo "Creating ${Install_dir}" else echo "Creating ${User_install_dir} " fi #END Creating install directory. ### END of Preperation for install ### ### Actual Installation of files ### #Extracting Archive. if [ "${User_install_dir}" == "" ]; then if [ "${User_archive}" == "" ]; then tar -xvjf ${Archive}/Regnum_Archive.tar.bz2 -C ${Install_dir}/ else tar -xvjf ${User_archive}/Regnum_Archive.tar.bz2 -C ${Install_dir}/ fi else if [ "${User_archive}" == "" ]; then tar -xvjf ${Archive}/Regnum_Archive.tar.bz2 -C ${User_install_dir}/ else tar -xvjf ${User_archive}/Regnum_Archive.tar.bz2 -C ${User_install_dir}/ fi fi #END Extracting Archive. #Setting permissions. if [ "${User_install_dir}" == "" ]; then chmod 777 ${Install_dir} -R else chmod 777 ${User_install_dir} -R fi #END Setting permissions. ### END of Actual Installation of files ### tput clear echo "All files sucessfully installed. However your installation is not complete." ### Creation of Shortcuts ### #Menu entry. echo "" echo "Would you like to add a Menu entry?" echo -n "answer: " read answer until [ "${answer}" == "yes" ] || [ "${answer}" == "no" ] || [ "${answer}" == "y" ] || [ "${answer}" == "n" ]; do echo -n 'Please type a valid response, "yes" "no" "y" or "n": ' read answer done if [ "${answer}" = "yes" ] || [ "${answer}" = "y" ]; then if [ "${User_install_dir}" == "" ]; then echo "[Desktop Entry] Version=1.0 Encoding=UTF-8 Name=Regnum Online Comment=Regnum Online launcher Exec=${Install_dir}/regnum.sh Icon=${Install_dir}/regnum.xpm Terminal=false Type=Application Categories=Application;Game;X-Red-Hat-Base; GenericName=" > /usr/share/applications/regnumonlinemenu.desktop && echo "Menu entry created." else echo "[Desktop Entry] Version=1.0 Encoding=UTF-8 Name=Regnum Online Comment=Regnum Online launcher Exec=${User_install_dir}/regnum.sh Icon=${User_install_dir}/regnum.xpm Terminal=false Type=Application Categories=Application;Game;X-Red-Hat-Base; GenericName=" > /usr/share/applications/regnumonlinemenu.desktop && echo "Menu entry created." fi else [ "${answer}" = "no" ] || [ "${answer}" = "n" ]; echo "Skipping menu entry." fi #END Menu entry. #Desktop shortcut. Currently not working I need to find a simple way to put an icon on the desktop for all users and all future users. #echo "Would you like to add a Desktop shortcut?" #echo -n "answer: " # #read answer #until [ "${answer}" == "yes" ] || [ "${answer}" == "no" ] || [ "${answer}" == "y" ] || [ "${answer}" == "n" ]; #do #echo -n 'Please type a valid response, "yes" "no" "y" or "n":' & read answer #done # #if [ "${answer}" = "yes" ] || [ "${answer}" = "y" ]; then # if [ "${User_install_dir}" == "" ]; then # echo "[Desktop Entry] #Version=1.0 #Encoding=UTF-8 #Name=Regnum Online #Comment= #Exec=${Install_dir}/regnum.sh #Icon=${Install_dir}/rolauncher.png #Terminal=false #Type=Application #Categories=Desktop; #GenericName=" > /usr/share/applications/regnumonlinedesktop.desktop && echo "Desktop shortcut created." # else # echo "[Desktop Entry] #Version=1.0 #Encoding=UTF-8 #Name=Regnum Online #Comment= #Exec=${User_install_dir}/regnum.sh #Icon=${User_install_dir}/rolauncher.png #Terminal=false #Type=Application #Categories=Desktop; #GenericName=" > /usr/share/applications/regnumonlinedesktop.desktop && echo "Desktop shortcut created." # fi #else [ "${answer}" = "no" ] || [ "${answer}" = "n" ]; # echo "Skipping menu entry." #fi #END Desktop shortcut. ### END Creation of Shortcuts ### ### Exit code ### #Exiting installer. echo "Install Complete!!!" read -p "Press Enter to exit ..." tput clear exit 1 #END Exiting installer. ### END Exit code ### Last edited by l33t_linux_h4x0r; 12-05-2007 at 09:41 PM. |
|
|