cleaning moar
This commit is contained in:
parent
bbd82d9290
commit
8e455a7e3f
15
bin/abs
15
bin/abs
@ -1,15 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
! eq $# 1 \
|
|
||||||
&& printf "Usage: %b [integer]\n" "$0" >/dev/stderr \
|
|
||||||
&& exit 1
|
|
||||||
|
|
||||||
! stris int "$1" \
|
|
||||||
&& printf "%b: %b: Not an integer\n" "$0" "$1" >/dev/stderr \
|
|
||||||
&& exit 1
|
|
||||||
|
|
||||||
lt $1 0 \
|
|
||||||
&& printf "%b\n" $(multiply $1 -1) \
|
|
||||||
|| printf "%b\n" $1
|
|
||||||
|
|
||||||
exit 0
|
|
39
bin/mnt
39
bin/mnt
@ -1,39 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
set -e
|
|
||||||
|
|
||||||
DEV="/dev"
|
|
||||||
MNT="/media"
|
|
||||||
[ -n "$SUDO" ] || SUDO="doas"
|
|
||||||
|
|
||||||
# preliminary checks
|
|
||||||
[ -n "$2" ] || [ -z "$1" ] \
|
|
||||||
&& printf "Usage: %s [device in %s/]\n" \
|
|
||||||
"$0" "$DEV" 1>&2 \
|
|
||||||
&& exit 1 \
|
|
||||||
|| true
|
|
||||||
|
|
||||||
# no need to priviledge escalate if we're already root
|
|
||||||
! [ "$(id -u)" = 0 ] \
|
|
||||||
|| SUDO=""
|
|
||||||
|
|
||||||
# exhaustive checks to ensure $DEV/$1 exists and that $MNT/$1 can be safely used as a mountpoint
|
|
||||||
! [ -d "$MNT/$1" ] && [ -a "$MNT/$1" ] \
|
|
||||||
&& printf "%s: '%s/%s' already exists, but isn't a directory.\n" \
|
|
||||||
"$0" "$MNT" "$1" 1>&2 \
|
|
||||||
&& exit 1 \
|
|
||||||
|| true
|
|
||||||
[ -d "$MNT/$1" ] \
|
|
||||||
|| mkdir "$MNT/$1"
|
|
||||||
! [ "$(ls -A "$MNT/$1" | wc -l | xargs echo)" = 0 ] \
|
|
||||||
&& printf "%s: '%s/%s' is a directory, but isn't empty.\n" \
|
|
||||||
"$0" "$MNT" "$1" 1>&2 \
|
|
||||||
&& exit 1 \
|
|
||||||
|| true
|
|
||||||
! [ -e "/dev/$1" ] \
|
|
||||||
&& printf "%s: '%s/%s' doesn't exist.\n" \
|
|
||||||
"$0" "$DEV" "$1" 1>&2 \
|
|
||||||
&& exit 1 \
|
|
||||||
|| true
|
|
||||||
|
|
||||||
# ok, we're safe
|
|
||||||
"$SUDO" mount "$DEV/$1" "$MNT/$1"
|
|
13
bin/mod
13
bin/mod
@ -1,13 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
! eq $# 2 && printf "Usage: $0 [dividend] [divisor]\n" >/dev/stderr && exit 1
|
|
||||||
|
|
||||||
! stris int "$1" && printf "$0: $1: Not an integer\n" >/dev/stderr && exit 1
|
|
||||||
! stris int "$2" && printf "$0: $2: Not an integer\n" >/dev/stderr && exit 1
|
|
||||||
|
|
||||||
dividend=$1
|
|
||||||
divisor=$2
|
|
||||||
|
|
||||||
# (% a b) == (- a (* b (// a b)))
|
|
||||||
printf "%b\n" $(subtract $dividend $(multiply $divisor $(fdivide $dividend $divisor)))
|
|
||||||
exit 0
|
|
20
uwu/Makefile
Normal file
20
uwu/Makefile
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
all: ;
|
||||||
|
clean: ;
|
||||||
|
sane: ;
|
||||||
|
|
||||||
|
dist: ../dist/uwu.tar.gz
|
||||||
|
|
||||||
|
../dist/uwu: uwu
|
||||||
|
mkdir -p ../dist/uwu.tmp/bin/
|
||||||
|
cp uwu ../dist/uwu.tmp/bin/
|
||||||
|
mv ../dist/uwu.tmp ../dist/uwu
|
||||||
|
|
||||||
|
../dist/uwu.tar: ../dist/uwu
|
||||||
|
cd ../dist/uwu && pax -w -x ustar . >../uwu.tar.tmp
|
||||||
|
mv ../dist/uwu.tar.tmp ../dist/uwu.tar
|
||||||
|
|
||||||
|
../dist/uwu.tar.gz: ../dist/uwu.tar
|
||||||
|
gzip -c <../dist/uwu.tar >../dist/uwu.tar.gz.tmp
|
||||||
|
mv ../dist/uwu.tar.gz.tmp ../dist/uwu.tar.gz
|
||||||
|
|
||||||
|
.PHONY: all clean sane
|
Loading…
Reference in New Issue
Block a user