Minor fixes

This commit is contained in:
zawz 2020-06-02 15:53:13 +02:00
parent 139c2a2282
commit a0efa3a073
3 changed files with 29 additions and 37 deletions

View file

@ -9,11 +9,11 @@ To run the clicker, you need to start the daemon and then run the commands
[Daemon Options] [Daemon Options]
-d Run daemon -d Run daemon
-b <ms> Time per block of operation in ms. Default 100" -b <ms> Time per block of operation in ms. Default 100
[Client options] [Client options]
-h Display this help -h Display this help
-i <ms> Interval between clicks in ms, 0 for no clicking. Default 20 -i <ms> Interval between clicks in ms, 0 for no clicking. Default 20
-t Toggle clicking. Sets interval to 0 if current value was != 0 -t Toggle clicking. Sets interval to 0 if current value was != 0"
} }
error () { error () {

View file

@ -32,7 +32,7 @@ shift $((OPTIND-1))
targets="." targets="."
[ $# -gt 0 ] && targets="$*" [ $# -gt 0 ] && targets="$*"
ret=$(find $targets -type f -printf '%T@\n' | sort | tail -n1 | cut -d'.' -f1) ret=$(find $targets -printf '%T@\n' | sort | tail -n1 | cut -d'.' -f1)
if [ -z "$_opt_s" ] if [ -z "$_opt_s" ]
then then

View file

@ -22,12 +22,12 @@ _done () {
printf "\033[1;32mDone\033[0m\n\n" printf "\033[1;32mDone\033[0m\n\n"
} }
warning () { warning () {
printf "\033[0;33m%s\033[0m\n" "$1" > /dev/stderr printf "\033[0;33m%s\033[0m\n" "$1" >&2
} }
abort() abort()
{ {
echo_red "ERROR: ABORTING" > /dev/stderr echo_red "ERROR: ABORTING" >&2
exit "$1" exit "$1"
} }
@ -36,13 +36,13 @@ DNF_PACKAGES="gcc gcc-c++ jansson-devel openssl-devel SDL2-devel libicu-devel sp
PACMAN_PACKAGES="gcc gcc-libs git cmake sdl2 fontconfig libzip libpng curl jansson speexdsp openssl icu duktape" PACMAN_PACKAGES="gcc gcc-libs git cmake sdl2 fontconfig libzip libpng curl jansson speexdsp openssl icu duktape"
echo_white "Installing packages" echo_white "Installing packages"
if [ -n "$(command -v apt)" ] if which apt >/dev/null
then then
sudo apt install --no-install-recommends -y $APT_PACKAGES || abort $? sudo apt install --no-install-recommends -y $APT_PACKAGES || abort $?
elif [ -n "$(command -v dnf)" ] elif which dnf >/dev/null
then then
sudo dnf install $DNF_PACKAGES || abort $? sudo dnf install $DNF_PACKAGES || abort $?
elif [ -n "$(command -v pacman)" ] elif which pacman >/dev/null
then then
sudo pacman -S --needed $PACMAN_PACKAGES || abort $? sudo pacman -S --needed $PACMAN_PACKAGES || abort $?
else else
@ -50,26 +50,22 @@ else
fi fi
_done _done
if [ "$DESTDIR" = "" ] ; then [ -z "$DESTDIR" ] && DESTDIR='OpenRCT2'
DESTDIR='OpenRCT2' [ -z "$SRCDIR" ] && SRCDIR='openrct2-src'
fi
if [ "$SRCDIR" = "" ] ; then
SRCDIR='openrct2-src'
fi
mkdir -p "$SRCDIR" mkdir -p "$SRCDIR"
cd "$SRCDIR" || abort $? cd "$SRCDIR" || abort $?
## PULLING SOURCE ## ./$SRCDIR ## PULLING SOURCE ## .
echo_white "Getting source code" echo_white "Getting source code"
if [ -d "OpenRCT2" ] if [ -d "$SRCDIR" ]
then then
echo_blue "Source code already present" echo_blue "Source code already present"
cd OpenRCT2 || abort $? cd "$SRCDIR" || abort $?
git pull || abort $? git pull || abort $?
else else
git clone https://github.com/OpenRCT2/OpenRCT2.git --depth=1 || abort $? git clone https://github.com/OpenRCT2/OpenRCT2.git --depth=1 "$SRCDIR" || abort $?
cd OpenRCT2 || abort $? cd "$SRCDIR" || abort $?
fi fi
_done _done
@ -111,7 +107,7 @@ remove_discord_rpc()
fi fi
} }
## DISCORD-RPC ## ./$SCRDIR/OpenRCT2 ## DISCORD-RPC ## ./$SCRDIR
if [ -n "$DISCORD_RPC" ] if [ -n "$DISCORD_RPC" ]
then then
if [ "$DISCORD_RPC" = "true" ] if [ "$DISCORD_RPC" = "true" ]
@ -133,7 +129,7 @@ else
esac esac
fi fi
## CMAKE ## ./$SCRDIR/OpenRCT2 ## CMAKE ## ./$SCRDIR
echo_white "Preparing build files" echo_white "Preparing build files"
if [ -d "build" ] if [ -d "build" ]
then then
@ -145,40 +141,36 @@ cd build || abort $?
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo .. || abort $? cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo .. || abort $?
_done _done
## BUILD ## ./$SCRDIR/OpenRCT2/build ## BUILD ## ./$SCRDIR/build
echo_white "Building binary" echo_white "Building binary"
if ! make -j "$(nproc --all)" if ! make -j "$(nproc --all)"
then then
if [ -n "$DISCORDRPC" ] [ -n "$DISCORDRPC" ] && echo_red "Compliation with discord-rpc failed. Retry without." >&2
then abort 1
echo_red "Compliation with discord-rpc failed. Retry without." >/dev/stderr
abort 1
else
abort 1
fi
fi fi
_done _done
echo_white "Building g2.dat" echo_white "Building g2.dat"
make g2 -j "$(nproc --all)" || abort $? make g2 -j "$(nproc --all)" || abort $?
_done _done
## DOWNLOAD DATA ## ./$SCRDIR/OpenRCT2/build ## DOWNLOAD DATA ## ./$SCRDIR/build
echo_white "Downloading game data" echo_white "Downloading game data"
mkdir -p temp_install || abort $? mkdir -p temp_install || abort $?
DESTDIR=./temp_install make install || abort $? DESTDIR=./temp_install make install || abort $?
_done _done
## MAKE FOLDERS ## ./$SCRDIR/OpenRCT2/build ## MAKE FOLDERS ## ./$SCRDIR/build
echo_white "Making game folders" echo_white "Making game folders"
mkdir -p "../../../$DESTDIR" || abort $? mkdir -p "../../$DESTDIR" || abort $?
mkdir -p "../../../$DESTDIR/data" || abort $? mkdir -p "../../$DESTDIR/data" || abort $?
cp -r temp_install/usr/local/share/openrct2/* "../../../$DESTDIR/data" || abort $? cp -r temp_install/usr/local/share/openrct2/* "../../$DESTDIR/data" || abort $?
cp "temp_install/usr/local/share/icons/hicolor/256x256/apps/openrct2.png" "../../../$DESTDIR/icon.png" || abort $? cp "temp_install/usr/local/share/icons/hicolor/256x256/apps/openrct2.png" "../../$DESTDIR/icon.png" || abort $?
cp openrct2 openrct2-cli "../../../$DESTDIR" || abort $? mv openrct2 openrct2-cli "../../$DESTDIR" || abort $?
rm -rf temp_install || abort $?
_done _done
cd "../../.." || abort $? cd "../.." || abort $?
cd "$DESTDIR" || abort $? cd "$DESTDIR" || abort $?
add_desktop_entry() add_desktop_entry()