diff --git a/packaging/linux/OpenRA.Utility.sh b/packaging/linux/OpenRA.Utility.sh new file mode 100755 index 0000000000..5ae67c660c --- /dev/null +++ b/packaging/linux/OpenRA.Utility.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# OpenRA utility wrapper for linux systems + +authenticate () { + if command -v gksudo > /dev/null; then + gksudo --description "OpenRA Installer" -- mono OpenRA.Utility.exe $@ || echo "Error: Permission denied." + elif command -v kdesu > /dev/null; then + kdesudo -d -- mono OpenRA.Utility.exe $@ || echo "Error: Permission denied." + else + # Try running without escalating + mono OpenRA.Utility.exe $@ + fi +} + +if [[ "$1" == "--display-filepicker" ]]; then + if command -v zenity > /dev/null ; then + zenity --file-selection --title $2 + else + mono OpenRA.Utility.exe $@ + fi +else + # Everything else requires root running an -inner variant + authenticate "$1-inner" ${@:2} +fi \ No newline at end of file diff --git a/packaging/linux/buildpackage.sh b/packaging/linux/buildpackage.sh index 6b2cc99978..a46475245d 100644 --- a/packaging/linux/buildpackage.sh +++ b/packaging/linux/buildpackage.sh @@ -18,9 +18,9 @@ rm -rf $ROOTDIR # Game files mkdir -p $ROOTDIR/usr/bin/ cp -T openra-bin root/usr/bin/openra - mkdir -p $ROOTDIR/usr/share/openra/ cp -R $BUILTDIR/* "$ROOTDIR/usr/share/openra/" || exit 3 +cp -T OpenRA.Utility.sh $ROOTDIR/usr/share/openra/ # Desktop Icons mkdir -p $ROOTDIR/usr/share/applications/ diff --git a/packaging/linux/openra-bin b/packaging/linux/openra-bin index a37ce0fe81..70525d1ae5 100755 --- a/packaging/linux/openra-bin +++ b/packaging/linux/openra-bin @@ -1,3 +1,3 @@ #!/bin/sh cd /usr/share/openra -mono /usr/share/openra/OpenRA.Game.exe SupportDir=~/.openra "$@" +mono OpenRA.Game.exe SupportDir=~/.openra UtilityPath=OpenRA.Utility.sh "$@"