From 12ec7a791e7554d9d42759c74393847f6443916f Mon Sep 17 00:00:00 2001 From: Gottox Date: Fri, 24 Jan 2014 11:35:48 +0100 Subject: [PATCH] odroid-u2-base: add systemd_services; add LED utilities --- srcpkgs/odroid-u2-base/files/odroid-led | 48 +++++++++++++++++++ .../odroid-u2-base/files/odroid-led.default | 5 ++ .../odroid-u2-base/files/odroid-led.service | 9 ++++ srcpkgs/odroid-u2-base/template | 22 +++++++-- 4 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 srcpkgs/odroid-u2-base/files/odroid-led create mode 100644 srcpkgs/odroid-u2-base/files/odroid-led.default create mode 100644 srcpkgs/odroid-u2-base/files/odroid-led.service diff --git a/srcpkgs/odroid-u2-base/files/odroid-led b/srcpkgs/odroid-u2-base/files/odroid-led new file mode 100644 index 00000000000..06a622afba3 --- /dev/null +++ b/srcpkgs/odroid-u2-base/files/odroid-led @@ -0,0 +1,48 @@ +#!/bin/bash + +usage() { + cat >&2 <&2 + exit 1; +} + +LED=/sys/class/leds/led1/brightness +MAXLED=/sys/class/leds/led1/max_brightness + + + +if [ $# -eq 1 ]; then + [ -z "$1" ] && usage + behavior=$1 +elif [ $# -gt 1 ]; then + usage; +elif [ -f /etc/default/odroid-led ]; then + . /etc/default/odroid-led + behavior=$LED_BOOT_BEHAVIOR + auto_config=1 +else + exit 1 +fi + + +case "$behavior" in + enable) + [ -f $LED -a -f $MAXLED ] || die "LED control file can not be found" + echo 0 > $LED + cat $MAXLED > $LED + ;; + disable) + [ -f $LED ] || die "LED control file can not be found" + echo 0 > $LED + ;; + *) + [ "$auto_config" ] || usage + exit 0; + ;; +esac diff --git a/srcpkgs/odroid-u2-base/files/odroid-led.default b/srcpkgs/odroid-u2-base/files/odroid-led.default new file mode 100644 index 00000000000..2c098a32daf --- /dev/null +++ b/srcpkgs/odroid-u2-base/files/odroid-led.default @@ -0,0 +1,5 @@ +# LED_BOOT_BEHAVIOR: Control the behavior of the blue LED on boot +# enable: turn LED on +# disable: turn LED off +# auto: do nothing (LED will blink) +LED_BOOT_BEHAVIOR=enable diff --git a/srcpkgs/odroid-u2-base/files/odroid-led.service b/srcpkgs/odroid-u2-base/files/odroid-led.service new file mode 100644 index 00000000000..13d4aef5f90 --- /dev/null +++ b/srcpkgs/odroid-u2-base/files/odroid-led.service @@ -0,0 +1,9 @@ +[Unit] +Description=Sets Odroids LED on boot + +[Service] +Type=oneshot +ExecStart=/usr/sbin/odroid-led + +[Install] +WantedBy=multi-user.target diff --git a/srcpkgs/odroid-u2-base/template b/srcpkgs/odroid-u2-base/template index 2a054e613e5..48e4795d583 100644 --- a/srcpkgs/odroid-u2-base/template +++ b/srcpkgs/odroid-u2-base/template @@ -1,6 +1,6 @@ # Template file for 'odroid-u2-base' pkgname=odroid-u2-base -version=1.3 +version=1.4 revision=1 homepage="http://www.voidlinux.eu" hostmakedepends="uboot-mkimage" @@ -9,10 +9,20 @@ depends="${makedepends}" short_desc="ODROID U2/U3 base files" maintainer="Enno Boland " license="GPL-2.0" +only_for_archs="armv7l" + +# enable odroid-led, ntpd, dhcpcd and sshd by default. +systemd_services=" + odroid-led.service on + ntpdate.service on + ntpd.service on + dhcpcd.service on + sshd.service on" + +# Allow upgrades for compatibility. provides="odroid-u2-ubootcfg-${version}_${revision}" replaces="odroid-u2-ubootcfg>=0" -only_for_archs="armv7l" _default_scr="boot-auto_edid.scr" do_build() { @@ -25,9 +35,15 @@ do_build() { } do_install() { - # Installing uboot scr's + # Install uboot scr's for scr in *.scr; do echo $scr vinstall $scr 600 boot done + + # Install LED utilities + vinstall ${FILESDIR}/odroid-led 744 /usr/sbin + vinstall ${FILESDIR}/odroid-led.default 744 /etc/default odroid-led + vinstall ${FILESDIR}/odroid-led.service 644 /usr/lib/systemd/system + }