Best practice in OpenWrt? Where to add an alias (non-network)

While upgrading to rc5, it just occurred to me that I don’t have my handy aliases. My hunch is to add them to /etc/profile , but I note that OpenWrt is not a “regular” distro and maybe it is common to add then somewhere else like /etc/profile.d/aliases.sh, /etc/shinit or elsewhere.

Ideas from those of you who use them?

This post RE non-login shells and aliases seems to suggest that /etc/shinit is the spot, but the post is a few years old…

I just create a script under /etc/profile.d/custom.sh

1 Like

That's exactly what I use, and I'd say it's "best practice" (in any case, just add something new in /etc/profile.d/).

You definitely don't want to modify /etc/profile directly, as that will prevent future upstream changes from being installed without you noticing that there's somehow a new /etc/profile-apk.new (or whatever it's called) and merging the diffs.

1 Like
echo "alias top='nice top'" >> /root/.profile
echo /root/.profile >> /etc/sysupgrade.conf

I still rely on /etc/shinit So far, works for me for my uses.

The "sanctioned" location is /etc/profile.d/ because the base-files package adds that automatically to the sysupgrade backup list (see /lib/upgrade/keep.d/base-files), so we don't have to keep telling people to modify sysupgrade.conf...

Why? The /lib/upgrade/keep.d/base-files-essential adds /etc/shinit. Nothing I have to do.