summaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-12-17 00:41:50 +0100
committerPetr Mrázek <peterix@gmail.com>2013-12-17 00:41:50 +0100
commitfab8d6ae0b96ed04c339653cebc3f10c1edc5ea0 (patch)
tree2cca98a43b2aa0a9445da58f4eba9c097b810b64 /package
parent911dfa853089a8ab4d5619dbd1f053ac90edff0d (diff)
parente8dff0b99e4469fbf1216b968733a8267fd22da6 (diff)
downloadMultiMC-fab8d6ae0b96ed04c339653cebc3f10c1edc5ea0.tar
MultiMC-fab8d6ae0b96ed04c339653cebc3f10c1edc5ea0.tar.gz
MultiMC-fab8d6ae0b96ed04c339653cebc3f10c1edc5ea0.tar.lz
MultiMC-fab8d6ae0b96ed04c339653cebc3f10c1edc5ea0.tar.xz
MultiMC-fab8d6ae0b96ed04c339653cebc3f10c1edc5ea0.zip
Merge branch 'feature_runner' of https://github.com/02JanDal/MultiMC5 into develop
Diffstat (limited to 'package')
-rwxr-xr-xpackage/linux/MultiMC47
1 files changed, 42 insertions, 5 deletions
diff --git a/package/linux/MultiMC b/package/linux/MultiMC
index 8229b24f..8095413d 100755
--- a/package/linux/MultiMC
+++ b/package/linux/MultiMC
@@ -12,7 +12,7 @@ export QT_FONTPATH="${MMC_DIR}/fonts"
# Detect missing dependencies...
DEPS_LIST=`ldd "${MMC_DIR}"/plugins/*/*.so | grep "not found" | awk -vORS=", " '{ print $1 }'`
-if [ -z $DEPS_LIST ]; then
+if [ "x$DEPS_LIST" = "x" ]; then
# We have all our dependencies. Run MultiMC.
echo "No missing dependencies found."
@@ -25,9 +25,46 @@ if [ -z $DEPS_LIST ]; then
# Exit with MultiMC's exit code.
exit $?
else
- echo "Error: MultiMC is missing the following libraries that it needs to work correctly:"
- echo "\t${DEPS_LIST}"
- echo "Please install them from your distribution's package manager."
+ # apt
+ if which apt-file >/dev/null; then
+ LIBRARIES=`echo "$DEPS_LIST" | grep -oP "[^, ]*"`
+ COMMAND_LIBS=`for LIBRARY in $LIBRARIES; do apt-file -l search $LIBRARY; done`
+ COMMAND_LIBS=`echo "$COMMAND_LIBS" | awk -vORS=" " '{ print $1 }'`
+ INSTALL_CMD="sudo apt-get install $COMMAND_LIBS"
+ # pacman
+ elif which pkgfile >/dev/null; then
+ LIBRARIES=`echo "$DEPS_LIST" | grep -oP "[^, ]*"`
+ COMMAND_LIBS=`for LIBRARY in $LIBRARIES; do pkgfile $LIBRARY; done`
+ COMMAND_LIBS=`echo "$COMMAND_LIBS" | awk -vORS=" " '{ print $1 }'`
+ INSTALL_CMD="sudo pacman -S $COMMAND_LIBS"
+ # yum
+ elif which yum >/dev/null; then
+ LIBRARIES=`echo "$DEPS_LIST" | grep -oP "[^, ]*"`
+ COMMAND_LIBS=`for LIBRARY in $LIBRARIES; do yum whatprovides $LIBRARY; done`
+ COMMAND_LIBS=`echo "$COMMAND_LIBS" | awk -vORS=" " '{ print $1 }'`
+ INSTALL_CMD="sudo yum install $COMMAND_LIBS"
+ # zypper
+ elif which zypper >/dev/null; then
+ LIBRARIES=`echo "$DEPS_LIST" | grep -oP "[^, ]*"`
+ COMMAND_LIBS=`for LIBRARY in $LIBRARIES; do zypper wp $LIBRARY; done`
+ COMMAND_LIBS=`echo "$COMMAND_LIBS" | awk -vORS=" " '{ print $1 }'`
+ INSTALL_CMD="sudo zypper install $COMMAND_LIBS"
+ # emerge
+ elif which pfl >/dev/null; then
+ LIBRARIES=`echo "$DEPS_LIST" | grep -oP "[^, ]*"`
+ COMMAND_LIBS=`for LIBRARY in $LIBRARIES; do pfl $LIBRARY; done`
+ COMMAND_LIBS=`echo "$COMMAND_LIBS" | awk -vORS=" " '{ print $1 }'`
+ INSTALL_CMD="sudo emerge $COMMAND_LIBS"
+ fi
+
+ MESSAGE="Error: MultiMC is missing the following libraries that it needs to work correctly:\n\t${DEPS_LIST}\nPlease install them from your distribution's package manager."
+ MESSAGE="$MESSAGE\n\nHint: $INSTALL_CMD"
+
+ echo $MESSAGE
+
+ if which zenity >/dev/null; then zenity --error --text="$MESSAGE";
+ elif which kdialog >/dev/null; then kdialog --error "$MESSAGE";
+ fi
+
exit 1
fi
-