#!/bin/bash
[ -z
"$PLAYONLINUX"
] &&
exit
0
source
"$PLAYONLINUX/lib/sources"
abort () {
POL_SetupWindow_message_image
"$LNG_ABORTED"
"$TITLE"
"$PLAYONLINUX/themes/tango/warning.png"
POL_SetupWindow_Close
exit
1
}
check_install_archive () {
POL_SetupWindow_wait_next_signal
"$LNG_CHECK_ARCHIVE"
"$TITLE"
EXPECTED_NAME=
'setup_starflight_1_2.exe'
EXPECTED_SIZE=44526203
EXPECTED_MD5=
"4b3e884d1bbe066470338456991dc73e"
OLDIFS=
"$IFS"
IFS=
''
NAME=
"$(basename $ARCHIVE)"
SIZE=
"$(stat -c%s $ARCHIVE)"
MD5=
"$(POL_MD5_file $ARCHIVE)"
IFS=
"$OLDIFS"
POL_SetupWindow_detect_exit
if
[ $SIZE -
ne
$EXPECTED_SIZE -o
"$MD5"
!=
"$EXPECTED_MD5"
];
then
POL_SetupWindow_message_image
"$LNG_ARCHIVE_MISMATCH\\nName: $NAME (expected $EXPECTED_NAME)\\nSize: $SIZE (expected $EXPECTED_SIZE)\\nMD5: $MD5\\n (expected $EXPECTED_MD5)"
"$TITLE"
"$PLAYONLINUX/themes/tango/warning.png"
POL_SetupWindow_question
"$LNG_CONTINUE"
"$TITLE"
[
"$APP_ANSWER"
!=
"TRUE"
] && abort
fi
}
PREFIX=
"Starflight_1_2_gog"
WORKING_WINE_VERSION=
"1.3.23"
case
"$POL_LANG"
in
fr)
TITLE=
"Starflight 1 et 2 (version GoG)"
SHORTCUT1_NAME=
"Starflight 1"
SHORTCUT1_CODEWHEEL=
"Starflight 1 - Roue de codes"
SHORTCUT1_DOC=
"Starflight 1 - Manuel d'utilisation"
SHORTCUT1_MAP=
"Starflight 1 - Carte stellaire"
SHORTCUT2_NAME=
"Starflight 2"
SHORTCUT2_DOC=
"Starflight 2 - Manuel d'utilisation"
SHORTCUT2_MAP=
"Starflight 2 - Carte stellaire"
LNG_ABORTED=
"Une erreur est survenue, l'installation est interrompue."
LNG_CHECK_ARCHIVE=
"Test de l'archive d'installation..."
LNG_ARCHIVE_MISMATCH=
"L'archive ne correspond pas.\\nOu bien elle est corrompue, ou ce n'est pas la version attendue.\\nCe script ne peut pas garantir que l'installation se passera bien, pensez à communiquer le résultat de l'installation sur le forum de PlayOnLinux."
LNG_CONTINUE=
"Continuer ?"
LNG_ARCHIVE_LOCATION=
"Indiquez l'emplacement de l'archive d'installation"
LNG_SELECT_FILE=
"Sélectionnez le fichier"
LNG_INSTALLING=
"Installation de $TITLE..."
;;
*)
TITLE=
"Starflight 1 and 2 (GoG release)"
SHORTCUT1_NAME=
"Starflight 1"
SHORTCUT1_CODEWHEEL=
"Starflight 1 - Code wheel"
SHORTCUT1_DOC=
"Starflight 1 - User manual"
SHORTCUT1_MAP=
"Starflight 1 - Stellar map"
SHORTCUT2_NAME=
"Starflight 2"
SHORTCUT2_DOC=
"Starflight 2 - User manual"
SHORTCUT2_MAP=
"Starflight 2 - Stellar map"
LNG_ABORTED=
"An error occurred, the installation is aborted."
LNG_CHECK_ARCHIVE=
"Checking install archive..."
LNG_ARCHIVE_MISMATCH=
"Install archive mismatch.\\nEither your install archive is corrupted, or is not the expected version.\\nThis script cannot guarantee that installation will work correctly. Please report success or failure to PlayOnLinux forums."
LNG_CONTINUE=
"Continue?"
LNG_ARCHIVE_LOCATION=
"Please select the location of the install file"
LNG_SELECT_FILE=
"Select file"
LNG_INSTALLING=
"Installing $TITLE..."
;;
esac
POL_SetupWindow_Init
check_one
"dosbox"
"dosbox"
POL_SetupWindow_missing
POL_Wine_SelectPrefix
"$PREFIX"
POL_Wine_PrefixCreate
cd
$HOME
POL_SetupWindow_browse
"$LNG_ARCHIVE_LOCATION"
"$LNG_SELECT_FILE"
ARCHIVE=
"$APP_ANSWER"
check_install_archive
if
[ -n
"$WORKING_WINE_VERSION"
];
then
POL_Wine_InstallVersion
"$WORKING_WINE_VERSION"
export
WINEVERSION=
"$WORKING_WINE_VERSION"
fi
POL_SetupWindow_wait_next_signal
"$LNG_INSTALLING"
"$TITLE"
cat
<<
'EOF'
> $REPERTOIRE
/tmp/pdfnativereader
.reg
[HKEY_CLASSES_ROOT\\.pdf]
@=
"PDFfile"
"Content Type"
=
"application/pdf"
[HKEY_CLASSES_ROOT\\PDFfile\\Shell\\Open\\
command
]
@=
"winebrowser \\"
%1\\
""
EOF
POL_Wine
regedit $REPERTOIRE
/tmp/pdfnativereader
.reg
POL_Wine
"$ARCHIVE"
|| abort
Set_OS winxp
POL_SetupWindow_detect_exit
POL_Wine_reboot
if
[ -d
"$WINEPREFIX/drive_c/$PROGRAMFILES/GOG.com/Starflight 1 and 2/Starflight 1"
];
then
sed
-i.orig -e
's/^fullscreen=.*/fullscreen=false/; s/^scaler=.*/scaler=hq2x/'
"$WINEPREFIX/drive_c/$PROGRAMFILES/GOG.com/Starflight 1 and 2/Starflight 1/dosboxSF1.conf"
POL_SetupWindow_make_shortcut
"$PREFIX"
"$PROGRAMFILES/GOG.com/Starflight 1 and 2/Starflight 1/"
"C:/$PROGRAMFILES/GOG.com/Starflight 1 and 2/DOSBOX/DOSBox.exe"
"-conf dosboxSF1.conf -noconsole"
"$SHORTCUT1_NAME"
cp
-n
"$WINEPREFIX/drive_c/$PROGRAMFILES/GOG.com/Starflight 1 and 2/Starflight 1/gfw_high.ico"
"$REPERTOIRE/icones/32/$SHORTCUT1_NAME"
POL_Shortcut_InsertBeforeWine
"$SHORTCUT1_NAME"
"exec dosbox -conf dosboxSF1.conf"
if
[ -n
"$WORKING_WINE_VERSION"
];
then
Set_WineVersion_Assign
"$WORKING_WINE_VERSION"
"$SHORTCUT1_NAME"
fi
POL_Shortcut
"Starflight_codes_by_gog.exe"
"$SHORTCUT1_CODEWHEEL"
POL_SetupWindow_make_shortcut
"$PREFIX"
"/windows/command"
"start.exe"
""
"$SHORTCUT1_DOC"
""
"'C:/$PROGRAMFILES/GOG.com/Starflight 1 and 2/Starflight 1/manual.pdf'"
POL_SetupWindow_make_shortcut
"$PREFIX"
"/windows/command"
"start.exe"
""
"$SHORTCUT1_MAP"
""
"'C:/$PROGRAMFILES/GOG.com/Starflight 1 and 2/Starflight 1/map.pdf'"
fi
if
[ -d
"$WINEPREFIX/drive_c/$PROGRAMFILES/GOG.com/Starflight 1 and 2/Starflight 2"
];
then
sed
-i.orig -e
's/^fullscreen=.*/fullscreen=false/; s/^scaler=.*/scaler=hq2x/'
"$WINEPREFIX/drive_c/$PROGRAMFILES/GOG.com/Starflight 1 and 2/Starflight 2/dosboxSF2.conf"
POL_SetupWindow_make_shortcut
"$PREFIX"
"$PROGRAMFILES/GOG.com/Starflight 1 and 2/Starflight 2/"
"C:/$PROGRAMFILES/GOG.com/Starflight 1 and 2/DOSBOX/DOSBox.exe"
"-conf dosboxSF2.conf -noconsole"
"$SHORTCUT2_NAME"
cp
-n
"$WINEPREFIX/drive_c/$PROGRAMFILES/GOG.com/Starflight 1 and 2/Starflight 2/gfw_high.ico"
"$REPERTOIRE/icones/32/$SHORTCUT2_NAME"
POL_Shortcut_InsertBeforeWine
"$SHORTCUT2_NAME"
"exec dosbox -conf dosboxSF2.conf"
if
[ -n
"$WORKING_WINE_VERSION"
];
then
Set_WineVersion_Assign
"$WORKING_WINE_VERSION"
"$SHORTCUT2_NAME"
fi
POL_SetupWindow_make_shortcut
"$PREFIX"
"/windows/command"
"start.exe"
""
"$SHORTCUT2_DOC"
""
"'C:/$PROGRAMFILES/GOG.com/Starflight 1 and 2/Starflight 2/manual.pdf'"
POL_SetupWindow_make_shortcut
"$PREFIX"
"/windows/command"
"start.exe"
""
"$SHORTCUT2_MAP"
""
"'C:/$PROGRAMFILES/GOG.com/Starflight 1 and 2/Starflight 2/map.pdf'"
fi
POL_SetupWindow_Close
cat
<<EOF > $REPERTOIRE
/configurations/configurators/
"$SHORTCUT1_NAME"
#!/bin/bash
[ -z
"\\$PLAYONLINUX"
] &&
exit
0
source
"\\$PLAYONLINUX/lib/sources"
export
WINEPREFIX=
"$REPERTOIRE/wineprefix/$PREFIX"
export
WINEDEBUG=
""
POL_LoadVar_PROGRAMFILES
cd
"$WINEPREFIX/drive_c/$PROGRAMFILES/GOG.com/Starflight 1 and 2/"
||
exit
DOSBOX=
"`which dosbox`"
if
[ -n
"\\$DOSBOX"
];
then
cat
<<-EOFINI > $REPERTOIRE
/tmp/sf1nativedosbox
.reg
REGEDIT4
[HKEY_LOCAL_MACHINE\\Software\\GOG.com\\GOGSTARFLIGHT1]
"LAUNCHCOMMAND"
=
"\\$DOSBOX -conf dosboxSF1.conf"
EOFINI
POL_Wine
regedit $REPERTOIRE
/tmp/sf1nativedosbox
.reg
fi
POL_Wine
"Graphic mode setup.exe"
"GOGSTARFLIGHT1"
exit
EOF
cat
<<EOF > $REPERTOIRE
/configurations/configurators/
"$SHORTCUT2_NAME"
#!/bin/bash
[ -z
"\\$PLAYONLINUX"
] &&
exit
0
source
"\\$PLAYONLINUX/lib/sources"
export
WINEPREFIX=
"$REPERTOIRE/wineprefix/$PREFIX"
export
WINEDEBUG=
""
POL_LoadVar_PROGRAMFILES
cd
"$WINEPREFIX/drive_c/$PROGRAMFILES/GOG.com/Starflight 1 and 2/"
||
exit
DOSBOX=
"`which dosbox`"
if
[ -n
"\\$DOSBOX"
];
then
cat
<<-EOFINI > $REPERTOIRE
/tmp/sf2nativedosbox
.reg
REGEDIT4
[HKEY_LOCAL_MACHINE\\Software\\GOG.com\\GOGSTARFLIGHT2]
"LAUNCHCOMMAND"
=
"\\$DOSBOX -conf dosboxSF2.conf"
EOFINI
POL_Wine
regedit $REPERTOIRE
/tmp/sf2nativedosbox
.reg
fi
POL_Wine
"Graphic mode setup.exe"
"GOGSTARFLIGHT2"
exit
EOF
exit