diff options
Diffstat (limited to 'system')
-rw-r--r-- | system/system76-power/README | 14 | ||||
-rw-r--r-- | system/system76-power/config/rc.system76-power | 60 | ||||
-rw-r--r-- | system/system76-power/config/system76-power.logrotate | 7 | ||||
-rw-r--r-- | system/system76-power/doinst.sh | 26 | ||||
-rw-r--r-- | system/system76-power/slack-desc | 19 | ||||
-rw-r--r-- | system/system76-power/system76-power.SlackBuild | 213 | ||||
-rw-r--r-- | system/system76-power/system76-power.info | 86 |
7 files changed, 425 insertions, 0 deletions
diff --git a/system/system76-power/README b/system/system76-power/README new file mode 100644 index 0000000000..59f0b219f4 --- /dev/null +++ b/system/system76-power/README @@ -0,0 +1,14 @@ +system76-power is a utility for managing graphics and power profiles. + +When run in daemon mode, system76-power manages the fan speed of fans +connected to the System76 Io board on Thelio desktops. + +To start the daemon at boot, add the following to your /etc/rc.d/rc.local +script and make sure rc.system76-power has executable permissions set: + if [ -x /etc/rc.d/rc.system76-power ]; then + /etc/rc.d/rc.system76-power start + fi + +The system76-power daemon log messages are logged to +/var/log/system76-power.log by default. Logging can be disabled by setting +LOG_FILE=/dev/null in /etc/rc.d/rc.system76-power. diff --git a/system/system76-power/config/rc.system76-power b/system/system76-power/config/rc.system76-power new file mode 100644 index 0000000000..93e3e25dfa --- /dev/null +++ b/system/system76-power/config/rc.system76-power @@ -0,0 +1,60 @@ +#!/bin/sh +# Start system76-power daemon +# + +LOG_FILE=/var/log/system76-power.log + +add_log_msg() { + echo "[$(date "+%Y-%m-%d %T")] $1" >> $LOG_FILE +} + +s76pwr_start() { + PWR_DIR=/usr/bin + if [ -x $PWR_DIR/system76-power ] ; then + echo "Starting system76-power..." + add_log_msg "Starting system76-power daemon from /etc/rc.d/rc.system76-power" + $PWR_DIR/system76-power daemon >>$LOG_FILE 2>&1 & + fi +} + +s76pwr_stop() { + add_log_msg "Killing system76-power daemon from /etc/rc.d/rc.system76-power" + killall system76-power 2> /dev/null +} + +s76pwr_restart() { + s76pwr_stop + sleep 1 + s76pwr_start +} + +s76pwr_help() { + cat <<EOF +usage: $0 start|stop|restart + +$0 start + Starts the system76-power daemon + +$0 stop + Stops the system76-power daemon + +$0 restart + Restarts the system76-power daemon + +EOF +} + +case "$1" in +'start') + s76pwr_start + ;; +'stop') + s76pwr_stop + ;; +'restart') + s76pwr_restart + ;; +*) + s76pwr_help + ;; +esac diff --git a/system/system76-power/config/system76-power.logrotate b/system/system76-power/config/system76-power.logrotate new file mode 100644 index 0000000000..cd9cef89cf --- /dev/null +++ b/system/system76-power/config/system76-power.logrotate @@ -0,0 +1,7 @@ +/var/log/system76-power.log { + copytruncate + delaycompress + compress + notifempty + missingok +} diff --git a/system/system76-power/doinst.sh b/system/system76-power/doinst.sh new file mode 100644 index 0000000000..c7e601af05 --- /dev/null +++ b/system/system76-power/doinst.sh @@ -0,0 +1,26 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +preserve_perms() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ -e $OLD ]; then + cp -a $OLD ${NEW}.incoming + cat $NEW > ${NEW}.incoming + mv ${NEW}.incoming $NEW + fi + config $NEW +} + +preserve_perms etc/rc.d/rc.system76-power.new +config etc/logrotate.d/system76-power.new diff --git a/system/system76-power/slack-desc b/system/system76-power/slack-desc new file mode 100644 index 0000000000..585ae4237d --- /dev/null +++ b/system/system76-power/slack-desc @@ -0,0 +1,19 @@ +# 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 ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +system76-power: system76-power (utility for managing graphics and power profiles) +system76-power: +system76-power: When run in daemon mode, system76-power manages the fan speed of fans +system76-power: connected to the System76 Io board on Thelio desktops. +system76-power: +system76-power: Homepage: https://github.com/pop-os/system76-power +system76-power: +system76-power: +system76-power: +system76-power: +system76-power: diff --git a/system/system76-power/system76-power.SlackBuild b/system/system76-power/system76-power.SlackBuild new file mode 100644 index 0000000000..7557cd19b6 --- /dev/null +++ b/system/system76-power/system76-power.SlackBuild @@ -0,0 +1,213 @@ +#!/bin/sh + +# Slackware build script for system76-power + +# Copyright 2019 Erich Ritz, Scottsdale, Arizona, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=system76-power +VERSION=${VERSION:-1.0.1} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + # Unless $ARCH is already set, use uname -m for all other archs: + *) ARCH=$( uname -m ) ;; + esac + + if [ "$ARCH" = "i586" ]; then + if rustc -Vv | grep host | grep i686 > /dev/null ; then + ARCH=i686 + fi + fi +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +if [ -e $CWD/$VERSION.tar.gz ]; then + tar xvf $CWD/$VERSION.tar.gz +else + tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +fi +cd $PRGNAM-$VERSION + +# build offline +# configuration tells cargo to use the configured directory +# for dependencies intead of downloading from crates.io +mkdir .cargo +cat << EOF >> .cargo/config +[source.crates-io] +replace-with = "vendored-sources" + +[source."https://github.com/pop-os/sysfs-class"] +git = "https://github.com/pop-os/sysfs-class" +branch = "master" +replace-with = "vendored-sources" + +[source.vendored-sources] +directory = "$(pwd)/vendor" +EOF + +mkdir vendor +# deps and versions come from Cargo.lock +( + cd vendor + + for dependency in ansi_term=0.11.0 \ + atty=0.2.11 \ + bitflags=0.7.0 \ + bitflags=1.0.4 \ + cfg-if=0.1.7 \ + clap=2.33.0 \ + dbus=0.6.2 \ + err-derive=0.1.5 \ + fern=0.5.8 \ + intel-pstate=0.2.0 \ + libc=0.2.54 \ + libdbus-sys=0.1.5 \ + log=0.4.6 \ + numtoa=0.1.0 \ + numtoa=0.2.3 \ + pkg-config=0.3.14 \ + proc-macro2=0.4.30 \ + quote=0.6.12 \ + redox_syscall=0.1.54 \ + redox_termios=0.1.1 \ + rustc_version=0.2.3 \ + semver=0.9.0 \ + semver-parser=0.7.0 \ + smart-default=0.5.2 \ + strsim=0.8.0 \ + syn=0.15.34 \ + synstructure=0.10.1 \ + sysfs-class=0.1.1=7bc914e0ac41df18a671ede0691fcd7d1f7e8add \ + termion=1.5.2 \ + textwrap=0.11.0 \ + time=0.1.42 \ + unicode-width=0.1.5 \ + unicode-xid=0.1.0 \ + vec_map=0.8.1 \ + vergen=0.1.1 \ + winapi=0.3.7 \ + winapi-i686-pc-windows-gnu=0.4.0 \ + winapi-x86_64-pc-windows-gnu=0.4.0; do + dep="$(echo "$dependency" | cut -d= -f1)" + ver="$(echo "$dependency" | cut -d= -f2)" + + if [ -e $CWD/$dep-$ver.crate ]; then + CRATE_FILE=$CWD/$dep-$ver.crate + else + id="$(echo "$dependency" | cut -d= -f3)" + if [ -e $CWD/$id.tar.gz ]; then + CRATE_FILE=$CWD/$id.tar.gz + else + CRATE_FILE=$CWD/sysfs-class-$id.tar.gz + fi + ver=$id + fi + tar xvf $CRATE_FILE + + touch $dep-$ver/.cargo-ok + + # generate checksum + { + printf "{\n" + printf ' "files": {\n' + + ( + cd $dep-$ver + find . -type f -print0 | xargs -0 sha256sum | sed -n '/\.cargo-checksum\.json/!p' | sed 's/\.\///;s/^\([^ ]*\)[[:space:]][[:space:]]*\(.*\)$/"\2":"\1",/' + ) | sed '$ s/,$//' + + printf " },\n" + printf ' "package": "' + + sha256sum "$CRATE_FILE" | cut -f1 -d' ' | sed 's/$/"/' + + printf "}\n" + } | python -c "import sys, json; data = sys.stdin.read(); print json.dumps(json.loads(data), sort_keys=True, indent=4, separators=(',', ' : '))" > $dep-$ver/.cargo-checksum.json + # Change selected package checksums to null + if [ "$dep" == "sysfs-class" ] ; then + sed -i 's/"package" : ".\{64\}"/"package" : null/' $dep-$ver/.cargo-checksum.json + fi + done +) + +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +libdir=/usr/lib${LIBDIRSUFFIX} \ +make +make install DESTDIR=$PKG + +# Remove suid bit on system76-power executable +# Despite being installed SUID by the Makefile, the Debian package installed +# on Pop!_OS has 0755 permissions for this file, so follow that convention. +chmod u-s $PKG/usr/bin/system76-power + +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +mkdir -p $PKG/etc/logrotate.d $PKG/etc/rc.d +install -m 0644 $CWD/config/system76-power.logrotate $PKG/etc/logrotate.d/system76-power.new +install -m 0644 $CWD/config/rc.system76-power $PKG/etc/rc.d/rc.system76-power.new + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a LICENSE README.md $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/system/system76-power/system76-power.info b/system/system76-power/system76-power.info new file mode 100644 index 0000000000..245203581a --- /dev/null +++ b/system/system76-power/system76-power.info @@ -0,0 +1,86 @@ +PRGNAM="system76-power" +VERSION="1.0.1" +HOMEPAGE="https://github.com/pop-os/system76-power" +DOWNLOAD="https://github.com/pop-os/system76-power/archive/1.0.1/system76-power-1.0.1.tar.gz \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/ansi_term/ansi_term-0.11.0.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/atty/atty-0.2.11.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/bitflags/bitflags-0.7.0.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/bitflags/bitflags-1.0.4.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/cfg-if/cfg-if-0.1.7.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/clap/clap-2.33.0.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/dbus/dbus-0.6.2.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/err-derive/err-derive-0.1.5.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/fern/fern-0.5.8.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/intel-pstate/intel-pstate-0.2.0.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/libc/libc-0.2.54.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/libdbus-sys/libdbus-sys-0.1.5.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/log/log-0.4.6.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/numtoa/numtoa-0.1.0.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/numtoa/numtoa-0.2.3.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/pkg-config/pkg-config-0.3.14.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/proc-macro2/proc-macro2-0.4.30.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/quote/quote-0.6.12.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/redox_syscall/redox_syscall-0.1.54.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/redox_termios/redox_termios-0.1.1.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/rustc_version/rustc_version-0.2.3.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/semver/semver-0.9.0.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/semver-parser/semver-parser-0.7.0.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/smart-default/smart-default-0.5.2.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/strsim/strsim-0.8.0.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/syn/syn-0.15.34.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/synstructure/synstructure-0.10.1.crate \ + https://github.com/pop-os/sysfs-class/archive/7bc914e0ac41df18a671ede0691fcd7d1f7e8add.tar.gz \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/termion/termion-1.5.2.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/textwrap/textwrap-0.11.0.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/time/time-0.1.42.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/unicode-width/unicode-width-0.1.5.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/unicode-xid/unicode-xid-0.1.0.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/vec_map/vec_map-0.8.1.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/vergen/vergen-0.1.1.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/winapi/winapi-0.3.7.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/winapi-i686-pc-windows-gnu/winapi-i686-pc-windows-gnu-0.4.0.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/winapi-x86_64-pc-windows-gnu/winapi-x86_64-pc-windows-gnu-0.4.0.crate" +MD5SUM="34a7e9c9a05e13f6807c52aeb1d375a6 \ + 294a49d3c53865fa7ac5d0ce2f5d5735 \ + 5d7155b7fbc0e234c017f418f0dc9d64 \ + 1dd9b755c91f0f7bb401e393a9ed69f2 \ + e5767560aad375059c975285c07022c0 \ + 0cd2bb93a82da2e4ca526b40ae8b341e \ + 135f6d6306e50606f0475ada50c33ce2 \ + 1651afddc85f41bc8ed7a8de31330733 \ + f2f2aaa1f19b52785665e4079ae6b903 \ + 0659d17c4a1530155d8aac2d9cab7cdb \ + a55e4bbf06ebb689ed245fbfbf3f1dd2 \ + 2c69391ab2d137625a5ab389ae94ba26 \ + f98185d068ac4625238cfe13a60395b3 \ + cc65f96341390c0f60f5216e829486e7 \ + bbda7e9c572f651774dfdb0006b9f085 \ + 28a4e2e962d9723f131cdd5acb140b6d \ + 87a9d36f5ebe5eae0c3e8d69d58752e1 \ + 020c7d0be083642e24a1499122793006 \ + 54694fe2ab822610b6ee4ccc048752eb \ + 14fab6ea3c2c94779d3c50dd2dffd10e \ + 01cb5402c0fd99cebac702b76f2f2669 \ + 4d101ab24d14c54937c5f45ece8fad5f \ + 64111c20b69aa1532fb66b70c4660b55 \ + 8b4d8c7b6e3a060d365bc1ad650929fa \ + 2d3e63b50a8d82c4dccd51981e332da8 \ + 781d4ccf5d04c98fa02af207a9639249 \ + f84584b1a3e6311ffcb517ff3e1aff0b \ + d155c08de6c18bd55639ffed629894b9 \ + 6c390f2e82570acd1b5b4e2510c6e433 \ + 9f1f6e2fe9afbbcc351a7430962a7571 \ + a8de006fe0c7e373c560dd51599287a8 \ + 3d311d2cedf2d3d7b11b32baf470b178 \ + d7c493ca4f84a7d50b53646421a37487 \ + 5aaf04f9a94a6450e3e4963ddd62b92d \ + 0eedbc32447f40b3045d6de3910b5415 \ + 03910f37dc041fd9402bda7825e8404f \ + 38569b37293d94fc57b6e1449a1c38aa \ + db96b50050277bf05a3c68534bbb9586 \ + 09de9d01e7331ff3da11f58be8bef0df" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="system76-io-dkms" +MAINTAINER="Erich Ritz" +EMAIL="erich.public@protonmail.com" |