Merge pull request #4065 from MilhouseVH/le10_ssh_env

image: add /etc/environment
This commit is contained in:
Christian Hewitt 2020-01-08 19:25:34 +04:00 committed by GitHub
commit e2a591b5ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 99 additions and 0 deletions

View File

@ -0,0 +1,36 @@
From 8c8803dc15ea7820f0f980bc12fcea2c7b8c4487 Mon Sep 17 00:00:00 2001
From: MilhouseVH <milhouseVH.github@nmacleod.com>
Date: Tue, 17 Dec 2019 15:51:23 +0000
Subject: [PATCH] refresh /etc/environment on install and uninstall
---
xbmc/addons/Addon.cpp | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/xbmc/addons/Addon.cpp b/xbmc/addons/Addon.cpp
index 8a4bd0b..1046ab4 100644
--- a/xbmc/addons/Addon.cpp
+++ b/xbmc/addons/Addon.cpp
@@ -443,6 +443,9 @@ void OnPostInstall(const AddonPtr& addon, bool update, bool modal)
// OE
addon->OnPostInstall(update, modal);
+
+ if (addon->Type() == ADDON_SERVICE || addon->Type() == ADDON_SCRIPT)
+ system("/usr/bin/environment-setup");
}
void OnPreUnInstall(const AddonPtr& addon)
@@ -455,6 +458,9 @@ void OnPreUnInstall(const AddonPtr& addon)
void OnPostUnInstall(const AddonPtr& addon)
{
addon->OnPostUnInstall();
+
+ if (addon->Type() == ADDON_SERVICE || addon->Type() == ADDON_SCRIPT)
+ system("/usr/bin/environment-setup");
}
} /* namespace ADDON */
--
2.20.1

View File

@ -0,0 +1,32 @@
From c05ee9208db5e25d550ec6dd4b5ff54a199959fd Mon Sep 17 00:00:00 2001
From: MilhouseVH <milhouseVH.github@nmacleod.com>
Date: Mon, 16 Dec 2019 20:34:22 +0000
Subject: [PATCH] openssh: source /etc/environment
---
session.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/session.c b/session.c
index ac06b08..0a1c59a 100644
--- a/session.c
+++ b/session.c
@@ -1080,7 +1080,6 @@ do_setup_env(struct ssh *ssh, Session *s, const char *shell)
child_set_env(&env, &envsize, "KRB5CCNAME", cp);
}
-#ifdef _AIX
{
char *cp;
@@ -1089,7 +1088,6 @@ do_setup_env(struct ssh *ssh, Session *s, const char *shell)
read_environment_file(&env, &envsize, "/etc/environment",
options.permit_user_env_whitelist);
}
-#endif
#ifdef KRB5
if (s->authctxt->krb5_ccname)
child_set_env(&env, &envsize, "KRB5CCNAME",
--
2.7.4

View File

@ -205,6 +205,7 @@ post_makeinstall_target() {
cp $PKG_DIR/scripts/systemd-machine-id-setup $INSTALL/usr/bin
cp $PKG_DIR/scripts/userconfig-setup $INSTALL/usr/bin
cp $PKG_DIR/scripts/usercache-setup $INSTALL/usr/bin
cp $PKG_DIR/scripts/environment-setup $INSTALL/usr/bin
# use systemd to set cpufreq governor and tunables
find_file_path scripts/cpufreq && cp -PRv $FOUND_PATH $INSTALL/usr/bin
@ -217,6 +218,7 @@ post_makeinstall_target() {
# /etc/resolv.conf and /etc/hosts must be writable
ln -sf /run/libreelec/resolv.conf $INSTALL/etc/resolv.conf
ln -sf /run/libreelec/hosts $INSTALL/etc/hosts
ln -sf /run/libreelec/environment $INSTALL/etc/environment
# provide 'halt', 'shutdown', 'reboot' & co.
ln -sf /usr/bin/systemctl $INSTALL/usr/sbin/halt
@ -276,6 +278,7 @@ post_install() {
enable_service debugconfig.service
enable_service userconfig.service
enable_service usercache.service
enable_service envconfig.service
enable_service kernel-overlays.service
enable_service hwdb.service
enable_service cpufreq.service

View File

@ -0,0 +1,16 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv)
# read config files
for config in /etc/profile.d/*; do
if [ -f "$config" ] ; then
. $config
fi
done
# generate system-wide environment file
cat <<EOF >/run/libreelec/environment
PATH=${PATH}
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
EOF

View File

@ -0,0 +1,12 @@
[Unit]
Description=Generate system-wide /etc/environment file
DefaultDependencies=no
After=systemd-tmpfiles-setup.service
[Service]
Type=oneshot
ExecStart=/usr/bin/environment-setup
RemainAfterExit=yes
[Install]
WantedBy=sysinit.target