slackbuilds/a/nvidiabl/nvidiabl.SlackBuild
2013-12-17 13:59:03 +01:00

77 lines
1.8 KiB
Bash
Executable file

#!/bin/sh -x
# variables
CWD=$(pwd)
VERSION=${VERSION:-$(date +"%Y.%m.%d_%H.%M")_$(uname -r)}
BUILD=${BUILD:-1}
TAG=cyco
TMP=${TMP:-/tmp/$TAG}
OUTPUT=${OUTPUT:-/tmp}
PRGNAM=${PRGNAM:-$(basename $CWD)}
PKG=${PKG:-$TMP/pkg-$PRGNAM}
ARCH=${ARCH:-noarch}
PREFIX=${PREFIX:-/usr}
REPOSITORY=${REPOSITORY:=/home/installs/SlackBuilds/repositories/$PRGNAM}
# nettoyage préalable
rm -fr $PKG
mkdir -p $TMP
cd $TMP
# mise en place
[ ! -e $REPOSITORY ] \
&& git clone https://github.com/guillaumezin/nvidiabl.git $REPOSITORY \
|| (cd $REPOSITORY; git pull)
cp -R $REPOSITORY $PRGNAM
cd $PRGNAM
make
make install DESTDIR=$PKG
mkdir -p $PKG$PREFIX/{sbin,doc/$PRGNAM}
cp -R scripts/ README $PKG$PREFIX/doc/$PRGNAM
cp scripts/usr/local/sbin/* $PKG$PREFIX/sbin
mkdir -p $PKG/etc/udev/rules.d/
cat <<EOF > $PKG/etc/udev/rules.d/97-nvidia-brightness.rules
KERNEL=="nvidia_backlight", SUBSYSTEM=="backlight", RUN+="/usr/bin/chmod 0666 /sys/class/backlight/%k/brightness"
EOF
# correction
cd $PKG
chown -R root:root *
# embaumement
mkdir -p $PKG/install
cat <<EOF > $PKG/install/slack-desc
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
$PRGNAM: $PRGNAM (Linux driver)
$PRGNAM:
$PRGNAM: for setting the backlight brightness on laptops using NVIDIA GPU
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM: https://github.com/guillaumezin/nvidiabl
$PRGNAM:
EOF
# empaquetage
makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.txz