ref: 681e67865a4f1ef968ea8dc981ac62279abef8ad
parent: 547c5c8703133571adfcba5da8adc5df512229fa
author: Anders Damsgaard <anders@adamsgaard.dk>
date: Wed Sep 15 08:51:23 EDT 2021
add uninstall make target and helper script
--- a/Makefile
+++ b/Makefile
@@ -35,6 +35,9 @@
install: all
$(SCRIPTDIR)/install $(PREFIX)
+uninstall:
+ $(SCRIPTDIR)/uninstall $(PREFIX)
+
clean:
xargs rm -rf < $(SCRIPTDIR)/libc-proto
rm -f dirs
--- /dev/null
+++ b/scripts/uninstall
@@ -1,0 +1,45 @@
+#!/bin/sh
+
+set -e
+
+for i
+do
+ case "$i" in
+ -p)
+ proto=$2
+ shift 2
+ ;;
+ -*)
+ echo 1=$1
+ echo usage: uninstall [-p proto] prefix >&2
+ exit 1
+ ;;
+ esac
+done
+
+prefix=${1?'prefix missed'}
+
+while read type perm name
+do
+ case $type in
+ d)
+ continue
+ ;;
+ f)
+ rm -f $prefix/$name
+ ;;
+ *)
+ echo install: wrong entry type >&2
+ exit 1
+ ;;
+ esac
+done < ${proto:-scripts/proto}
+
+while read type perm name
+do
+ case $type in
+ d)
+ rmdir $prefix/$name || :
+ ;;
+ esac
+done < ${proto:-scripts/proto}