Skip to content

Commit

Permalink
added gpd-fan package, needed for the repository that is used in pacm…
Browse files Browse the repository at this point in the history
…an when building the ISO
  • Loading branch information
sigboe committed Oct 31, 2017
1 parent 6de2457 commit 56acee2
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
42 changes: 42 additions & 0 deletions packages/gpd-fan/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Maintainer: <[email protected]>

# Inspired by cawilliamson https://github.com/cawilliamson/ansible-gpdpocket

pkgname=gpd-fan
pkgver=0.1.0
pkgrel=1
arch=('x86_64')
url="https://github.com/njkli/gpd-pocket"
license=('MIT')
provides=('gpd-fan')
depends=('i2c-tools' 'thermald' 'tlp' 'gc' 'libatomic_ops' 'pcre' 'libevent' 'llvm-libs')
makedepends=('crystal' 'shards')
install=gpd-fan.install
source=("${pkgname}::git://github.com/njkli/gpd-fan.git")
sha256sums=('SKIP')

pkgver() {
printf "%s" "$(grep define_version ${srcdir}/${pkgname}/gpd-fan.cr | awk '{print $2}' | sed 's/\"//g')"
}

build() {
cd "${srcdir}/${pkgname}"
crystal deps
msg 'Building binary...'
crystal build --release --no-debug gpd-fan.cr
}

package() {
mkdir -p $pkgdir/usr/bin
mkdir -p $pkgdir/usr/lib/systemd/system
mkdir -p $pkgdir/etc/default
mkdir -p $pkgdir/usr/lib/systemd/system-sleep

install -Dm0755 "$srcdir/${pkgname}/gpd-fan" "$pkgdir/usr/bin/gpd-fan"
# TODO: Perhaps make it into systemd-timer instead?
install -Dm0644 "$srcdir/${pkgname}/gpd-fan.service" "$pkgdir/usr/lib/systemd/system/gpd-fan.service"
install -Dm0644 "$srcdir/${pkgname}/gpd-fan.example" "$pkgdir/etc/default/gpd-fan.example"
install -Dm0755 "$srcdir/${pkgname}/gpd-fan.sleep" "$pkgdir/usr/lib/systemd/system-sleep/gpd-fan"
}

# vim:set ts=2 sw=2 et:
37 changes: 37 additions & 0 deletions packages/gpd-fan/gpd-fan.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# -*- shell-script -*-
# Colored makepkg-like functions
all_off="$(tput sgr0)"
bold="${all_off}$(tput bold)"
blue="${bold}$(tput setaf 4)"
yellow="${bold}$(tput setaf 3)"

msg_blue() {
printf "${blue}==>${bold} $1${all_off}\n"
}

note() {
printf "${blue}==>${yellow} NOTE:${bold} $1${all_off}\n"
}

_update() {
msg_blue "Restarting gpd-fan.service..."
systemctl stop gpd-fan.service
systemctl daemon-reload
systemctl enable gpd-fan.service
systemctl start gpd-fan.service
note "See /etc/default/gpd-fan.example for customization!"
}

post_install() {
_update
}

post_upgrade() {
_update
}

post_remove() {
systemctl stop gpd-fan.service
systemctl daemon-reload
msg_blue "Removed gpd-fan.service..."
}

0 comments on commit 56acee2

Please sign in to comment.