summaryrefslogtreecommitdiff
path: root/pkgthing/.sh
diff options
context:
space:
mode:
Diffstat (limited to 'pkgthing/.sh')
-rw-r--r--pkgthing/.sh48
1 files changed, 48 insertions, 0 deletions
diff --git a/pkgthing/.sh b/pkgthing/.sh
new file mode 100644
index 0000000..4f5f784
--- /dev/null
+++ b/pkgthing/.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+lst=$1
+
+error() {
+ echo "$0:$@"
+ exit 1
+}
+
+useVar() {
+ var=$1
+ val=$2
+ case "$var" in
+ \$name) _name="$val";;
+ \$union) echo 'union feature not yet implemented';;
+ esac
+}
+
+setsrc() {
+ mount_point=$1
+ dev=$2
+ case "$dev" in
+ file://*) ln -s "${dev#file://}" "$mount_point";;
+ ftp://*) ln -s "/$dev" "$mount_point";;
+ *) error "I don't know which protocol to use for \`$dev'.";;
+ esac
+}
+
+# parse files
+_name='oops'
+while read line; do
+ if [ -n "$line" ]; then
+ case "$line" in
+ \#*) :;; # comment, do nothing
+ \$*) # setting a variable
+ var=${line%%=*}
+ val=${line#$var=}
+ useVar "$var" "$val"
+ :;;
+ *) # setting a source
+ grp=`echo "$line" | cut -f 1`
+ src=`echo "$line" | cut -f 2`
+ mkdir -p "$_name"
+ setsrc "$_name/$grp" "$src"
+ :;;
+ esac
+ fi
+done < "$lst"