diff options
author | Tobias K <3knoeppl@informatik.uni-hamburg.de> | 2018-12-23 05:19:47 +0300 |
---|---|---|
committer | nacho <nacho@ownyourbits.com> | 2018-12-28 20:02:50 +0300 |
commit | 2e9440d9ce88926d9edc3c4843cfefadea60b271 (patch) | |
tree | 56c6e3ac1682ade9560e818142a71eccbcc63a6f /etc | |
parent | e87c9722251dc089202ce3f9ae2e48b727a10f89 (diff) |
log2ram: adapt to new name in armbian (#749)v0.67.10
Diffstat (limited to 'etc')
-rw-r--r-- | etc/ncp-config.d/nc-ramlogs.sh | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/etc/ncp-config.d/nc-ramlogs.sh b/etc/ncp-config.d/nc-ramlogs.sh index 5e01d158..cbca9a82 100644 --- a/etc/ncp-config.d/nc-ramlogs.sh +++ b/etc/ncp-config.d/nc-ramlogs.sh @@ -19,6 +19,21 @@ is_active() systemctl -q is-active log2ram &>/dev/null } +find_unit_name() +{ + UNIT_NAME="" + entry=$(systemctl list-unit-files --no-pager | grep -e ramlog) + if [[ -z "$entry" ]] + then + UNIT_NAME="" + elif [[ $entry == *armbian-ramlog* ]] + then + UNIT_NAME=armbian-ramlog + else + UNIT_NAME=log2ram + fi +} + install() { [[ -d /var/log.hdd ]] || [[ -d /var/hdd.log ]] && { echo "log2ram detected, not installing"; return; } @@ -36,14 +51,20 @@ install() configure() { + find_unit_name + if [[ -z "$UNIT_NAME" ]] + then + echo "ERROR: log2ram service not found!" + fi + [[ $ACTIVE_ != "yes" ]] && { - systemctl disable log2ram - systemctl stop log2ram + systemctl disable "$UNIT_NAME" + systemctl stop "$UNIT_NAME" echo "Logs in SD. Reboot to take effect" return } - systemctl enable log2ram - systemctl start log2ram + systemctl enable "$UNIT_NAME" + systemctl start "$UNIT_NAME" echo "Logs in RAM. Reboot to take effect" } @@ -64,4 +85,3 @@ configure() # along with this script; if not, write to the # Free Software Foundation, Inc., 59 Temple Place, Suite 330, # Boston, MA 02111-1307 USA - |