forked from mpg-age-bioinformatics/galaxy-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlib.sh
49 lines (45 loc) · 868 Bytes
/
lib.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
quit () { echo "error: $@" ; exit 65 ; }
update () {
local file
local target
file="$1"
target="$($sudo readlink -f $2)"
echo "* target $target"
if [[ -f $target ]]
then
d=$(diff $target $file)
else
d=$(diff <(echo -n "") $file)
fi
echo -n " diff ... "
if [[ -n $d ]]
then
echo -n "show? [y/n] "
read -n 1 key
echo -n " ... "
if [[ $key = y ]]
then
echo
echo
if [[ -f $target ]]
then
diff $target $file | sed 's/^/\ \ \ \ /'
else
diff <(echo -n "") $file | sed 's/^/\ \ \ \ /'
fi
echo
echo -n " ... "
fi
echo -n "update? [y/n] "
read -n 1 key
echo
if [[ $key = y ]]
then
mkdir -p $(dirname $target) || exit
install -m 664 -g $GA_GROUP $file $target || exit
fi
else
echo "none"
fi
}