M bin/tiles => bin/tiles +6 -3
@@ 1,13 1,15 @@
#!/bin/sh
+version=PLACEHOLDER
usage() {
echo 'Starts/stops the tiles desktop environment.
Example: Start a session from the virtual console: startx /usr/bin/tiles
---quit Terminate the session.
---start Start a session, the default.' >&2
+--quit Terminate the session.
+--start Start a session, the default.
+--version Print the version and exit.' >&2
}
-args="$(getopt -n tiles -o h -l help,quit,start -- "$@")" || exit
+args="$(getopt -n tiles -o h -l help,quit,start,version -- "$@")" || exit
eval set -- "$args"
mode=start
while :; do
@@ 15,6 17,7 @@ while :; do
-h|--help) usage; exit;;
--quit) mode=quit; shift;;
--start) mode=start; shift;;
+ --version) printf %s\\n "$version"; exit;;
--) shift; break;;
esac
done
M install.sh => install.sh +2 -0
@@ 1,5 1,6 @@
#!/bin/sh
# ./install.sh [DESTDIR] [BINDIR]
+: "${TILES_VERSION="$(git describe --long --abbrev=12 --tags --dirty 2>/dev/null || echo 0.1)"}"
if ! command -v scdoc >/dev/null; then
echo 'you need the scdoc command (for compiling the manpage)'
@@ 9,6 10,7 @@ fi
bin="$1/${2:-usr/local/bin}"
mkdir -p "$bin" || exit
cp bin/* "$bin" || exit
+sed "s/^version=PLACEHOLDER$/version=$TILES_VERSION/" bin/tiles > "$bin/tiles" || exit
cc -o "$bin/tiles-shell" tiles-shell.c || exit
ln -sf "$bin/tiles-shell" "$1/usr/bin/tiles-shell" 2>/dev/null