summarylogtreecommitdiffstats
path: root/suckless-rebuild
diff options
context:
space:
mode:
authoran9wer2020-06-04 15:48:41 +0800
committeran9wer2020-06-04 15:48:41 +0800
commit7186b8f16aa1a227faf595e3470d503e37bd4c5a (patch)
treee3f3a3400e6f2be145bc1aaf466467dab3d6fe12 /suckless-rebuild
parent0d1cbc08349b2dabe517964013256e31456a9f65 (diff)
downloadaur-7186b8f16aa1a227faf595e3470d503e37bd4c5a.tar.gz
[0.1.3-1] Support any name of <config.h>
Diffstat (limited to 'suckless-rebuild')
-rwxr-xr-xsuckless-rebuild39
1 files changed, 25 insertions, 14 deletions
diff --git a/suckless-rebuild b/suckless-rebuild
index cafd90755049..32cc73dc4f8f 100755
--- a/suckless-rebuild
+++ b/suckless-rebuild
@@ -1,31 +1,42 @@
#!/usr/bin/env bash
+VERSION=0.1.3
+
DESTDIR=~/.suckless
BUILDDIR=~/.suckless-build
+die() {
+ echo "${@:2}"
+ exit $1
+}
+
usage() {
- echo "Usage: suckless-rebuild dmenu|slstatus|st <config.h>"
- exit 1
+ die $1 "Usage: suckless-rebuild dmenu|slstatus|st <config.h>"
}
-if [[ ${#@} != 2 || $1 =~ ^-h$|^--help$ || $2 =~ ^-h$|^--help$ ]]; then
- usage
-fi
+version() {
+ die $1 "suckless-build $VERSION"
+}
+
+case $1 in
+ dmenu|slstatus|st ) software=$1; config=$2 ;;
+ -V|--version ) version 0 ;;
+ -h|--help) usage 0 ;;
+ * ) usage 1 ;;
+esac
-software=$1
-config=$2
+if [[ ${#@} != 2 ]]; then
+ usage 1
+fi
if [[ ! $software =~ ^dmenu$|^slstatus$|^st$ ]]; then
- echo "Unknown suckless software '$software'."
- exit 1
+ die 1 "Unknown suckless software '$software'."
fi
if [[ ! -d /usr/src/$software ]]; then
- echo "'an9wer-$software' may not be installed."
- exit 1
+ die 1 "'an9wer-$software' may not be installed."
fi
if [[ ! -f $config ]]; then
- echo "'$config' is not a regular file."
- exit 1
+ die 1 "'$config' is not a regular file."
fi
# Move last build directory
@@ -36,7 +47,7 @@ fi
mkdir -p "$BUILDDIR"
cp -r /usr/src/$software "$BUILDDIR/$software"
-cp -f "$config" "$BUILDDIR/$software"
+cp -f "$config" "$BUILDDIR/$software/config.h"
cd "$BUILDDIR/$software"
if make &> build.log && make PREFIX="$DESTDIR" install &> build.log; then