mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-29 13:46:49 +00:00
Merge pull request #2316 from MilhouseVH/le90_fix_shadow_is_garbage
shadow: detect corrupt content
This commit is contained in:
commit
d4b12d4ff0
@ -25,8 +25,13 @@ if [ -f /storage/.cache/shadow -a -f /usr/cache/shadow ]; then
|
|||||||
# Get existing root details (possibly user defined)
|
# Get existing root details (possibly user defined)
|
||||||
userroot="$(grep "^root:" /storage/.cache/shadow)"
|
userroot="$(grep "^root:" /storage/.cache/shadow)"
|
||||||
|
|
||||||
# Overwrite users shadow file with default details, but replacing root with any existing value
|
# Overwrite users shadow file with default details, replacing root with any existing value
|
||||||
[ -n "${userroot}" ] && sed -e "s ^root:.* ${userroot} " /usr/cache/shadow >/storage/.cache/shadow
|
# If current file is garbage (ie. missing root) then replace it
|
||||||
|
if [ -n "${userroot}" ]; then
|
||||||
|
sed -e "s ^root:.* ${userroot} " /usr/cache/shadow >/storage/.cache/shadow
|
||||||
|
else
|
||||||
|
cp -fp /usr/cache/shadow /storage/.cache/shadow
|
||||||
|
fi
|
||||||
|
|
||||||
# Make sure we have the correct permission
|
# Make sure we have the correct permission
|
||||||
chmod 000 /storage/.cache/shadow
|
chmod 000 /storage/.cache/shadow
|
||||||
|
Loading…
x
Reference in New Issue
Block a user