Page MenuHomeVyOS Platform

Clean up unused environment variables
Open, LowPublic

Description

We have a bunch of variables in the default environment (defined in https://github.com/vyos/vyos-1x/blob/current/src/etc/default/vyatta) that used to be important for compatibility with old Vyatta scripts or early VyOS re-implementations of them, but aren't used anywhere anymore and just makes it harder to reason about the variables we actually need.

Among them:

  • vyos_cfg_templates
  • vyatta_prefix
  • vyatta_htmldir
  • vyatta_datadir
  • vyatta_bindir
  • vyos_libdir
  • vyatta_localstatedir
  • vyos_op_templates
  • vyos_cfg_templates
  • vyatta_libexecdir
  • vyatta_prefix
  • vyos_prefix
  • vyos_datarootdir
  • vyatta_sharedstatedir
  • vyatta_infodir
  • vyatta_localedir
  • vyos_sbin_dir
  • vyos_share_dir
  • vyos_configdir — scripts that do use a variable for the config dir, use $vyatta_sysconfdir, funnily enough.

For the record, the following variables are used:

  • vyatta_sysconfdir — used in vyos-router and in vyos-boot-config-loader.py; we could replace it with a more modern name.
  • vyatta_sbindir — used only in vyos-router (its usage there is dubious and likely useless now) and in vyatta-cfg-cmd-wrapper (could be hardcoded there)

Details

Version
-
Is it a breaking change?
Perfectly compatible
Issue type
Internal change (not visible to end users)

Event Timeline

vyatta_sbindir is used in the code in vyos-router that was supposed to execute child services: https://github.com/vyos/vyos-1x/blob/current/src/init/vyos-router#L47-L55

declare -a subinit
declare -a all_subinits=( firewall )

if [ $# -gt 0 ] ; then
    for s in $@ ; do
        [ -x ${vyatta_sbindir}/${s}.init ] && subinit[${#subinit}]=$s
    done
else
    for s in ${all_subinits[@]} ; do
        [ -x ${vyatta_sbindir}/${s}.init ] && subinit[${#subinit}]=$s
    done
fi

However, there don't seem to be any *.init files in that directory anymore.

vyos@vyos# ls /opt/vyatta/sbin/*.init
ls: cannot access '/opt/vyatta/sbin/*.init': No such file or directory