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.