Created
February 13, 2018 20:15
-
-
Save ukos-git/24458e795b0383748327b73ba24089f1 to your computer and use it in GitHub Desktop.
workaround for vmware-patches from arch git repository to work with debian.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# workaround for vmware-patches from arch git repository to work with debian. | |
# fixes by ukos-git | |
# License GPL | |
# | |
# arch git source (License GPL) | |
# https://aur.archlinux.org/packages/vmware-patch/ | |
# https://wiki.archlinux.org/index.php/Vmware | |
# | |
# debian compatibility script for arch vmware patches | |
sourcedir=$(mktemp -d) | |
#sourcedir="/home/matthias/virtual-guests/install/git-vmware-patches" | |
if [ ! -e "$sourcedir" ]; then | |
echo "directory not found. please edit script" | |
exit 1 | |
fi | |
if [ "$EUID" -ne 0 ] | |
then echo "Please install as root" | |
exit 1 | |
fi | |
install_dependencies() { | |
apt-get -y install git | |
cat > /usr/local/bin/vercmp <<'EOF' | |
#/bin/bash | |
# | |
# quick substitute for arch's vercmp | |
# https://git.archlinux.org/pacman.git/tree/src/util/vercmp.c | |
# "Usage: vercmp <ver1> <ver2>\n\n" | |
# "Output values:\n" | |
# " < 0 : if ver1 < ver2\n" | |
# " 0 : if ver1 == ver2\n" | |
# " > 0 : if ver1 > ver2\n"); | |
if dpkg --compare-versions $1 eq $2; then | |
echo 0 | |
exit 0 | |
fi | |
if dpkg --compare-versions $1 gt $2 ; then | |
echo 1 | |
exit 0 | |
fi | |
if dpkg --compare-versions $1 le $2 ; then | |
echo -1 | |
exit 0 | |
fi | |
exit 1 | |
EOF | |
clone_gitrepo | |
} | |
clone_gitrepo() { | |
if [ ! -e "$sourcedir" ]; then | |
git clone https://aur.archlinux.org/vmware-patch.git "$sourcedir" | |
fi | |
} | |
install_vmwarepatch() { | |
# Patch scripts | |
sed \ | |
-e 's/cat\ \/usr\/lib\/modules\/extramodules-\*\/version/uname\ -r/g'\ | |
-e 's/\/usr\/lib\/modules/\/lib\/modules/g' \ | |
"$sourcedir/vmware-patch.sh" | tee /usr/bin/vmware-patch > /dev/null | |
sed -e 's/\/usr\/lib\/modules/\/lib\/modules/g' "$sourcedir/vmware-unpatch.sh" | tee /usr/bin/vmware-unpatch > /dev/null | |
chmod a+x /usr/bin/vmware-patch /usr/bin/vmware-unpatch | |
# Common functions | |
mkdir -p /usr/share/vmware-patch | |
sed -e 's/\/usr\/lib\/modules/\/lib\/modules/g' "$sourcedir/common-functions.sh" | tee /usr/share/vmware-patch/common-functions.sh > /dev/null | |
# Patches | |
mkdir -p /usr/lib/vmware/modules/patches/ | |
for patch in "$sourcedir/*.patch"; do | |
cp -f $patch /usr/lib/vmware/modules/patches/ | |
done | |
} | |
install_dependencies | |
install_vmwarepatch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment