Patch for bumblebee AUR package that improves how the configuration is backed up

  • Download Gist
bumblebee-2.4.1-6_improved_configuration_backup.patch
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
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() {

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.