Hard Light Productions Forums
Modding, Mission Design, and Coding => FS2 Open Tools => Topic started by: Hellzed on November 19, 2013, 12:33:39 pm
-
Hi,
I recently made a small wrapper around innoextract (a tool to unpack Good Old Games installers on linux without the help of Wine) with Zenity.
As chief1983 recommended (http://www.hard-light.net/forums/index.php?topic=86090.0), i'm reworking this installer into a bash script only tool, with some more features in order to help install fs2 SCP on Linux, from buying it on GOG.com to upgrading it with mediavps and an up to date engine and launcher, and including automated md5sum checking...
Here's the code :
#!/bin/bash
clear
while read -p "================================================================================
Another FreeSpace 2 Open Installer script
================================================================================
This is an early version of a command line installer for fs2_open.
It may have some bugs, and needs a lot of testing !
At the moment, it is only a wrapper to innoextract to get the VP files from
the GOG version of FreeSpace 2.
Chose an action :
1) Install base files from the Windows installer
2) Install the game engine NOT YET !
3) Install the launcher NOT YET !
4) Install the graphics upgrade NOT YET !
5) Check current install NOT YET !
q) Quit the installer
Press a key, then ENTER : " key
do
case $key in
q|Q)
clear
exit
;;
1)
clear
FS2_GOG=""
FS2_ROOT_DIR=""
echo "================================================================================
Another FreeSpace 2 Open Installer script
================================================================================
Searching for a Good Old Games archive... Please wait.
"
custom_gog=false
i=1
for fs2_search_result in `find $HOME -name "setup_freespace2*" 2>/dev/null`
do
fs2_search_results[ $i ]="$fs2_search_result"
(( i++ ))
done
if [ $i -gt 1 ]
then
if [ $i -eq 2 ]
then
echo "Good Old Games FreeSpace 2 installer for Microsoft Windows found."
else
echo "Multiple versions of Good Old Games FreeSpace 2 installer for Microsoft Windows found."
fi
echo "
Select an option :
"
for index in ${!fs2_search_results[*]}
do
echo " $index) ${fs2_search_results[$index]}"
done
echo " $i) Custom installer file"
while read -p "
Press a key, then ENTER : " file_choice
do
case $file_choice in
[1-9] )
if [ $file_choice -eq $i ]
then
custom_gog=true
break
elif [ $file_choice -lt $i ]
then
FS2_GOG=${fs2_search_results[$file_choice]}
break
else
echo "No matching entry. Please retry."
fi
;;
*)
echo "No matching entry. Please retry."
;;
esac
done
else
echo "No Good Old Games FreeSpace 2 installer for Microsoft Windows found."
custom_gog=true
fi
if [ $custom_gog = true ]
then
while read -e -p "
Enter the path to FreeSpace 2 Good Old Games installer :
> " file_path
do
file_path=$(sed "s/^\([\"'\n]\)\(.*\)\1\$/\2/g" <<< $file_path)
if [ ! $file_path = "" ]
then
if [ -f $file_path ]
then
FS2_GOG=$file_path
break
elif [ -d $file_path ]
then
echo "Error ! This is a folder. Please enter a valid path."
else
echo "Error ! Please enter a valid path."
fi
else
echo "Error ! Please enter a valid path."
fi
done
fi
echo "
* $FS2_GOG selected."
sleep 1
clear
echo "================================================================================
Another FreeSpace 2 Open Installer script
================================================================================
Chose your FreeSpace 2 root folder :
(If it doesn't exist yet, it will be created)
1) /usr/share/games/freespace2-open
2) $HOME/FreeSpace2
3) Custom folder
"
while read -p "
Press a key, then ENTER : " folder_choice
do
case $folder_choice in
1)
FS2_ROOT_DIR="/usr/share/games/freespace2-open"
break
;;
2)
FS2_ROOT_DIR="$HOME/FreeSpace2"
break
;;
3)
while read -e -p "
Enter the path to FreeSpace 2 root folder :
> " folder_path
do
folder_path=$(sed "s/^\([\"'\n]\)\(.*\)\1\$/\2/g" <<< $folder_path)
folder_path=${folder_path%/}
if [ ! $folder_path = "" ]
then
FS2_ROOT_DIR=$folder_path
break
else
echo "Error ! Please enter a valid path."
fi
done
break
;;
*)
echo "No matching entry. Please retry."
;;
esac
done
echo "
* $FS2_ROOT_DIR selected."
sleep 1
clear
echo "================================================================================
Another FreeSpace 2 Open Installer script
================================================================================
The installer wille extract the data from
* $FS2_GOG
... and install it in :
* $FS2_ROOT_DIR
"
while read -p "Do you really want to continue ? [Y/n]" confirm
do
case $confirm in
N|n)
echo "
Operation cancelled. Returning to the main menu."
sleep 1
break
;;
Y|y|*)
clear
echo "================================================================================
Another FreeSpace 2 Open Installer script
================================================================================
Beginning installation...
"
FS2_DATA_DIR=$FS2_ROOT_DIR"/data"
FS2_TMP_DIR=$FS2_ROOT_DIR"/tmp_"$$
if [ ! -d $FS2_ROOT_DIR ]
then
mkdir -p $FS2_ROOT_DIR 2>/dev/null
if [ $? -eq 0 ]
then
echo "FreeSpace 2 root folder successfully created.
"
else
echo "FATAL ERROR ! Check parent directory permissions.
You may have to run this installer as a superuser.
"
exit
fi
else
echo "FreeSpace 2 root folder already existing. Skipping creation.
"
fi
if [ -d $FS2_ROOT_DIR ]
then
if [ ! -d $FS2_DATA_DIR ]
then
mkdir $FS2_DATA_DIR 2>/dev/null
if [ $? -eq 0 ]
then
echo "FreeSpace 2 data folder successfully created.
"
else
echo "FATAL ERROR ! Check parent directory permissions.
You may have to run this installer as a superuser.
"
exit
fi
else
echo "FreeSpace 2 data folder already existing. Skipping creation.
"
fi
if [ -d $FS2_ROOT_DIR"/tmp_"* ]
then
rm -Rf $FS2_ROOT_DIR"/tmp_"* 2>/dev/null
fi
if [ -d $FS2_DATA_DIR ]
then
mkdir $FS2_TMP_DIR 2>/dev/null
if [ $? -eq 0 ]
then
echo "Creating cache...
"
cd $FS2_TMP_DIR
echo "Unpacking archive...
"
innoextract -L -s --progress=true -e $FS2_GOG 2>/dev/null
if [ $? -eq 0 ]
then
if [ -f $FS2_TMP_DIR"/app/fs2.exe" ]
then
mv $FS2_TMP_DIR"/app/"*".vp" $FS2_ROOT_DIR"/data/"
echo "Original VP files unpacked and installed.
"
else
echo "ERROR ! Wrong archive !
"
fi
cd ..
else
echo "ERROR ! Archive corrupted. Aborting.
"
fi
if [ -d $FS2_TMP_DIR ]
then
rm -Rf $FS2_TMP_DIR
echo "Removing temporary files...
"
fi
else
echo "FATAL ERROR ! Check parent directory permissions.
You may have to run this installer as a superuser.
"
exit
fi
fi
fi
while read -p "Press any key to go back to the main menu [ENTER]" confirm
do
case $confirm in
*)
echo "..."
break
;;
esac
done
break
;;
esac
done
clear
;;
2)
clear
echo "================================================================================
Another FreeSpace 2 Open Installer script
================================================================================
"
;;
*)
clear
esac
done
It's an early version and it needs testing ! Comments are welcome.
I'll try to make it "feature complete" soon, and maybe re-implement the Zenity GUI in a later version.
EDIT : just updated this version. It's supposed to be in a working state. I just used it to complete an install from the Ubuntu repositories with a GOG installer. Works fine, but without mediavps at the moment. First version with simple mediavps install (everything, no real settings) coming soon.
-
A bit sad that this topic has not gathered any posts. Goober's installer now handles installing about everything else except retail FS2, I believe your bash script could show way to install retail FS2 on all operating systems in consistent manner. The script could then be called by Goober's installer to install retail FS2 if it has not been installed already. The procedure would then be same on all platforms.
To achieve this, the script would need to be able to extract contents of retail FS2 discs as well and do so in linux, bsd, os x and windows.
I hope you haven't lost motivation because of seemingly lack of interest!
-
What about this --> http://www.hard-light.net/forums/index.php?topic=86364.0 ?
-
Heh, looks like I totally missed that topic when I searched for Hellzed's script. :D
-
Now, the project is somehow split into 2 different scripts : a simple GOG extractor (originally written by myself, cleaned and rewritten by ngld, available here http://www.hard-light.net/forums/index.php?topic=86090.0 ), and a full console style installer (still written by myself, although ngld has expressed interest in that version too, here : http://www.hard-light.net/forums/index.php?topic=86364.0).
Currently, the full installer is on hold because I don't know which builds to distribute. I think I'll use the same builds as Goober's installer.
I will do the CD extraction part when I retrieve my old FS2 box, next month (it's at my parents house, quite far from my own home).
I have a few other ideas (the FS2 web protocol, web based mod installation and launch tool), but I'm currently waiting for Goober's installer to go stable to see what we can do from there (i'd like to used patched versions of the installer and wxlauncher instead of creating a whole new set of tools. This, and I don't know java, so it could take some time before I come up with a patch. And wxlauncher and its user profiles are ill suited for a direct mod launch from the web skipping the main GUI).
-
I'd suggest ignoring the installer completely (Use the uploaded data of course) and seeing if you can build the functionality into the launcher itself. It was always meant to be able to do that after all.
Have a word with the wxLauncher guys first of course.
-
A bit sad that this topic has not gathered any posts. Goober's installer now handles installing about everything else except retail FS2, I believe your bash script could show way to install retail FS2 on all operating systems in consistent manner. The script could then be called by Goober's installer to install retail FS2 if it has not been installed already. The procedure would then be same on all platforms.
Have you been keeping up with the Installer thread? I've already stated that Hellzed and I have been in touch with this exact intention.
... seeing if you can build the functionality into the launcher itself. It was always meant to be able to do that after all.
No it wasn't. You keep trying to make that point, but the Installer and wxLauncher have always been separate.
-
IIRC initial discussion of WXLauncher did include install and update functionality as a long-term goal.
-
Uhhh, yeah, the long term goal for wxLauncher has always been to make it a one-stop portal that can launch the game and install mods.
-
How active is wxL development? They have quite a few long-term goals...
-
Well jg18 has suffered an appalling health catastrophe and may never recover his sight, so...
-
Well jg18 has suffered an appalling health catastrophe and may never recover his sight, so...
Wut?
...
I just looked at his recent posts. That's terrible. :(
-
No it wasn't. You keep trying to make that point, but the Installer and wxLauncher have always been separate.
It absolutely was a goal for the Launcher.
http://www.hard-light.net/forums/index.php?topic=66064.0
http://www.hard-light.net/forums/index.php?topic=66190.0
Both of those 2009 threads include installation as a central point of the new launcher.