#!/bin/bash #--------------------------------------------------------------------- # File information. # File: smc.wrapper.in # Purpose: Single-instance wrapper (Laclin-specific) # License: BSD-style (for this file only) # Revision: 241128 #--------------------------------------------------------------------- # Wrapper parameters. BASEDIR=$PRODTREE/smc BINDIR=$BASEDIR/bin LIBDIR=$BASEDIR/lib SNDFLAG=true TARGET=$BINDIR/smc.bin PROGNAME="Secret Maryo" #--------------------------------------------------------------------- # Run the target if it's available. if [ -f $TARGET ]; then # Run the target cd # Go to user's home directory if [ \! -d .smc ]; then # If ".smc" directory is missing rm -fr .smc dotsmc # Safety measure # Populate ".smc" directory unzip -qo $BASEDIR/data/dotsmc.zip || exit 1 mv dotsmc .smc fi cd .smc if [ \! -f config.xml ]; then rm -fr config.xml unzip -qo $BASEDIR/data/dotsmc.zip dotsmc/config.xml mv dotsmc/config.xml . rm -fr dotsmc fi if [ \! -d cache ]; then rm -fr cache unzip -qo $BASEDIR/data/dotsmc.zip dotsmc/cache/\* mv dotsmc/cache . rm -fr dotsmc fi dim=`getx11dim` xs=`echo $dim | sed -e 's/x.*//'` zs=`echo $dim | sed -e 's/.*x//'` sed \ -e 's@"video_fullscreen" value="0"@"video_fullscreen" value="1"@' \ -e 's@"video_screen_w".*@"video_screen_w" value="'$xs'"/>@' \ -e 's@"video_screen_h".*@"video_screen_h" value="'$zs'"/>@' \ -i config.xml #--------------------------------------------------------------------- cd # Go to user's home directory if [ "@$SNDFLAG" == "@true" ]; then resetpcmvol # Adjust volume fi if [ -d $LIBDIR ]; then # Adjust LD_LIBRARY_PATH LD_LIBRARY_PATH=$LIBDIR:$LD_LIBRARY_PATH export LD_LIBRARY_PATH fi PATH=$BINDIR:$PATH # Adjust PATH /laclin/lacutil/single-instance --wait --usewin \ "^Secret Maryo Chronicles\b" \ $TARGET $* & exit fi #--------------------------------------------------------------------- # Display a missing-program dialog. TITLE="$PROGNAME isn't installed" /laclin/lacutil/single-instance \ --wait --usewin "^$TITLE" \ zenity --error --no-wrap --title="$TITLE" --text="$TITLE"