diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..93decac --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +raspi-rotate.tar.gz diff --git a/Makefile b/Makefile index 92452a9..c35cca1 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,22 @@ bindir=/usr/local/bin etcdir=/etc/raspi-rotate tmpldir=$(etcdir)/xorg.conf.d +hooksdir=$(etcdir)/hooks.d install: mkdir -p $(bindir) mkdir -p $(etcdir) mkdir -p $(tmpldir) + mkdir -p $(hooksdir) install -m 0755 bin/raspi-rotate-screen $(bindir) install -m 0644 etc/xorg.conf.d/99-raspi-rotate.conf.tmpl $(tmpldir) + install -m 0755 etc/hooks.d/*.sh $(hooksdir) + +dist: + tar -zcf raspi-rotate.tar.gz \ + ../raspi-rotate/bin \ + ../raspi-rotate/etc \ + ../raspi-rotate/COPYING \ + ../raspi-rotate/AUTHORS \ + ../raspi-rotate/Makefile \ + ../raspi-rotate/README.md diff --git a/bin/raspi-rotate-screen b/bin/raspi-rotate-screen index 318bb60..12fb5c9 100755 --- a/bin/raspi-rotate-screen +++ b/bin/raspi-rotate-screen @@ -2,6 +2,7 @@ #Variables CONF_DIR="/etc/raspi-rotate" +HOOKS_DIR="$CONF_DIR/hooks.d" XORG_TEMPLATE="$CONF_DIR/xorg.conf.d/99-raspi-rotate.conf.tmpl" XORG_CONF_DIR="/etc/X11/xorg.conf.d" XORG_CONF_FILE="$XORG_CONF_DIR/99-raspi-rotate.conf" @@ -60,5 +61,13 @@ mkdir -p "$XORG_CONF_DIR" chmod 644 "$TMP_FILE" mv "$TMP_FILE" "$XORG_CONF_FILE" +#Run hooks +if [ -d "$HOOKS_DIR" ] ; then + for f in $HOOKS_DIR/?*.sh ; do + [ -x "$f" ] && . "$f" + done + unset f +fi + echo "Rotation set to $ROTATE" diff --git a/etc/hooks.d/01-bootsplash.sh b/etc/hooks.d/01-bootsplash.sh new file mode 100644 index 0000000..5bde7b9 --- /dev/null +++ b/etc/hooks.d/01-bootsplash.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +if [ "$ROTATE" != "" ]; then + if [ -d "/usr/share/bootsplash-$ROTATE" ]; then + echo "Linking /usr/share/bootsplash-$ROTATE to /usr/share/bootsplash" + rm -f /usr/share/bootsplash + ln -s "/usr/share/bootsplash-$ROTATE" /usr/share/bootsplash + fi +fi