summaryrefslogtreecommitdiff
path: root/test/rcup-standalone.t
diff options
context:
space:
mode:
Diffstat (limited to 'test/rcup-standalone.t')
-rw-r--r--test/rcup-standalone.t75
1 files changed, 75 insertions, 0 deletions
diff --git a/test/rcup-standalone.t b/test/rcup-standalone.t
new file mode 100644
index 0000000..7dd3b58
--- /dev/null
+++ b/test/rcup-standalone.t
@@ -0,0 +1,75 @@
+ $ . "$TESTDIR/helper.sh"
+
+-g generates a script
+
+ $ mkdir -p .dotfiles/eggplant_firetruck/lampshade
+ > touch .dotfiles/eggplant_firetruck/lampshade/bottle
+
+ $ rcup -g
+ #!/bin/sh
+ #
+ # Usage:
+ #
+ # sh install.sh
+ #
+ # Environment variables: VERBOSE, CP, LN, MKDIR, RM, DIRNAME, XARGS.
+ #
+ # env VERBOSE=1 sh install.sh
+ #
+ # DO NOT EDIT THIS FILE
+ #
+ # This file is generated by rcm(7) as:
+ #
+ # rcup -g
+ #
+ # To update it, re-run the above command.
+ #
+ : ${VERBOSE:=0}
+ : ${CP:=/bin/cp}
+ : ${LN:=/bin/ln}
+ : ${MKDIR:=/bin/mkdir}
+ : ${RM:=/bin/rm}
+ : ${DIRNAME:=/usr/bin/dirname}
+ : ${XARGS:=/usr/bin/xargs}
+ verbose() {
+ if [ "$VERBOSE" -gt 0 ]; then
+ echo "$@"
+ fi
+ }
+ handle_file_cp() {
+ if [ -e "$2" ]; then
+ printf "%s " "overwrite $2? [yN]"
+ read overwrite
+ case "$overwrite" in
+ y)
+ $RM -rf "$2"
+ ;;
+ *)
+ echo "skipping $2"
+ return
+ ;;
+ esac
+ fi
+ verbose "'$1' -> '$2'"
+ $DIRNAME "$2" | $XARGS $MKDIR -p
+ $CP -R "$1" "$2"
+ }
+ handle_file_ln() {
+ if [ -e "$2" ]; then
+ printf "%s " "overwrite $2? [yN]"
+ read overwrite
+ case "$overwrite" in
+ y)
+ $RM -rf "$2"
+ ;;
+ *)
+ echo "skipping $2"
+ return
+ ;;
+ esac
+ fi
+ verbose "'$1' -> '$2'"
+ $DIRNAME "$2" | $XARGS $MKDIR -p
+ $LN -sf "$1" "$2"
+ }
+ handle_file_ln "*eggplant_firetruck/lampshade/bottle" "*.eggplant_firetruck/lampshade/bottle" (glob)