From cae8b499429d5b3bf45fb8f324d6ae94e9c43ef3 Mon Sep 17 00:00:00 2001 From: MilhouseVH Date: Thu, 23 Mar 2017 18:59:11 +0000 Subject: [PATCH] userconfig: overwrite our sample files --- packages/sysutils/systemd/package.mk | 1 + .../sysutils/systemd/scripts/userconfig-setup | 26 +++++++++++++++++++ .../systemd/system.d/userconfig.service | 2 +- 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100755 packages/sysutils/systemd/scripts/userconfig-setup diff --git a/packages/sysutils/systemd/package.mk b/packages/sysutils/systemd/package.mk index 713a21887e6..e91e1887819 100644 --- a/packages/sysutils/systemd/package.mk +++ b/packages/sysutils/systemd/package.mk @@ -196,6 +196,7 @@ post_makeinstall_target() { rm -rf $INSTALL/usr/bin/systemd-machine-id-setup mkdir -p $INSTALL/usr/bin cp $PKG_DIR/scripts/systemd-machine-id-setup $INSTALL/usr/bin + cp $PKG_DIR/scripts/userconfig-setup $INSTALL/usr/bin # provide 'halt', 'shutdown', 'reboot' & co. mkdir -p $INSTALL/usr/sbin diff --git a/packages/sysutils/systemd/scripts/userconfig-setup b/packages/sysutils/systemd/scripts/userconfig-setup new file mode 100755 index 00000000000..60992d60496 --- /dev/null +++ b/packages/sysutils/systemd/scripts/userconfig-setup @@ -0,0 +1,26 @@ +#!/bin/sh +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2017 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 . +################################################################################ + +# Remove those sample files that we manage +for sample in $(find /storage/.config -name '*.sample' 2>/dev/null); do + [ -f /usr/config/${sample:16} ] && rm -f ${sample} +done + +# Copy config files, but don't overwrite - this should replace our sample files +false | cp -iRp /usr/config/* /storage/.config/ &>/dev/null diff --git a/packages/sysutils/systemd/system.d/userconfig.service b/packages/sysutils/systemd/system.d/userconfig.service index 1e02f8e43d4..2117d8957f7 100644 --- a/packages/sysutils/systemd/system.d/userconfig.service +++ b/packages/sysutils/systemd/system.d/userconfig.service @@ -5,7 +5,7 @@ After=systemd-tmpfiles-setup.service [Service] Type=oneshot -ExecStart=/bin/sh -c "false | cp -iR /usr/config/* /storage/.config/ &>/dev/null" +ExecStart=/usr/bin/userconfig-setup RemainAfterExit=yes [Install]