Skip to content

Commit

Permalink
Add a list of BASH shell aliases and merge them with ohmyZSH aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
igorpecovnik committed Jun 30, 2024
1 parent c21b416 commit 277af07
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
6 changes: 6 additions & 0 deletions lib/functions/compilation/packages/armbian-zsh-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ compile_armbian-zsh() {

cp "${tmp_dir}/${armbian_zsh_dir}"/etc/oh-my-zsh/templates/zshrc.zsh-template "${tmp_dir}/${armbian_zsh_dir}"/etc/skel/.zshrc

# cat BASH aliases to it
cat "${SRC}"/packages/bsp/common/etc/skel/.bash_aliases >> "${tmp_dir}/${armbian_zsh_dir}"/etc/skel/.zshrc

chmod -R g-w,o-w "${tmp_dir}/${armbian_zsh_dir}"/etc/oh-my-zsh/

# we have common settings
Expand All @@ -78,6 +81,9 @@ compile_armbian-zsh() {
# define default plugins
sed -i 's/^plugins=.*/plugins=(evalcache git git-extras debian tmux screen history extract colorize web-search docker)/' "${tmp_dir}/${armbian_zsh_dir}"/etc/skel/.zshrc

# add collection of Armbian BASH aliases also to ZSH. They are compatible
cat "${SRC}"/packages/bsp/common/etc/skel >> "${tmp_dir}/${armbian_zsh_dir}"/etc/skel/.zshrc

chmod 755 "${tmp_dir}/${armbian_zsh_dir}"/DEBIAN/postinst

dpkg_deb_build "${tmp_dir}/${armbian_zsh_dir}" "armbian-zsh"
Expand Down
14 changes: 6 additions & 8 deletions lib/functions/rootfs/distro-agnostic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,14 @@ function install_distribution_agnostic() {
echo -e "${VENDOR} ${IMAGE_VERSION:-"${REVISION}"} ${RELEASE^} \\l \n" > "${SDCARD}"/etc/issue
echo "${VENDOR} ${IMAGE_VERSION:-"${REVISION}"} ${RELEASE^}" > "${SDCARD}"/etc/issue.net

# PRETTY_NAME changing in os-release is now done in armbian-base-files directly.
# Copy SKEL bashrc and profile to root user
cp "${SDCARD}"/etc/skel/.bashrc "${SDCARD}"/root/
cp "${SDCARD}"/etc/skel/.profile "${SDCARD}"/root/

# enable few bash aliases enabled in Ubuntu by default to make it even
sed "s/#alias ll='ls -l'/alias ll='ls -l'/" -i "${SDCARD}"/etc/skel/.bashrc
sed "s/#alias la='ls -A'/alias la='ls -A'/" -i "${SDCARD}"/etc/skel/.bashrc
sed "s/#alias l='ls -CF'/alias l='ls -CF'/" -i "${SDCARD}"/etc/skel/.bashrc
# root user is already there. Copy bashrc there as well
cp "${SDCARD}"/etc/skel/.bashrc "${SDCARD}"/root
# Copy systemwide alieases to root user too
cp "${SRC}"/packages/bsp/common/etc/skel/.bash_aliases "${SDCARD}"/root/

# display welcome message at first root login @TODO: what reads this?
# display welcome message at first root login which is ready by /usr/sbin/armbian/armbian-firstlogin
touch "${SDCARD}"/root/.not_logged_in_yet

if [[ ${DESKTOP_AUTOLOGIN} == yes ]]; then
Expand Down
6 changes: 6 additions & 0 deletions packages/bsp/common/etc/skel/.bash_aliases
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# BASH or ZSH shell alieases
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'
alias kernel="uname -r | sed 's/[1-9]\+[0-9]*\.[0-9]\+\.[0-9]\+-//' | sed 's/[1-9]\+[0-9]*\.[0-9]*\-rc[0-9]\+-//'"
alias showip='ip -4 addr show scope global | grep inet | awk "{print $2}" | cut -d"/" -f1 | sed "s/ inet //g" | paste -s -d, -'

0 comments on commit 277af07

Please sign in to comment.