• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

bootable/newinstaller


Commit MetaInfo

Revision15b7d4082bcd47c2420fe9cfe3b7ac3a91b16995 (tree)
Zeit2019-07-19 13:25:57
AutorChih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Log Message

lndir: set permission, owner, group of destination dir

Set them to be the same as the source dir if runs by root.

Ändern Zusammenfassung

Diff

--- a/initrd/bin/lndir
+++ b/initrd/bin/lndir
@@ -12,9 +12,19 @@ usage()
1212 exit 1
1313 }
1414
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+
1524 linkdir()
1625 {
1726 local odir="$PWD"
27+ make_dir "$1" "$2"
1828 [ -d "$2" ] || mkdir -p "$2"
1929 cd "$2"
2030 local d="$PWD"
@@ -31,6 +41,8 @@ linkdir()
3141 cd "$odir"
3242 }
3343
44+[ -d /system/bin ] && PATH=/system/bin:$PATH
45+
3446 [ -z "$src" ] && usage
3547
3648 [ ! -d "$src" ] && echo "$src is not a directory" && exit 2