diff --git a/usr/lib/archboot/installer/autoconfiguration.sh b/usr/lib/archboot/installer/autoconfiguration.sh index c01580781..58406d6e2 100644 --- a/usr/lib/archboot/installer/autoconfiguration.sh +++ b/usr/lib/archboot/installer/autoconfiguration.sh @@ -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: diff --git a/usr/lib/initcpio/install/archboot_base_common b/usr/lib/initcpio/install/archboot_base_common index 56d6b6052..579552b85 100644 --- a/usr/lib/initcpio/install/archboot_base_common +++ b/usr/lib/initcpio/install/archboot_base_common @@ -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" diff --git a/usr/share/archboot/base/etc/profile.d/archboot-color-bash-prompt.sh b/usr/share/archboot/base/etc/profile.d/archboot-color-bash-prompt.sh new file mode 100644 index 000000000..45778adb3 --- /dev/null +++ b/usr/share/archboot/base/etc/profile.d/archboot-color-bash-prompt.sh @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0-only +# created by Tobias Powalowski +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 diff --git a/usr/share/archboot/base/etc/profile.d/archboot-color-ls.sh b/usr/share/archboot/base/etc/profile.d/archboot-color-ls.sh new file mode 100644 index 000000000..fd3332421 --- /dev/null +++ b/usr/share/archboot/base/etc/profile.d/archboot-color-ls.sh @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0-only +# created by Tobias Powalowski +alias ls='ls --color=auto' diff --git a/usr/share/archboot/base/etc/profile.d/archboot-reset-root-password.sh b/usr/share/archboot/base/etc/profile.d/archboot-reset-root-password.sh new file mode 100644 index 000000000..85371de82 --- /dev/null +++ b/usr/share/archboot/base/etc/profile.d/archboot-reset-root-password.sh @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0-only +# created by Tobias Powalowski +passwd -S root | grep -q 'L' && passwd -d root >/dev/null"