diff options
author | Petr Mrázek <peterix@gmail.com> | 2016-01-05 08:40:30 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2016-01-05 08:40:30 +0100 |
commit | b300c4956cd235495e3bf4e897018ebbec282f67 (patch) | |
tree | d22830809d06e01602b06672d3f312976a52374e /application | |
parent | 4d0caf6254fdb18f4626a3c7937e64422b40d40c (diff) | |
download | MultiMC-b300c4956cd235495e3bf4e897018ebbec282f67.tar MultiMC-b300c4956cd235495e3bf4e897018ebbec282f67.tar.gz MultiMC-b300c4956cd235495e3bf4e897018ebbec282f67.tar.lz MultiMC-b300c4956cd235495e3bf4e897018ebbec282f67.tar.xz MultiMC-b300c4956cd235495e3bf4e897018ebbec282f67.zip |
GH-1390 improve linux runner script
* include fedora dnf package manager
* output of the missing dependency lookup is now passed through `sort -u`
Diffstat (limited to 'application')
-rwxr-xr-x | application/package/linux/MultiMC | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/application/package/linux/MultiMC b/application/package/linux/MultiMC index 9e1d7720..16842e40 100755 --- a/application/package/linux/MultiMC +++ b/application/package/linux/MultiMC @@ -26,7 +26,7 @@ export QT_PLUGIN_PATH="${MMC_DIR}/plugins" export QT_FONTPATH="${MMC_DIR}/fonts" # Detect missing dependencies... -DEPS_LIST=`ldd "${MMC_DIR}"/plugins/*/*.so 2>/dev/null | grep "not found" | awk -vORS=", " '{ print $1 }'` +DEPS_LIST=`ldd "${MMC_DIR}"/plugins/*/*.so 2>/dev/null | grep "not found" | sort -u | awk -vORS=", " '{ print $1 }'` if [ "x$DEPS_LIST" = "x" ]; then # We have all our dependencies. Run MultiMC. echo "No missing dependencies found." @@ -49,38 +49,44 @@ if [ "x$DEPS_LIST" = "x" ]; then else # apt if which apt-file &>/dev/null; then - LIBRARIES=`echo "$DEPS_LIST" | grep -oP "[^, ]*"` + LIBRARIES=`echo "$DEPS_LIST" | grep -oP "[^, ]*" | sort -u` COMMAND_LIBS=`for LIBRARY in $LIBRARIES; do apt-file -l search $LIBRARY; done` - COMMAND_LIBS=`echo "$COMMAND_LIBS" | awk -vORS=" " '{ print $1 }'` + COMMAND_LIBS=`echo "$COMMAND_LIBS" | sort -u | 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 "[^, ]*"` + LIBRARIES=`echo "$DEPS_LIST" | grep -oP "[^, ]*" | sort -u` COMMAND_LIBS=`for LIBRARY in $LIBRARIES; do pkgfile $LIBRARY; done` - COMMAND_LIBS=`echo "$COMMAND_LIBS" | awk -vORS=" " '{ print $1 }'` + COMMAND_LIBS=`echo "$COMMAND_LIBS" | sort -u | awk -vORS=" " '{ print $1 }'` INSTALL_CMD="sudo pacman -S $COMMAND_LIBS" + # dnf + elif which dnf &>/dev/null; then + LIBRARIES=`echo "$DEPS_LIST" | grep -oP "[^, ]*" | sort -u` + COMMAND_LIBS=`for LIBRARY in $LIBRARIES; do dnf whatprovides $LIBRARY; done` + COMMAND_LIBS=`echo "$COMMAND_LIBS" | grep -v 'Repo' | sort -u | awk -vORS=" " '{ print $1 }'` + INSTALL_CMD="sudo dnf install $COMMAND_LIBS" # yum elif which yum &>/dev/null; then - LIBRARIES=`echo "$DEPS_LIST" | grep -oP "[^, ]*"` + LIBRARIES=`echo "$DEPS_LIST" | grep -oP "[^, ]*" | sort -u` COMMAND_LIBS=`for LIBRARY in $LIBRARIES; do yum whatprovides $LIBRARY; done` - COMMAND_LIBS=`echo "$COMMAND_LIBS" | awk -vORS=" " '{ print $1 }'` + COMMAND_LIBS=`echo "$COMMAND_LIBS" | sort -u | awk -vORS=" " '{ print $1 }'` INSTALL_CMD="sudo yum install $COMMAND_LIBS" # zypper elif which zypper &>/dev/null; then - LIBRARIES=`echo "$DEPS_LIST" | grep -oP "[^, ]*"` + LIBRARIES=`echo "$DEPS_LIST" | grep -oP "[^, ]*" | sort -u` COMMAND_LIBS=`for LIBRARY in $LIBRARIES; do zypper wp $LIBRARY; done` - COMMAND_LIBS=`echo "$COMMAND_LIBS" | awk -vORS=" " '{ print $1 }'` + COMMAND_LIBS=`echo "$COMMAND_LIBS" | sort -u | awk -vORS=" " '{ print $1 }'` INSTALL_CMD="sudo zypper install $COMMAND_LIBS" # emerge elif which pfl &>/dev/null; then - LIBRARIES=`echo "$DEPS_LIST" | grep -oP "[^, ]*"` + LIBRARIES=`echo "$DEPS_LIST" | grep -oP "[^, ]*" | sort -u` COMMAND_LIBS=`for LIBRARY in $LIBRARIES; do pfl $LIBRARY; done` - COMMAND_LIBS=`echo "$COMMAND_LIBS" | awk -vORS=" " '{ print $1 }'` + COMMAND_LIBS=`echo "$COMMAND_LIBS" | sort -u | 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\n" + MESSAGE="$MESSAGE\n\nHint (please apply common sense): $INSTALL_CMD\n" printerror "$MESSAGE" exit 1 |