bootable/newinstaller
Revision | 15b7d4082bcd47c2420fe9cfe3b7ac3a91b16995 (tree) |
---|---|
Zeit | 2019-07-19 13:25:57 |
Autor | Chih-Wei Huang <cwhuang@linu...> |
Commiter | Chih-Wei Huang |
lndir: set permission, owner, group of destination dir
Set them to be the same as the source dir if runs by root.
@@ -12,9 +12,19 @@ usage() | ||
12 | 12 | exit 1 |
13 | 13 | } |
14 | 14 | |
15 | +make_dir() | |
16 | +{ | |
17 | + [ -d "$2" ] || mkdir -p "$2" | |
18 | + if [ "`id -u`" = "0" ]; then | |
19 | + chmod `stat -c "%a" "$1"` "$2" | |
20 | + chown `stat -c "%u.%g" "$1"` "$2" | |
21 | + fi | |
22 | +} | |
23 | + | |
15 | 24 | linkdir() |
16 | 25 | { |
17 | 26 | local odir="$PWD" |
27 | + make_dir "$1" "$2" | |
18 | 28 | [ -d "$2" ] || mkdir -p "$2" |
19 | 29 | cd "$2" |
20 | 30 | local d="$PWD" |
@@ -31,6 +41,8 @@ linkdir() | ||
31 | 41 | cd "$odir" |
32 | 42 | } |
33 | 43 | |
44 | +[ -d /system/bin ] && PATH=/system/bin:$PATH | |
45 | + | |
34 | 46 | [ -z "$src" ] && usage |
35 | 47 | |
36 | 48 | [ ! -d "$src" ] && echo "$src is not a directory" && exit 2 |