A router runs firmware containing BusyBox and in addition to flash memory the device has secondary memory storage. That USB stick is mounted at both
# mount | grep sda /dev/sda1 on /media/Main type ext4 (rw,noatime,data=ordered) /dev/sda1 on /opt type ext4 (rw,noatime,data=ordered)
Duplicates in locate database
The issue is that locate
updatedb indexes both
/opt. I wish to permanently remove these duplicates from
/opt/var/locatedb without changing drive mounting. I do wish to use the
updatedb command without adding options to that command from both cron and shell. An
alias might be an option. Though my first search for "locate database exclude" did return a blog post that suggest to use an “/etc/updatedb.conf” for Arch Linux.
First try was to create a file
# directories to execlude from the locate database PRUNEPATHS="/media /mnt /tmp /var/tmp /var/cache /var/lock /var/run /var/spool" export PRUNEPATHS # filesystems to exclude from the locate database: PRUNEFS="afs auto autofs binfmt_misc cifs coda configfs cramfs debugfs devpts devtmpfs ftpfs iso9660 mqueue ncpfs nfs nfs4 proc ramfs securityfs shfs smbfs sshfs sysfs tmpfs udf usbfs vboxsf" export PRUNEFS
That is not enough to let
updatedb use the desired configuration. Next was reading GNU locate documentation. GNU updatedb documentation states:
Typically, operating systems have a shell script that “exports” configurations for variable definitions and uses another shell script that “sources” the configuration file into the environment and then executes updatedb in the environment.
Does my embedded Linux export and source configuration variables?
This embedded Linux operating system might have the GNU suggested shell scripts that export configuration variables and also sources them back into the environment.
How can I verify that this OS exports and sources?
And when the OS doesn't, how to correctly export and source configuration variables here?
locatewas installed via
opkgon this external storage medium
- BusyBox v1.24.1 according to
- locate (GNU findutils) 4.6.0
- shell is
$ cat /opt/etc/profile #!/bin/sh export PATH='/opt/usr/sbin:/opt/sbin:/opt/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin' export TMP='/opt/tmp' export TEMP='/opt/tmp' # This is for interactive sessions only if [ "$PS1" ] ; then export TERM=xterm [ -d /opt/share/terminfo ] && export TERMINFO='/opt/share/terminfo' export LANG='en_US.UTF-8' export LC_ALL='en_US.UTF-8' fi export TERMINFO=/opt/share/terminfo