Skip to content

Commit 609640d

Browse files
committed
op-mode: T7527: move assorted embedded shel snippets to script files
1 parent 594e776 commit 609640d

9 files changed

+32
-5
lines changed

op-mode-definitions/install-mok.xml.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<properties>
77
<help>Install Secure Boot MOK (Machine Owner Key)</help>
88
</properties>
9-
<command>if test -f /var/lib/shim-signed/mok/vyos-dev-2025-shim.der; then mokutil --ignore-keyring --import /var/lib/shim-signed/mok/vyos-dev-2025-shim.der; else echo "Secure Boot Machine Owner Key not found"; fi</command>
9+
<command>${vyos_op_scripts_dir}/install_mok.sh</command>
1010
</leafNode>
1111
</children>
1212
</node>

op-mode-definitions/show-interfaces-bonding.xml.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<properties>
2424
<help>Show detailed interface information</help>
2525
</properties>
26-
<command>if [ -f "/proc/net/bonding/$4" ]; then cat "/proc/net/bonding/$4"; else echo "Interface $4 does not exist!"; fi</command>
26+
<command>${vyos_op_scripts_dir}/show_bonding_detail.sh "$4"</command>
2727
</leafNode>
2828
<node name="lacp">
2929
<properties>

op-mode-definitions/show-interfaces-pppoe.xml.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<path>interfaces pppoe</path>
2727
</completionHelp>
2828
</properties>
29-
<command>if [ -d "/sys/class/net/$4" ]; then /usr/sbin/pppstats "$4"; fi</command>
29+
<command>${vyos_op_scripts_dir}/show_ppp_stats.sh "$4"</command>
3030
</leafNode>
3131
#include <include/show-interface-type-event-log.xml.i>
3232
</children>

op-mode-definitions/show-interfaces-sstpc.xml.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<path>interfaces sstpc</path>
2727
</completionHelp>
2828
</properties>
29-
<command>if [ -d "/sys/class/net/$4" ]; then /usr/sbin/pppstats "$4"; fi</command>
29+
<command>${vyos_op_scripts_dir}/show_ppp_stats.sh "$4"</command>
3030
</leafNode>
3131
#include <include/show-interface-type-event-log.xml.i>
3232
</children>

op-mode-definitions/suricata.xml.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<properties>
77
<help>Update Suricata</help>
88
</properties>
9-
<command>if test -f /run/suricata/suricata.yaml; then suricata-update --suricata-conf /run/suricata/suricata.yaml; systemctl restart suricata; else echo "Service Suricata not configured"; fi </command>
9+
<command>${vyos_op_scripts_dir}/update_suricata.sh</command>
1010
</node>
1111
</children>
1212
</node>

src/op_mode/install_mok.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
3+
if test -f /var/lib/shim-signed/mok/vyos-dev-2025-shim.der; then
4+
mokutil --ignore-keyring --import /var/lib/shim-signed/mok/vyos-dev-2025-shim.der;
5+
else
6+
echo "Secure Boot Machine Owner Key not found";
7+
fi

src/op_mode/show_bonding_detail.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
3+
if [ -f "/proc/net/bonding/$1" ]; then
4+
cat "/proc/net/bonding/$1";
5+
else
6+
echo "Interface $1 does not exist!";
7+
fi

src/op_mode/show_ppp_stats.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
3+
if [ -d "/sys/class/net/$1" ]; then
4+
/usr/sbin/pppstats "$1";
5+
fi

src/op_mode/update_suricata.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
3+
if test -f /run/suricata/suricata.yaml; then
4+
suricata-update --suricata-conf /run/suricata/suricata.yaml;
5+
systemctl restart suricata;
6+
else
7+
echo "Service Suricata not configured";
8+
fi

0 commit comments

Comments
 (0)