* Update buildroot-patches for 2020.11-rc1 buildroot * Update buildroot to 2020.11-rc1 Signed-off-by: Stefan Agner <stefan@agner.ch> * Don't rely on sfdisk --list-free output The --list-free (-F) argument does not allow machine readable mode. And it seems that the output format changes over time (different spacing, using size postfixes instead of raw blocks). Use sfdisk json output and calculate free partition space ourselfs. This works for 2.35 and 2.36 and is more robust since we rely on output which is meant for scripts to parse. * Migrate defconfigs for Buildroot 2020.11-rc1 In particular, rename BR2_TARGET_UBOOT_BOOT_SCRIPT(_SOURCE) to BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT(_SOURCE). * Rebase/remove systemd patches for systemd 246 * Drop apparmor/libapparmor from buildroot-external * hassos-persists: use /run as directory for lockfiles The U-Boot tools use /var/lock by default which is not created any more by systemd by default (it is under tmpfiles legacy.conf, which we no longer install). * Disable systemd-update-done.service The service is not suited for pure read-only systems. In particular the service needs to be able to write a file in /etc and /var. Remove the service. Note: This is a static service and cannot be removed using systemd-preset. * Disable apparmor.service for now The service loads all default profiles. Some might actually cause problems. E.g. the profile for ping seems not to match our setup for /etc/resolv.conf: [85503.634653] audit: type=1400 audit(1605286002.684:236): apparmor="DENIED" operation="open" profile="ping" name="/run/resolv.conf" pid=27585 comm="ping" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
94 lines
3.6 KiB
Diff
94 lines
3.6 KiB
Diff
From 4a950257fa353e27ef1bd753bca4d0279f41bc77 Mon Sep 17 00:00:00 2001
|
|
From: Michal Vasko <mvasko@cesnet.cz>
|
|
Date: Mon, 24 Aug 2020 13:47:40 +0200
|
|
Subject: [PATCH] scripts FEATURE support using current user for SR modules
|
|
|
|
Mostly for special cases user/group configuration
|
|
when the user/group cannot be retrieved normally.
|
|
|
|
Fixes #701
|
|
---
|
|
CMakeLists.txt | 10 +++++-----
|
|
scripts/setup.sh | 23 +++++++++++++++++++----
|
|
2 files changed, 24 insertions(+), 9 deletions(-)
|
|
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index 77aea1f..8fd6b43 100755
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -68,19 +68,19 @@ if(NOT MODULES_OWNER)
|
|
OUTPUT_VARIABLE MODULES_OWNER OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
ERROR_VARIABLE ERROR_STR OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
if(RET)
|
|
- message(FATAL_ERROR "Learning server module user failed: ${ERROR_STR}")
|
|
+ message(WARNING "Learning server module user failed (${ERROR_STR}), the current user will be used.")
|
|
endif()
|
|
endif()
|
|
-set(MODULES_OWNER "${MODULES_OWNER}" CACHE STRING "System user that will become the owner of server modules")
|
|
-if(NOT MODULES_GROUP)
|
|
+set(MODULES_OWNER "${MODULES_OWNER}" CACHE STRING "System user that will become the owner of server modules, empty means the current user")
|
|
+if(NOT MODULES_GROUP AND MODULES_OWNER)
|
|
execute_process(COMMAND id -gn ${MODULES_OWNER} RESULT_VARIABLE RET
|
|
OUTPUT_VARIABLE MODULES_GROUP OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
ERROR_VARIABLE ERROR_STR OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
if(RET)
|
|
- message(FATAL_ERROR "Learning server module group failed: ${ERROR_STR}")
|
|
+ message(WARNING "Learning server module group failed (${ERROR_STR}), the current user group will be used.")
|
|
endif()
|
|
endif()
|
|
-set(MODULES_GROUP "${MODULES_GROUP}" CACHE STRING "System group that the server modules will belong to")
|
|
+set(MODULES_GROUP "${MODULES_GROUP}" CACHE STRING "System group that the server modules will belong to, empty means the current user group")
|
|
|
|
# set prefix for the PID file
|
|
if(NOT PIDFILE_PREFIX)
|
|
diff --git a/scripts/setup.sh b/scripts/setup.sh
|
|
index 9591a49..b7c7ba4 100755
|
|
--- a/scripts/setup.sh
|
|
+++ b/scripts/setup.sh
|
|
@@ -1,7 +1,8 @@
|
|
#!/bin/bash
|
|
|
|
-# env variables NP2_MODULE_DIR, NP2_MODULE_PERMS, NP2_MODULE_OWNER, NP2_MODULE_GROUP must be defined when executing this script!
|
|
-if [ -z "$NP2_MODULE_DIR" -o -z "$NP2_MODULE_PERMS" -o -z "$NP2_MODULE_OWNER" -o -z "$NP2_MODULE_GROUP" ]; then
|
|
+# env variables NP2_MODULE_DIR, NP2_MODULE_PERMS must be defined and NP2_MODULE_OWNER, NP2_MODULE_GROUP will be used if
|
|
+# defined when executing this script!
|
|
+if [ -z "$NP2_MODULE_DIR" -o -z "$NP2_MODULE_PERMS" ]; then
|
|
echo "Required environment variables not defined!"
|
|
exit 1
|
|
fi
|
|
@@ -37,7 +38,14 @@ MODULES=(
|
|
|
|
# functions
|
|
INSTALL_MODULE() {
|
|
- "$SYSREPOCTL" -a -i $MODDIR/$1 -s "$MODDIR" -p "$PERMS" -o "$OWNER" -g "$GROUP" -v2
|
|
+ CMD="'$SYSREPOCTL' -a -i $MODDIR/$1 -s '$MODDIR' -p '$PERMS' -v2"
|
|
+ if [ ! -z ${OWNER} ]; then
|
|
+ CMD="$CMD -o '$OWNER'"
|
|
+ fi
|
|
+ if [ ! -z ${GROUP} ]; then
|
|
+ CMD="$CMD -g '$GROUP'"
|
|
+ fi
|
|
+ eval $CMD
|
|
local rc=$?
|
|
if [ $rc -ne 0 ]; then
|
|
exit $rc
|
|
@@ -45,7 +53,14 @@ INSTALL_MODULE() {
|
|
}
|
|
|
|
UPDATE_MODULE() {
|
|
- "$SYSREPOCTL" -a -U $MODDIR/$1 -s "$MODDIR" -p "$PERMS" -o "$OWNER" -g "$GROUP" -v2
|
|
+ CMD="'$SYSREPOCTL' -a -U $MODDIR/$1 -s '$MODDIR' -p '$PERMS' -v2"
|
|
+ if [ ! -z ${OWNER} ]; then
|
|
+ CMD="$CMD -o '$OWNER'"
|
|
+ fi
|
|
+ if [ ! -z ${GROUP} ]; then
|
|
+ CMD="$CMD -g '$GROUP'"
|
|
+ fi
|
|
+ eval $CMD
|
|
local rc=$?
|
|
if [ $rc -ne 0 ]; then
|
|
exit $rc
|
|
--
|
|
2.20.1
|
|
|