1
0

volume needs no makefile

This commit is contained in:
dtb 2022-10-23 02:23:58 -04:00
parent c2c34e0f85
commit 27f4407c5b
2 changed files with 6 additions and 26 deletions

View File

@ -1,20 +0,0 @@
all: ;
clean: ;
sane: ;
dist: ../dist/volume.tar.gz
../dist/volume: volume
mkdir -p ../dist/volume.tmp/bin/
cp volume* ../dist/volume.tmp/bin/
mv ../dist/volume.tmp ../dist/volume
../dist/volume.tar: ../dist/volume
cd ../dist/volume && pax -w -x ustar . >../volume.tar.tmp
mv ../dist/volume.tar.tmp ../dist/volume.tar
../dist/volume.tar.gz: ../dist/volume.tar
gzip -c <../dist/volume.tar >../dist/volume.tar.gz.tmp
mv ../dist/volume.tar.gz.tmp ../dist/volume.tar.gz
.PHONY: all clean sane

View File

@ -15,7 +15,7 @@ argv0="$0"
VOLUME_TMP_FILE="$HOME/.volume-previous"
if [ "$(uname)" = NetBSD ]; then
if streq "$(uname)" NetBSD; then
VOLUME_SYSTEM=netbsd
elif command -v pactl >/dev/null 2>&1; then
VOLUME_SYSTEM=pulseaudio
@ -52,12 +52,12 @@ case "$1" in
-) "$0" r -"$2" ;;
a*)
nonzero $2 && ! nonzero $3 && str isdigit "$2" \
str isvalue $2 && ! str isvalue $3 && str isdigit "$2" \
|| usage
"$0".$VOLUME_SYSTEM "$@"
;;
s*)
! nonzero $2 \
! str isvalue $2 \
|| usage
"$0".$VOLUME_SYSTEM s
;;
@ -68,9 +68,9 @@ d*)
$VOLUME_SYSTEM
;;
m*) [ -z "$2" ] || usage
m*) ! str isvalue "$2" || usage
# restore previous volume if there is one
if [ -e "$VOLUME_TMP_FILE" ]; then
if test -e "$VOLUME_TMP_FILE"; then
xargs "$0" a <"$VOLUME_TMP_FILE" \
&& rm "$VOLUME_TMP_FILE" \
&& printf "Unmuted.\n" \
@ -98,7 +98,7 @@ m*) [ -z "$2" ] || usage
exit 0 ;;
r*)
nonzero $2 && ! nonzero $3 \
str isvalue $2 && ! str isvalue $3 \
&& str isdigit "$(printf "%s\n" "$2" | sed 's/^\-//')" \
|| usage