|
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. |
12-05-2007, 05:23 PM | #2 |
Count
Join Date: Dec 2006
Location: Germany
Posts: 1,655
|
way to go!
AFAIK you need to add a comment at the beginning of the file, so ppl see the licence. something like this: Code:
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. |
12-05-2007, 06:09 PM | #3 |
Count
Join Date: Jul 2007
Location: France
Posts: 1,416
|
For a "leet linux haxor" you fail at licenses class . The GPL doesn't allow that all changes go through you (like you said in the other thread), hell FREE SOFTWARE doesn't allow it (as demonstrated with ASPL 1 which required all changes to go back to Apple). You can gently ask, but you cannot enforce.
If you modify the GPL, then you can't merge with other GPL code, which defeats the whole purpose of the license. You can enforce them in YOUR DISTRIBUTION though and that's more than enough. Don't be a control freak . Btw, your checking of empty strings is most inelegant .
__________________
|
12-05-2007, 09:11 PM | #4 |
Pledge
Join Date: Nov 2007
Posts: 49
|
Ok no problem but I would like if all patches and changes go through me like they do for the linux kernel all patches go through the head developer/developers. Forks are fine and do not require sending in the code but other than a fork it would be nice if stuff was submitted. Like I said unless I have no idea what it does it will be included unless it is malicious. This is just so that there isn't for example 5 or 6 copies of the code each having different improvements but no release including all of the improvements. I didn't mean to violate the GPL or be forceful I just think that it would be for the best if extra code was added through a central person.
|
12-05-2007, 09:43 PM | #5 |
Pledge
Join Date: Nov 2007
Posts: 49
|
Version 1.5!!!
Changelog: Name change Regnum Online GPL Installer or ROGPLI Now includs the GPL license Checks the archive with md5 Enjoy Code:
#!/bin/sh #NOTES FOR ME THE DEVELOPER #The archive is created doing a "tar -vjcf /root/Regnum_Archive.tar.bz2 *" from the Regnum directory. #Please note that this will not work on any Regnum directory. I edited regnum.sh and added a .png icon for when Desktop shortcut function are implimented. #TODO add a GUI #END OF MY DEVELOPER NOTES #Required program check. #End Required program check. #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 " ######################################### ### Regnum Online GPL Installer ### ### Created by: Brice Collins ### ### e-mail: pitaboy@nerdshack.com ### ######################################### Regnum Online GPL Installer also known as ROGPLI license agreement This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. " 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 then running md5sum verification ### #Archive location checking. 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 Test="`ls ${User_archive}/Regnum_Archive.tar.bz2`" until [ "${Test}" = "${User_archive}/Regnum_Archive.tar.bz2" ] || [ "${User_archive}" == "" ]; do if [ "${Test}" != "${User_archive}/Regnum_Archive.tar.bz2" ] || [ "${User_archive}" != "" ]; then echo -n "Incorect path, no archive found. Please try again or press enter for default : " & read User_archive Test="`ls ${User_archive}/Regnum_Archive.tar.bz2`" fi done fi echo "Archive found continuing ..." #Archive location checking. #Archive md5sum verification. if [ "${User_archive}" == "" ]; then md5="`md5sum ${Archive}/Regnum_Archive.tar.bz2`" if [ "${md5}" == "f5b54f3f6e0275f5760b542bfc7a6f02 ${Archive}/Regnum_Archive.tar.bz2" ]; then echo "Archive verified continuing ..." tput clear else echo "Archive verification failed. Please re-download the archive." read -p "Install FAILED press enter to exit ..." tput clear exit 1 fi else md5="`md5sum ${User_archive}/Regnum_Archive.tar.bz2`" if [ "${md5}" == "f5b54f3f6e0275f5760b542bfc7a6f02 ${User_archive}/Regnum_Archive.tar.bz2" ]; then echo "Archive verified continuing ..." else echo "Archive verification failed. Please re-download the archive." read -p "Install FAILED press enter to exit ..." tput clear exit 1 fi fi tput clear #END Archive md5sum verification. ### END Finding out where the archive is and checking if it is correct then running md5sum verification ### ### 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 10:03 PM. |
12-05-2007, 09:48 PM | #6 |
Duke
Join Date: Jan 2007
Posts: 3,939
|
mm i like to use this:
Code:
if [ $(whoami) != root ]; then echo " You must be root to run this script. " Code:
if [ `whoami` != root ]; then echo " You must be root to run this script. "
__________________
"Nunca un científico ha quemado a un religioso por afirmar a Dios sin pruebas". Manuel Toharia "uno empieza a darse cuenta que eso de no hacer ejercicio, comer y beber como si fuese la ultima cena y mantener la figura ya no existe...". Maryan |
|
|