aboutsummaryrefslogtreecommitdiff
path: root/sbonewmaint
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2026-08-29 20:05:43 -0400
committerB. Watson <urchlay@slackware.uk>2026-08-29 20:05:43 -0400
commit8a78cfe513eb112585a5c5660fcbeb7cb3c58719 (patch)
tree2b68046bd6191912987b1dcfc4241802acd4d916 /sbonewmaint
parente78ea5d2fdc2263be14bb25f9094b590e0b9dc84 (diff)
downloadsbostuff-8a78cfe513eb112585a5c5660fcbeb7cb3c58719.tar.gz
sbodeps: allow -iq/-qi, add -m.
Diffstat (limited to 'sbonewmaint')
-rwxr-xr-xsbonewmaint45
1 files changed, 39 insertions, 6 deletions
diff --git a/sbonewmaint b/sbonewmaint
index ec40774..4e2c8f4 100755
--- a/sbonewmaint
+++ b/sbonewmaint
@@ -1,16 +1,30 @@
#!/bin/sh
+SELF="$( basename $0 )"
+
+warn() {
+ echo "$SELF: warning: $@" 1>&2
+}
+
+die() {
+ echo "$SELF: fatal: $@" 1>&2
+ exit 1
+}
+
# read config fresh, rather than use the env.
if [ -e ~/.sbostuff.cfg ]; then
source ~/.sbostuff.cfg
else
- echo "$( basename $0 ): warning: can't find ~/.sbostuff.cfg"
+ warn "can't find ~/.sbostuff.cfg"
fi
NAME="$1"
EMAIL="$2"
if [ "$NAME" = "me" -a "$EMAIL" = "" ]; then
+ if [ "$SBO_NAME" = "" -o "$SBO_EMAIL" = "" ]; then
+ die "can't use 'me' without SBO_NAME and SBO_EMAIL in the env"
+ fi
NAME="$SBO_NAME"
EMAIL="$SBO_EMAIL"
elif [ "$NAME" = "nobody" -o "$NAME" = "orphaned" ]; then
@@ -27,13 +41,32 @@ fi
INFO="$( echo *.info )"
if [ ! -e "$INFO" ]; then
- echo "No (or multiple) .info file in current dir" 1>&2
+ die "No (or multiple) .info file in current dir"
exit 1
fi
-sed -i "/^MAINTAINER=/s,\"[^\"]*\",\"$NAME\"," "$INFO"
-sed -i "/^EMAIL=/s,\"[^\"]*\",\"$EMAIL\"," "$INFO"
+cp "$INFO" "$INFO.bak"
+sed -i \
+ -e "/^MAINTAINER=/s,\"[^\"]*\",\"$NAME\"," "$INFO" \
+ -e "/^EMAIL=/s,\"[^\"]*\",\"$EMAIL\"," "$INFO"
+
+if cmp -s "$INFO" "$INFO.bak"; then
+ warn "No change to .info file"
+ exit 0
+fi
-PAGER=cat git diff .
+if colordiff --version &>/dev/null; then
+ DIFF=colordiff
+else
+ DIFF=diff
+fi
+
+$DIFF -u "$INFO.bak" "$INFO"
+
+if git rev-parse &>/dev/null; then
+ echo
+ echo "Don't forget to do this:"
+ echo " git commit -a -m'New maintainer'"
+fi
-echo "git commit -a -m'New maintainer'"
+rm -f "$INFO.bak"