Make handle-console-change more gentle

This commit is contained in:
Frank Denis
2012-07-30 13:49:22 -07:00
parent bad6220be7
commit a265d6cbda
+9 -5
View File
@@ -2,9 +2,13 @@
. ./common.inc
eval $(stat -s /dev/console) || exit 1
mkdir -p "$DNSCRYPT_BASE_DIR" || exit 1
chown -R 0:0 "$DNSCRYPT_BASE_DIR"
chown -R "${st_uid}:0" "$CONTROL_DIR"
eval $(stat -s '/dev/console') || exit 1
wanted_uid="$st_uid"
if [ ! -d "$DNSCRYPT_BASE_DIR" ]; then
mkdir -p "$DNSCRYPT_BASE_DIR" || exit 1
chown -R 0:0 "$DNSCRYPT_BASE_DIR"
fi
eval $(stat -s "$CONTROL_DIR") || exit 1
[ "$st_uid" = "$wanted_uid" ] && exit 0
chown -R "${wanted_uid}:0" "$CONTROL_DIR"
find "$DNSCRYPT_BASE_DIR" -type d -exec chmod 755 {} \;