mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-28 13:16:41 +00:00
shadow: add usercache-setup and usercache service
This commit is contained in:
parent
dc30a81d1c
commit
8653021842
@ -202,6 +202,7 @@ post_makeinstall_target() {
|
|||||||
mkdir -p $INSTALL/usr/bin
|
mkdir -p $INSTALL/usr/bin
|
||||||
cp $PKG_DIR/scripts/systemd-machine-id-setup $INSTALL/usr/bin
|
cp $PKG_DIR/scripts/systemd-machine-id-setup $INSTALL/usr/bin
|
||||||
cp $PKG_DIR/scripts/userconfig-setup $INSTALL/usr/bin
|
cp $PKG_DIR/scripts/userconfig-setup $INSTALL/usr/bin
|
||||||
|
cp $PKG_DIR/scripts/usercache-setup $INSTALL/usr/bin
|
||||||
|
|
||||||
mkdir -p $INSTALL/usr/sbin
|
mkdir -p $INSTALL/usr/sbin
|
||||||
cp $PKG_DIR/scripts/kernel-overlays-setup $INSTALL/usr/sbin
|
cp $PKG_DIR/scripts/kernel-overlays-setup $INSTALL/usr/sbin
|
||||||
@ -255,6 +256,7 @@ post_install() {
|
|||||||
enable_service machine-id.service
|
enable_service machine-id.service
|
||||||
enable_service debugconfig.service
|
enable_service debugconfig.service
|
||||||
enable_service userconfig.service
|
enable_service userconfig.service
|
||||||
|
enable_service usercache.service
|
||||||
enable_service kernel-overlays.service
|
enable_service kernel-overlays.service
|
||||||
enable_service hwdb.service
|
enable_service hwdb.service
|
||||||
}
|
}
|
||||||
|
33
packages/sysutils/systemd/scripts/usercache-setup
Executable file
33
packages/sysutils/systemd/scripts/usercache-setup
Executable file
@ -0,0 +1,33 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
################################################################################
|
||||||
|
# This file is part of LibreELEC - https://libreelec.tv
|
||||||
|
# Copyright (C) 2017-present Team LibreELEC
|
||||||
|
#
|
||||||
|
# LibreELEC is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# LibreELEC is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
# Copy cache files, but don't overwrite
|
||||||
|
false | cp -iRp /usr/cache/* /storage/.cache/ &>/dev/null
|
||||||
|
|
||||||
|
# Merge default and custom shadow file details
|
||||||
|
if [ -f /storage/.cache/shadow -a -f /usr/cache/shadow ]; then
|
||||||
|
# Get existing root details (possibly user defined)
|
||||||
|
userroot="$(grep "^root:" /storage/.cache/shadow)"
|
||||||
|
|
||||||
|
# Overwrite users shadow file with default details, but replacing root with any existing value
|
||||||
|
[ -n "${userroot}" ] && sed -e "s ^root:.* ${userroot} " /usr/cache/shadow >/storage/.cache/shadow
|
||||||
|
|
||||||
|
# Make sure we have the correct permission
|
||||||
|
chmod 000 /storage/.cache/shadow
|
||||||
|
fi
|
12
packages/sysutils/systemd/system.d/usercache.service
Normal file
12
packages/sysutils/systemd/system.d/usercache.service
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Setup User cache dir
|
||||||
|
DefaultDependencies=no
|
||||||
|
After=systemd-tmpfiles-setup.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/usr/bin/usercache-setup
|
||||||
|
RemainAfterExit=yes
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=sysinit.target
|
Loading…
x
Reference in New Issue
Block a user