Date: Sunday, November 11, 2018 @ 10:56:20
Author: arojas
Revision: 406346
Remove bashisms from launcher script (FS#60745)
Modified:
mame/trunk/PKGBUILD
mame/trunk/mame.sh
--+
PKGBUILD |4 +-
mame.sh | 85 -
2 files changed, 42 insertions(+), 47 deletions(-)
Modified: PKGBUILD
===
--- PKGBUILD2018-11-11 09:54:29 UTC (rev 406345)
+++ PKGBUILD2018-11-11 10:56:20 UTC (rev 406346)
@@ -5,7 +5,7 @@
pkgname=mame
pkgver=0.203
-pkgrel=1
+pkgrel=2
pkgdesc="A port of the popular Multiple Arcade Machine Emulator using SDL with
OpenGL support."
url="http://mamedev.org/;
license=(GPL2)
@@ -16,7 +16,7 @@
replaces=(sdlmame)
source=("https://github.com/mamedev/mame/archive/mame${pkgver/./}.tar.gz;
mame.sh)
sha256sums=('e17aa95f8897217d433e44e2f4b75ac7b5e13184549b7d14098d52652b7eb49a'
-'d089e182d3aadf3b9efb7948329923e24feedd64d107f9582f2550c2e3bb6d1d')
+'e97fc02ce0ea615a3a5017b2df7f6041365779319da8beab23d74e4067ce4fe6')
prepare() {
Modified: mame.sh
===
--- mame.sh 2018-11-11 09:54:29 UTC (rev 406345)
+++ mame.sh 2018-11-11 10:56:20 UTC (rev 406346)
@@ -1,56 +1,51 @@
#!/bin/sh
+mame=/usr/lib/mame/mame
-# Create a variable equal to $HOME that will be used later in the ini creation
-home=('$HOME')
-
-if [ "$1" != "" ] && [ "$1" = "--newini" ]; then
- echo "Rebuilding the ini file at $HOME/.mame/mame.ini"
+mame_first_run() {
+ echo "Creating an ini file for MAME at $HOME/.mame/mame.ini"
echo "Modify this file for permanent changes to your MAME"
echo "options and paths before running MAME again."
- cd $HOME/.mame
+
+ cd -- ~/.mame || exit
+
if [ -e mame.ini ]; then
+mv mame.ini mameini.bak || exit
echo "Your old ini file has been renamed to mameini.bak"
-mv mame.ini mameini.bak
fi
- /usr/lib/mame/mame \
--artpath "$home/.mame/artwork;artwork" \
--ctrlrpath "$home/.mame/ctrlr;ctrlr" \
--inipath $home/.mame/ini \
--rompath $home/.mame/roms \
--samplepath $home/.mame/samples \
--cfg_directory $home/.mame/cfg \
--comment_directory $home/.mame/comments \
--diff_directory $home/.mame/diff \
--input_directory $home/.mame/inp \
--nvram_directory $home/.mame/nvram \
--snapshot_directory $home/.mame/snap \
--state_directory $home/.mame/sta \
+
+ # Note: the single quotes here are not a mistake; MAME will save these
+ # strings verbatim into its configuration file, and expand the variables when
+ # it is run in future.
+ "$mame" \
+-artpath '$HOME/.mame/artwork;artwork' \
+-ctrlrpath '$HOME/.mame/ctrlr;ctrlr' \
+-inipath '$HOME/.mame/ini' \
+-rompath '$HOME/.mame/roms' \
+-samplepath '$HOME/.mame/samples' \
+-cfg_directory '$HOME/.mame/cfg' \
+-comment_directory '$HOME/.mame/comments' \
+-diff_directory '$HOME/.mame/diff' \
+-input_directory '$HOME/.mame/inp' \
+-nvram_directory '$HOME/.mame/nvram' \
+-snapshot_directory '$HOME/.mame/snap' \
+-state_directory '$HOME/.mame/sta' \
-video opengl \
-createconfig
-elif [ ! -e $HOME/.mame ]; then
+}
+
+if [ "$1" = "--newini" ]; then
+ mame_first_run
+ exit
+elif ! [ -e ~/.mame ]; then
echo "Running MAME for the first time..."
- echo "Creating an ini file for MAME at $HOME/.mame/mame.ini"
- echo "Modify this file for permanent changes to your MAME"
- echo "options and paths before running MAME again."
- mkdir $HOME/.mame
- mkdir
$HOME/.mame/{artwork,cfg,comments,ctrlr,diff,ini,inp,nvram,samples,snap,sta,roms}
- cd $HOME/.mame
- /usr/lib/mame/mame \
--artpath "$home/.mame/artwork;artwork" \
--ctrlrpath "$home/.mame/ctrlr;ctrlr" \
--inipath $home/.mame/ini \
--rompath $home/.mame/roms \
--samplepath $home/.mame/samples \
--cfg_directory $home/.mame/cfg \
--comment_directory $home/.mame/comments \
--diff_directory $home/.mame/diff \
--input_directory $home/.mame/inp \
--nvram_directory $home/.mame/nvram \
--snapshot_directory $home/.mame/snap \
--state_directory $home/.mame/sta \
--video opengl \
--createconfig
-else
- cd /usr/lib/mame
- ./mame "$@"
+
+ mkdir -- ~/.mame
+ (
+cd -- ~/.mame || exit
+mkdir artwork cfg comments ctrlr diff ini inp nvram samples snap sta roms
+
+mame_first_run
+ ) || exit
fi
+
+exec "$mame" "$@"