From c75168e0c80564d40fd6f8e9d3c223a4bb0b1cb8 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 15 Dec 2022 15:32:26 +0100 Subject: [bwlp-stage4-tweaks] Move common files from rfs-stage32 to own module ... so we get them in the MaxiLinux stage4 builds too. --- core/modules/bwlp-stage4-tweaks/data/etc/profile | 69 ++++++++++++++++++++++ .../data/etc/tmpfiles.d/network.conf | 1 + .../bwlp-stage4-tweaks/data/opt/openslx/bin/penv | 7 +++ core/modules/bwlp-stage4-tweaks/module.build | 0 core/modules/bwlp-stage4-tweaks/module.conf | 0 core/rootfs/rootfs-stage32/data/etc/profile | 63 -------------------- .../data/etc/tmpfiles.d/network.conf | 1 - .../data/etc/tmpfiles.d/openslx-log.conf | 1 - .../rootfs-stage32/data/opt/openslx/bin/penv | 7 --- core/targets/bwlp/bwlp-stage4-tweaks | 1 + 10 files changed, 78 insertions(+), 72 deletions(-) create mode 100644 core/modules/bwlp-stage4-tweaks/data/etc/profile create mode 100644 core/modules/bwlp-stage4-tweaks/data/etc/tmpfiles.d/network.conf create mode 100755 core/modules/bwlp-stage4-tweaks/data/opt/openslx/bin/penv create mode 100644 core/modules/bwlp-stage4-tweaks/module.build create mode 100644 core/modules/bwlp-stage4-tweaks/module.conf delete mode 100644 core/rootfs/rootfs-stage32/data/etc/profile delete mode 100644 core/rootfs/rootfs-stage32/data/etc/tmpfiles.d/network.conf delete mode 100644 core/rootfs/rootfs-stage32/data/etc/tmpfiles.d/openslx-log.conf delete mode 100755 core/rootfs/rootfs-stage32/data/opt/openslx/bin/penv create mode 120000 core/targets/bwlp/bwlp-stage4-tweaks (limited to 'core') diff --git a/core/modules/bwlp-stage4-tweaks/data/etc/profile b/core/modules/bwlp-stage4-tweaks/data/etc/profile new file mode 100644 index 00000000..2fb2ee67 --- /dev/null +++ b/core/modules/bwlp-stage4-tweaks/data/etc/profile @@ -0,0 +1,69 @@ +# /etc/profile: system-wide .profile file for the Bourne shell (sh(1)) +# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...). +# XXX: Use `backticks` here instead of $(this stuff) as we don't know which shell is running... + +export UID=`id -u` 2> /dev/null + +# Stuff we might wanna know +PWENT= +[ -n "$UID" ] && PWENT=`getent passwd "$UID"` +[ -z "$PWENT" ] && [ -n "$USER" ] && PWENT=`getent passwd "$USER"` +if [ -n "$PWENT" ]; then + export USER=`echo "$PWENT" | awk -F ':' '{print $1}'` + export GID=`echo "$PWENT" | awk -F ':' '{print $4}'` + export HOME=`echo "$PWENT" | awk -F ':' '{print $6}'` + export GROUP=`id -gn` + export LOGNAME=$USER + export HOSTNAME=`hostname` +fi +unset PWENT + +if [ -L "/bin" ]; then + export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/opt/openslx/sbin:/opt/openslx/bin +else + export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/openslx/sbin:/opt/openslx/bin +fi + +# If running interactively, then: +if [ "${PS1-}" ]; then + + if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then + export PS1="[\u@\h \W]\\$ " + if [ -s /etc/bash.bashrc ]; then + . /etc/bash.bashrc + fi + if [ -s "$HOME/.bashrc" ]; then + . "$HOME/.bashrc" + fi + else + if [ "$UID" -eq 0 ]; then + export PS1='# ' + else + export PS1='$ ' + fi + fi + + export HISTSIZE=1000 + export HISTFILESIZE=1000 + export PAGER='/bin/less' + export EDITOR='/bin/vi' + export INPUTRC=/etc/inputrc + export TERMINFO='/lib/terminfo' + +fi + +# set TERM to xterm on SSH sessions +[ -n "$SSH_TTY" ] && export TERM=xterm + +# Source configuration files from /etc/profile.d +for i in /etc/profile.d/*.sh ; do + if [ -r "$i" ]; then + . "$i" + fi +done +unset i + +# Sourcing /etc/profile.local - please add custom stuff to profile.local +# as /etc/profile may be overwritten by system updates +test -s /etc/profile.local && . /etc/profile.local + diff --git a/core/modules/bwlp-stage4-tweaks/data/etc/tmpfiles.d/network.conf b/core/modules/bwlp-stage4-tweaks/data/etc/tmpfiles.d/network.conf new file mode 100644 index 00000000..346ecf7e --- /dev/null +++ b/core/modules/bwlp-stage4-tweaks/data/etc/tmpfiles.d/network.conf @@ -0,0 +1 @@ +d /run/network 0755 root root diff --git a/core/modules/bwlp-stage4-tweaks/data/opt/openslx/bin/penv b/core/modules/bwlp-stage4-tweaks/data/opt/openslx/bin/penv new file mode 100755 index 00000000..5d0c8dc7 --- /dev/null +++ b/core/modules/bwlp-stage4-tweaks/data/opt/openslx/bin/penv @@ -0,0 +1,7 @@ +#!/bin/ash + +[ "$#" -ne "1" ] && echo "Usage: $0 PID" && exit 1 +[ ! -e "/proc/$1/environ" ] && echo "No such process: $1" && exit 1 +[ ! -r "/proc/$1/environ" ] && echo "Cannot open process: $1" && exit 1 +sed 's/\x0/\n/g' "/proc/$1/environ" | grep -E --color=auto '^[^=]*' + diff --git a/core/modules/bwlp-stage4-tweaks/module.build b/core/modules/bwlp-stage4-tweaks/module.build new file mode 100644 index 00000000..e69de29b diff --git a/core/modules/bwlp-stage4-tweaks/module.conf b/core/modules/bwlp-stage4-tweaks/module.conf new file mode 100644 index 00000000..e69de29b diff --git a/core/rootfs/rootfs-stage32/data/etc/profile b/core/rootfs/rootfs-stage32/data/etc/profile deleted file mode 100644 index b50b1693..00000000 --- a/core/rootfs/rootfs-stage32/data/etc/profile +++ /dev/null @@ -1,63 +0,0 @@ -# /etc/profile: system-wide .profile file for the Bourne shell (sh(1)) -# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...). -# XXX: Use `backticks` here instead of $(this stuff) as we don't know which shell is running... - -export UID=`id -u` 2> /dev/null - -# Stuff we might wanna know -PWENT= -[ -n "$UID" ] && PWENT=`getent passwd "$UID"` -[ -z "$PWENT" ] && [ -n "$USER" ] && PWENT=`getent passwd "$USER"` -if [ -n "$PWENT" ]; then - export USER=`echo "$PWENT" | awk -F ':' '{print $1}'` - export GID=`echo "$PWENT" | awk -F ':' '{print $4}'` - export HOME=`echo "$PWENT" | awk -F ':' '{print $6}'` - export GROUP=`id -gn` - export LOGNAME=$USER - export HOSTNAME=`hostname` -fi -unset PWENT - -# If running interactively, then: -if [ "${PS1-}" ]; then - - if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then - export PS1="[\u@\h \W]\\$ " - if [ -s /etc/bash.bashrc ]; then - . /etc/bash.bashrc - fi - if [ -s "$HOME/.bashrc" ]; then - . "$HOME/.bashrc" - fi - else - if [ "$UID" -eq 0 ]; then - export PS1='# ' - else - export PS1='$ ' - fi - fi - - export HISTSIZE=1000 - export HISTFILESIZE=1000 - export PAGER='/bin/less' - export EDITOR='/bin/vi' - export INPUTRC=/etc/inputrc - export TERMINFO='/lib/terminfo' - -fi - -# set TERM to xterm on SSH sessions -[ -n "$SSH_TTY" ] && export TERM=xterm - -# Source configuration files from /etc/profile.d -for i in /etc/profile.d/*.sh ; do - if [ -r "$i" ]; then - . "$i" - fi -done -unset i - -# Sourcing /etc/profile.local - please add custom stuff to profile.local -# as /etc/profile may be overwritten by system updates -test -s /etc/profile.local && . /etc/profile.local - diff --git a/core/rootfs/rootfs-stage32/data/etc/tmpfiles.d/network.conf b/core/rootfs/rootfs-stage32/data/etc/tmpfiles.d/network.conf deleted file mode 100644 index 346ecf7e..00000000 --- a/core/rootfs/rootfs-stage32/data/etc/tmpfiles.d/network.conf +++ /dev/null @@ -1 +0,0 @@ -d /run/network 0755 root root diff --git a/core/rootfs/rootfs-stage32/data/etc/tmpfiles.d/openslx-log.conf b/core/rootfs/rootfs-stage32/data/etc/tmpfiles.d/openslx-log.conf deleted file mode 100644 index 4d93fb9c..00000000 --- a/core/rootfs/rootfs-stage32/data/etc/tmpfiles.d/openslx-log.conf +++ /dev/null @@ -1 +0,0 @@ -d /var/log/openslx 0777 root root diff --git a/core/rootfs/rootfs-stage32/data/opt/openslx/bin/penv b/core/rootfs/rootfs-stage32/data/opt/openslx/bin/penv deleted file mode 100755 index 5d0c8dc7..00000000 --- a/core/rootfs/rootfs-stage32/data/opt/openslx/bin/penv +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/ash - -[ "$#" -ne "1" ] && echo "Usage: $0 PID" && exit 1 -[ ! -e "/proc/$1/environ" ] && echo "No such process: $1" && exit 1 -[ ! -r "/proc/$1/environ" ] && echo "Cannot open process: $1" && exit 1 -sed 's/\x0/\n/g' "/proc/$1/environ" | grep -E --color=auto '^[^=]*' - diff --git a/core/targets/bwlp/bwlp-stage4-tweaks b/core/targets/bwlp/bwlp-stage4-tweaks new file mode 120000 index 00000000..55fc3198 --- /dev/null +++ b/core/targets/bwlp/bwlp-stage4-tweaks @@ -0,0 +1 @@ +../../modules/bwlp-stage4-tweaks \ No newline at end of file -- cgit v1.2.3-55-g7522