OSDN Git Service

0d8e531198cd459e30abc9a72a1484973bd85456
[instantos/instantARCH.git] / iroot.sh
1 #!/bin/bash
2
3 # utility to manage installer variables
4
5 IROOT="${IROOT:-/root/instantARCH/config}"
6
7 if [ -z "$1" ]; then
8     echo "usage: 
9 set value:    iroot field value
10 get value:    iroot field
11 remove/stdin: iroot r/i field"
12     exit
13 fi
14
15 if [ "$1" = "i" ]; then
16     cat /dev/stdin >"$IROOT/$2"
17 elif [ "$1" = "r" ]; then
18     [ -e "$IROOT/$2" ] && rm "$IROOT/$2"
19 elif [ -n "$2" ]; then
20     echo "$2" >"$IROOT/$1"
21 else
22     if [ -e "$IROOT/$1" ]; then
23         cat "$IROOT/$1"
24     else
25         exit 1
26     fi
27 fi