openwrt/package/base-files/files/etc/profile
Konstantin Demin 9b7ffed9eb
Some checks are pending
Build all core packages / Build all core packages for selected target (push) Waiting to run
base-files: allow to skip unwanted scripts
this change allows one to selectively "hush" scripts from /etc/profile.d/ directory.
e.g., to skip "opkg to apk cheatsheet" message ("/etc/profile.d/apk-cheatsheet.sh") create empty file "/etc/profile.d/apk-cheatsheet.hush" using, for example, command "touch /etc/profile.d/apk-cheatsheet.hush"

Signed-off-by: Konstantin Demin <rockdrilla@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/19953
Signed-off-by: Robert Marko <robimarko@gmail.com>
2025-11-20 17:48:18 +01:00

39 lines
897 B
Bash

unset FAILSAFE
[ -e /tmp/.failsafe ] && export FAILSAFE=1
[ -f /etc/banner ] && cat /etc/banner
[ -n "$FAILSAFE" ] && [ -f /etc/banner.failsafe ] && cat /etc/banner.failsafe
if grep -Fsq '/ overlay ro,' /proc/mounts ; then
cat << EOF
=== WARNING! ======================================
Your JFFS2-partition seems full and overlayfs is
mounted as READ-ONLY!
Please try to remove files from /overlay/upper/...
and reboot!
---------------------------------------------------
EOF
fi
export PATH="%PATH%"
HOME=$(grep -E "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6)
HOME=${HOME:-/root}
export HOME
export PS1='\u@\h:\w\$ '
export ENV=/etc/shinit
case "$TERM" in
xterm*|rxvt*)
export PS1='\[\e]0;\u@\h: \w\a\]'"$PS1"
;;
esac
if [ -z "$FAILSAFE" ] ; then
for FILE in /etc/profile.d/*.sh ; do
[ -f "${FILE%.sh}.hush" ] && continue
[ -f "$FILE" ] && . "$FILE"
done
unset FILE
fi