diff options
author | Apachez <Apachez-@users.noreply.github.com> | 2023-08-11 20:27:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-11 20:27:45 +0200 |
commit | 11f46a2b4f8522cb52a85ba5bc6e76a575b418ce (patch) | |
tree | 97943d441bc670e145a960fb8e8a0dfb41deecda /src | |
parent | 43294da10313198c4f71f46eb39c4276551ad118 (diff) | |
download | vyos-1x-11f46a2b4f8522cb52a85ba5bc6e76a575b418ce.tar.gz vyos-1x-11f46a2b4f8522cb52a85ba5bc6e76a575b418ce.zip |
T5440: Restore pre/postconfig scripts if user deleted them
Using variable ${vyos_rootfs_dir} instead of wildcard for both restore_if_missing_preconfig
and restore_if_missing_postconfig.
Diffstat (limited to 'src')
-rwxr-xr-x | src/init/vyos-router | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/init/vyos-router b/src/init/vyos-router index 7b752b84b..96f163213 100755 --- a/src/init/vyos-router +++ b/src/init/vyos-router @@ -101,6 +101,16 @@ load_bootfile () ) } +# restore if missing pre-config script +restore_if_missing_preconfig_script () +{ + if [ ! -x ${vyatta_sysconfdir}/config/scripts/vyos-preconfig-bootup.script ]; then + cp ${vyos_rootfs_dir}/opt/vyatta/etc/config/scripts/vyos-preconfig-bootup.script ${vyatta_sysconfdir}/config/scripts/ + chgrp ${GROUP} ${vyatta_sysconfdir}/config/scripts/vyos-preconfig-bootup.script + chmod 750 ${vyatta_sysconfdir}/config/scripts/vyos-preconfig-bootup.script + fi +} + # execute the pre-config script run_preconfig_script () { @@ -109,6 +119,16 @@ run_preconfig_script () fi } +# restore if missing post-config script +restore_if_missing_postconfig_script () +{ + if [ ! -x ${vyatta_sysconfdir}/config/scripts/vyos-postconfig-bootup.script ]; then + cp ${vyos_rootfs_dir}/opt/vyatta/etc/config/scripts/vyos-postconfig-bootup.script ${vyatta_sysconfdir}/config/scripts/ + chgrp ${GROUP} ${vyatta_sysconfdir}/config/scripts/vyos-postconfig-bootup.script + chmod 750 ${vyatta_sysconfdir}/config/scripts/vyos-postconfig-bootup.script + fi +} + # execute the post-config scripts run_postconfig_scripts () { @@ -360,6 +380,8 @@ start () log_daemon_msg "Starting VyOS router" disabled migrate || migrate_bootfile + restore_if_missing_preconfig_script + run_preconfig_script run_postupgrade_script @@ -384,6 +406,8 @@ start () telinit q chmod g-w,o-w / + restore_if_missing_postconfig_script + run_postconfig_scripts } |