From 1a0959a6b769e8777e175d123a61b2001d03b733 Mon Sep 17 00:00:00 2001 From: lixiaoyong Date: Tue, 6 Sep 2022 15:35:39 +0800 Subject: [PATCH] conf: set umask value * set umask value as 077 to meet security configuration requirements * profile and dot.bashrc are from poky, just modidied umask value ISSUE: https://gitee.com/openeuler/yocto-meta-openeuler/issues/I5PIEI Signed-off-by: lixiaoyong --- .../base-files/base-files/profile | 66 +++++++++++++++++++ .../base-files/base-files/share/dot.bashrc | 16 +++++ 2 files changed, 82 insertions(+) create mode 100644 meta-openeuler/recipes-core/base-files/base-files/profile create mode 100644 meta-openeuler/recipes-core/base-files/base-files/share/dot.bashrc diff --git a/meta-openeuler/recipes-core/base-files/base-files/profile b/meta-openeuler/recipes-core/base-files/base-files/profile new file mode 100644 index 00000000000..b03b2ba392f --- /dev/null +++ b/meta-openeuler/recipes-core/base-files/base-files/profile @@ -0,0 +1,66 @@ +# /etc/profile: system-wide .profile file for the Bourne shell (sh(1)) +# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...). + +PATH="/usr/local/bin:/usr/bin:/bin" +[ "$TERM" ] || TERM="vt100" # Basic terminal capab. For screen etc. + +# Add /sbin & co to $PATH for the root user +[ "$HOME" != "ROOTHOME" ] || PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin + +# Set the prompt for bash and ash (no other shells known to be in use here) +[ -z "$PS1" ] || PS1='\u@\h:\w\$ ' + +if [ -d /etc/profile.d ]; then + for i in /etc/profile.d/*.sh; do + if [ -f $i -a -r $i ]; then + . $i + fi + done + unset i +fi + +if [ -t 0 -a $# -eq 0 ]; then + if [ ! -x @BINDIR@/resize ] ; then + if [ -n "$BASH_VERSION" ] ; then +# Optimized resize funciton for bash +resize() { + local x y + IFS='[;' read -t 2 -p $(printf '\e7\e[r\e[999;999H\e[6n\e8') -sd R _ y x _ + [ -n "$y" ] && \ + echo -e "COLUMNS=$x;\nLINES=$y;\nexport COLUMNS LINES;" && \ + stty cols $x rows $y +} + else +# Portable resize function for ash/bash/dash/ksh +# with subshell to avoid local variables +resize() { + (o=$(stty -g) + stty -echo raw min 0 time 2 + printf '\0337\033[r\033[999;999H\033[6n\0338' + if echo R | read -d R x 2> /dev/null; then + IFS='[;R' read -t 2 -d R -r z y x _ + else + IFS='[;R' read -r _ y x _ + fi + stty "$o" + [ -z "$y" ] && y=${z##*[}&&x=${y##*;}&&y=${y%%;*} + [ -n "$y" ] && \ + echo "COLUMNS=$x;"&&echo "LINES=$y;"&&echo "export COLUMNS LINES;"&& \ + stty cols $x rows $y) +} + fi + fi + # Use the EDITOR not being set as a trigger to call resize + # and only do this for /dev/tty[A-z] which are typically + # serial ports + if [ -z "$EDITOR" -a "$SHLVL" = 1 ] ; then + case $(tty 2>/dev/null) in + /dev/tty[A-z]*) resize >/dev/null;; + esac + fi +fi + +EDITOR="vi" # needed for packages like cron, git-commit +export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM + +umask 077 diff --git a/meta-openeuler/recipes-core/base-files/base-files/share/dot.bashrc b/meta-openeuler/recipes-core/base-files/base-files/share/dot.bashrc new file mode 100644 index 00000000000..7cd7d7deb3f --- /dev/null +++ b/meta-openeuler/recipes-core/base-files/base-files/share/dot.bashrc @@ -0,0 +1,16 @@ +# ~/.bashrc: executed by bash(1) for non-login shells. + +export PS1='\h:\w\$ ' +umask 077 + +# You may uncomment the following lines if you want `ls' to be colorized: +# export LS_OPTIONS='--color=auto' +# eval `dircolors` +# alias ls='ls $LS_OPTIONS' +# alias ll='ls $LS_OPTIONS -l' +# alias l='ls $LS_OPTIONS -lA' +# +# Some more alias to avoid making mistakes: +# alias rm='rm -i' +# alias cp='cp -i' +# alias mv='mv -i' -- Gitee