Merge pull request #259 from Gottox/master

odroid-u2-base: add systemd_services; add LED utilities
This commit is contained in:
Juan RP 2014-01-24 03:00:18 -08:00
commit 7004c0ab2f
4 changed files with 81 additions and 3 deletions

View File

@ -0,0 +1,48 @@
#!/bin/bash
usage() {
cat >&2 <<EOF
usage: $0 [enable|disable]
EOF
exit 1;
}
die() {
echo $@ >&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

View File

@ -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

View File

@ -0,0 +1,9 @@
[Unit]
Description=Sets Odroids LED on boot
[Service]
Type=oneshot
ExecStart=/usr/sbin/odroid-led
[Install]
WantedBy=multi-user.target

View File

@ -1,6 +1,6 @@
# Template file for 'odroid-u2-base' # Template file for 'odroid-u2-base'
pkgname=odroid-u2-base pkgname=odroid-u2-base
version=1.3 version=1.4
revision=1 revision=1
homepage="http://www.voidlinux.eu" homepage="http://www.voidlinux.eu"
hostmakedepends="uboot-mkimage" hostmakedepends="uboot-mkimage"
@ -9,10 +9,20 @@ depends="${makedepends}"
short_desc="ODROID U2/U3 base files" short_desc="ODROID U2/U3 base files"
maintainer="Enno Boland <eb@s01.de>" maintainer="Enno Boland <eb@s01.de>"
license="GPL-2.0" 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}" provides="odroid-u2-ubootcfg-${version}_${revision}"
replaces="odroid-u2-ubootcfg>=0" replaces="odroid-u2-ubootcfg>=0"
only_for_archs="armv7l"
_default_scr="boot-auto_edid.scr" _default_scr="boot-auto_edid.scr"
do_build() { do_build() {
@ -25,9 +35,15 @@ do_build() {
} }
do_install() { do_install() {
# Installing uboot scr's # Install uboot scr's
for scr in *.scr; do for scr in *.scr; do
echo $scr echo $scr
vinstall $scr 600 boot vinstall $scr 600 boot
done 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
} }