add auto color bash prompt and auto color ls to autoconfiguration, move adjustment of /etc/profile to /etc/profile.d/ files

This commit is contained in:
Tobias Powalowski 2023-01-29 09:14:11 +01:00
parent b90f8705b0
commit f807994905
5 changed files with 33 additions and 5 deletions

View file

@ -236,4 +236,19 @@ _auto_nano_syntax() {
grep -q '^include' "${_DESTDIR}/etc/nanorc" || echo "include \"/usr/share/nano/*.nanorc\"" >> "${_DESTDIR}/etc/nanorc"
sleep 2
}
_auto_color_bash_prompt(){
if [[ ! -f ${_DESTDIR}/etc/profile.d/archboot-color-bash-prompt.sh ]]; then
_dialog --infobox "Enable color bash prompt on installed system..." 3 70
cp /etc/profile.d/archboot-color-bash-prompt.sh ${_DESTDIR}/etc/profile.d/
sleep 2
fi
}
_auto_color_ls() {
if [[ ! -f ${_DESTDIR}/etc/profile.d/archboot-color-ls.sh ]]; then
_dialog --infobox "Enable ls color output on installed system..." 3 70
cp /etc/profile.d/archboot-color-ls.sh ${_DESTDIR}/etc/profile.d/
sleep 2
fi
}
# vim: set ft=sh ts=4 sw=4 et:

View file

@ -58,11 +58,11 @@ build ()
# add bash-completion
add_full_dir /usr/share/bash-completion
# unlock and delete root password, if not set by user!
# shellcheck disable=SC2129
echo "passwd -S root | grep -q 'L' && passwd -d root >/dev/null" >> "$BUILDROOT/etc/bash.bashrc"
# color output for bash prompt and ls
echo -e "PS1='[\e[1;31m\u\e[m@\e[1;32m\h\e[m \W]\\$ '" >> "$BUILDROOT/etc/bash.bashrc"
echo -e "alias ls='ls --color=auto'" >> "$BUILDROOT/etc/bash.bashrc"
# use color ls output
# use color bash prompt
for i in archboot-color-bash-prompt.sh archboot-reset-root-password.sh archboot-color-ls.sh; do
add_file "/usr/share/archboot/base/etc/profile.d/$i" "/etc/profile.d/$i"
done
### add kmod related config file(s)
add_file "/usr/lib/depmod.d/search.conf"

View file

@ -0,0 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
# created by Tobias Powalowski <tpowa@archlinux.org>
if [[ "${UID}" == 0 ]]; then
PS1='[\e[1;31m\u\e[m@\e[1;32m\h\e[m \W]\$ '
else
PS1='[\e[1;34m\u\e[m@\e[1;32m\h\e[m \W]\$ '
fi

View file

@ -0,0 +1,3 @@
# SPDX-License-Identifier: GPL-2.0-only
# created by Tobias Powalowski <tpowa@archlinux.org>
alias ls='ls --color=auto'

View file

@ -0,0 +1,3 @@
# SPDX-License-Identifier: GPL-2.0-only
# created by Tobias Powalowski <tpowa@archlinux.org>
passwd -S root | grep -q 'L' && passwd -d root >/dev/null"