Commit f1a1e29c authored by Helmut Stult's avatar Helmut Stult

[pkg-upd] 1.0-2

parent 3d61e584
# Maintainer: Robin Lange <robin dot langenc at gmail dot com>
# Contributor: Robin Lange <robin dot langenc at gmail dot com>
# Contributor: Helmut Stult <helmut at manjaro dot org>
pkgname=optimus-manager
pkgver=0.7.1
pkgrel=1
pkgdesc="Management utility to handle GPU switching for Optimus laptops."
pkgver=1.0
pkgrel=2
pkgdesc="Management utility to handle GPU switching for Optimus laptops"
arch=('any')
url="https://github.com/Askannz/optimus-manager"
license=('MIT')
depends=('python' 'python-pyqt5' 'python-setuptools' 'nvidia' 'mesa-demos' 'xorg-xrandr')
conflicts=("optimus-manager-git")
provides=("optimus-manager=$pkgver")
depends=('python' 'python-setuptools' 'python-dbus' 'mesa-demos' 'xorg-xrandr')
optdepends=('bbswitch: alternative power switching method'
'xf86-video-intel: provides the Xorg intel driver')
makedepends=('python-setuptools' 'git')
backup=('etc/optimus-manager/xorg-intel.conf'
'etc/optimus-manager/xorg-nvidia.conf')
'etc/optimus-manager/xorg-nvidia.conf'
'etc/optimus-manager/xsetup-intel.sh'
'etc/optimus-manager/xsetup-nvidia.sh'
'var/lib/optimus-manager/startup_mode'
'var/lib/optimus-manager/requested_mode')
source=("git+https://github.com/Askannz/optimus-manager.git#tag=v$pkgver")
sha256sums=('SKIP')
......@@ -23,22 +31,33 @@ build() {
package() {
install="optimus-manager.install"
cd "${srcdir}/optimus-manager/"
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
install -Dm644 modules/optimus-manager.conf "$pkgdir/etc/modprobe.d/optimus-manager.conf"
install -Dm755 xorg/optimus-manager_Xsetup "$pkgdir/usr/bin/optimus-manager_Xsetup"
install -Dm644 modules/optimus-manager.conf "$pkgdir/usr/lib/modprobe.d/optimus-manager.conf"
install -Dm644 systemd/optimus-manager.service "$pkgdir/usr/lib/systemd/system/optimus-manager.service"
install -Dm644 systemd/99-optimus-manager.conf "$pkgdir/usr/lib/systemd/system/display-manager.service.d/99-optimus-manager.conf"
install -Dm644 optimus-manager.conf "$pkgdir/usr/share/optimus-manager.conf"
install -Dm644 systemd/logind/10-optimus-manager.conf "$pkgdir/usr/lib/systemd/logind.conf.d/10-optimus-manager.conf"
install -Dm644 var/startup_mode "$pkgdir/var/lib/optimus-manager/startup_mode"
install -Dm644 var/requested_mode "$pkgdir/var/lib/optimus-manager/requested_mode"
install -Dm755 scripts/prime-switch-boot "$pkgdir/usr/bin/prime-switch-boot"
install -Dm755 scripts/prime-switch "$pkgdir/usr/bin/prime-switch"
install -Dm755 scripts/prime-offload "$pkgdir/usr/bin/prime-offload"
install -Dm644 login_managers/sddm/20-optimus-manager.conf "$pkgdir/etc/sddm.conf.d/20-optimus-manager.conf"
install -Dm644 login_managers/lightdm/20-optimus-manager.conf "$pkgdir/etc/lightdm/lightdm.conf.d/20-optimus-manager.conf"
install -Dm644 config/xorg-intel.conf "$pkgdir/etc/optimus-manager/xorg-intel.conf"
install -Dm644 config/xorg-nvidia.conf "$pkgdir/etc/optimus-manager/xorg-nvidia.conf"
install -Dm644 desktop/optimus-manager-systray.desktop "$pkgdir/usr/share/applications/optimus-manager-systray.desktop"
mkdir -p "$pkgdir/var/lib/optimus-manager/"
install -Dm755 config/xsetup-intel.sh "$pkgdir/etc/optimus-manager/xsetup-intel.sh"
install -Dm755 config/xsetup-nvidia.sh "$pkgdir/etc/optimus-manager/xsetup-nvidia.sh"
python setup.py install --root="$pkgdir/" --optimize=1 --skip-build
......
cleanup() {
echo "optimus-manager : removing obsolete auto-generated files left over by previous versions"
# SDDM
sddm_conf=/etc/sddm.conf.d/10-optimus-manager.conf
if [ -f "$sddm_conf" ]; then
rm $sddm_conf
fi
sddm_xsetup=/usr/share/sddm/scripts/Xsetup
if [ -f "$sddm_conf" ]; then
printf "#!/bin/sh\n# Xsetup - run as root before the login dialog appears\n" > "$sddm_xsetup"
chmod 755 "$sddm_xsetup"
fi
# LightDM
lightdm_conf=/etc/lightdm/lightdm.conf.d/10-optimus-manager.conf
if [ -f "$lightdm_conf" ]; then
rm $lightdm_conf
fi
# GDM
gdm_file_1=/usr/share/gdm/greeter/autostart/optimus-manager-xsetup.desktop
if [ -f "$gdm_file_1" ]; then
rm $gdm_file_1
fi
gdm_file_2=/etc/xdg/autostart/optimus-manager-xsetup.desktop
if [ -f "$gdm_file_2" ]; then
rm $gdm_file_2
fi
# Xorg
xorg_conf=/etc/X11/xorg.conf.d/10-optimus-manager.conf
if [ -f "$xorg_conf" ]; then
rm $xorg_conf
fi
}
make_log_folder() {
LOGDIR=/var/log/optimus-manager/
mkdir -p "$LOGDIR"
chmod 777 "$LOGDIR"
}
pre_install() {
cleanup
}
post_install() {
echo "optimus-manager : enabling optimus-manager.service"
mkdir -p /etc/systemd/system/graphical.target.wants/
ln -s /usr/lib/systemd/system/optimus-manager.service /etc/systemd/system/graphical.target.wants/optimus-manager.service
make_log_folder
bold=$(tput bold)
red=$(tput setaf 1)
normal=$(tput sgr0)
echo "${bold}${red}Please reboot your computer before using optimus-manager${normal}"
}
pre_upgrade() {
cleanup
}
post_upgrade() {
make_log_folder
bold=$(tput bold)
red=$(tput setaf 1)
normal=$(tput sgr0)
echo "${bold}${red}optimus-manager : if you are upgrading from version v0.8 or earlier, please reboot before attempting a GPU switch.${normal}"
}
post_remove() {
echo "optimus-manager : cleaning up auto-generated Xorg conf"
xorg_conf=/etc/X11/xorg.conf.d/10-optimus-manager.conf
if [ -f "$xorg_conf" ]; then
rm $xorg_conf
fi
echo "optimus-manager : disabling optimus-manager.service"
service_file_link=/etc/systemd/system/graphical.target.wants/optimus-manager.service
if [ -L "$service_file_link" ]; then
rm $service_file_link
fi
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment