Created
November 28, 2011 08:46
-
-
Save fleger/1399662 to your computer and use it in GitHub Desktop.
Patch for bumblebee AUR package that improves how the configuration is backed up
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
diff -Naur a/bumblebee/bumblebee.install b/bumblebee/bumblebee.install | |
--- a/bumblebee/bumblebee.install 2011-10-05 18:30:14.000000000 +0200 | |
+++ b/bumblebee/bumblebee.install 2011-11-28 09:43:33.079042852 +0100 | |
@@ -28,7 +28,23 @@ | |
_backup() { | |
cp "$1" "$1.pacsave" | |
- echo "File $1 backed up as $1.pacsave" | |
+ #echo "File $1 backed up as $1.pacsave" | |
+} | |
+ | |
+_restore() { | |
+ local sumSave | |
+ local sumNew | |
+ if [ -f "$1.pacsave" ]; then | |
+ sumNew=$(openssl dgst -md5 "$1") | |
+ sumSave=$(openssl dgst -md5 "$1.pacsave") | |
+ if [ "x${sumSave##* }" = "x${sumNew##* }" ]; then | |
+ rm "$1.pacsave" | |
+ else | |
+ mv "$1" "$1.pacnew" | |
+ mv "$1.pacsave" "$1" | |
+ echo "New $1 saved as $1.pacnew" | |
+ fi | |
+ fi | |
} | |
pre_upgrade() { | |
@@ -40,32 +56,37 @@ | |
if [ -f /etc/bumblebee/xorg.conf.nouveau ]; then | |
_backup /etc/bumblebee/xorg.conf.nouveau | |
fi | |
- if [ -f /etc/bumblebee/bumblebee.conf ]; then | |
- _backup /etc/bumblebee/bumblebee.conf | |
- fi | |
} | |
post_upgrade() { | |
if [ -f /etc/bumblebee/xorg.conf.nvidia ]; then | |
_replace_busid /etc/bumblebee/xorg.conf.nvidia | |
+ _restore /etc/bumblebee/xorg.conf.nvidia | |
fi | |
if [ -f /etc/bumblebee/xorg.conf.nouveau ]; then | |
_replace_busid /etc/bumblebee/xorg.conf.nouveau | |
+ _restore /etc/bumblebee/xorg.conf.nouveau | |
fi | |
groupadd bumblebee && echo "Bumblebee group created" | |
- echo "Update complete. The configuration files had been changed to their" | |
- echo "default settings. You may need to restore them manually" | |
+ echo "Update complete." | |
#rc.d start bumblebee | |
} | |
pre_remove() { | |
rc.d stop bumblebee | |
+ # Backup old config files if they exist | |
+ if [ -f /etc/bumblebee/xorg.conf.nvidia ]; then | |
+ _backup /etc/bumblebee/xorg.conf.nvidia | |
+ fi | |
+ if [ -f /etc/bumblebee/xorg.conf.nouveau ]; then | |
+ _backup /etc/bumblebee/xorg.conf.nouveau | |
+ fi | |
} | |
post_remove() { | |
#groupdel bumblebee && echo "Bumblebee group deleted" | |
- echo "Uninstallation complete" | |
- echo "You may delete the group 'bumblebee' now" | |
+ echo "Uninstallation complete." | |
+ echo "You may delete the group 'bumblebee' now." | |
} | |
post_install() { | |
diff -Naur a/bumblebee/PKGBUILD b/bumblebee/PKGBUILD | |
--- a/bumblebee/PKGBUILD 2011-11-23 15:34:16.000000000 +0100 | |
+++ b/bumblebee/PKGBUILD 2011-11-28 09:25:42.689074025 +0100 | |
@@ -6,16 +6,17 @@ | |
pkgdesc="Stable branch of Bumblebee. Optimus Support for Linux Through VirtualGL." | |
arch=('i686' 'x86_64') | |
depends=('xorg-utils' 'virtualgl' 'nvidia-utils-bumblebee') | |
+optdepends=('acpi_call: turn on/off discrete card (unstable)') | |
if [ "$CARCH" = "x86_64" ]; then | |
- optdepends=('lib32-virtualgl: run 32bit applications with optirun' | |
+ optdepends+=('lib32-virtualgl: run 32bit applications with optirun' | |
'lib32-nvidia-utils-bumblebee: run 32bit applications with optirun') | |
fi | |
-optdepends[${#optdepends[@]}]='acpi_call: turn on/off discrete card (unstable)' | |
url="https://github.com/Bumblebee-Project/Bumblebee" | |
license=("GPL3") | |
install='bumblebee.install' | |
conflicts=('bumblebee-nouveau') | |
provides=('bumblebee') | |
+backup=('etc/bumblebee/bumblebee.conf') | |
source=("https://github.com/downloads/Bumblebee-Project/Bumblebee/$pkgname-$pkgver.tar.gz" 'bumblebee.handler.archlinux') | |
md5sums=('cda3f529b07461cc5abcea58a50df5cc' | |
'1bce7fcc4027dfe94f2fda37e7a4bcc8') | |
@@ -24,11 +25,11 @@ | |
build() { | |
cd "$srcdir/$pkgname-$pkgver" | |
- mkdir -p $_temp_dir | |
- ./install --dest-dir=$_temp_dir \ | |
+ mkdir -p "$_temp_dir" | |
+ ./install --dest-dir="$_temp_dir" \ | |
--driver=nouveau,nvidia \ | |
--actions=build,install | |
- install -D -m755 $srcdir/bumblebee.handler.archlinux $_temp_dir/etc/rc.d/bumblebee | |
+ install -D -m755 "$srcdir/bumblebee.handler.archlinux" "$_temp_dir/etc/rc.d/bumblebee" | |
} | |
package() { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment