From 1229e8c6f130c62c42900f424a772d4e9c5e8ef5 Mon Sep 17 00:00:00 2001 From: An-Cheng Huang Date: Wed, 24 Oct 2007 10:01:04 -0700 Subject: add 'sudo' for 'system' and 'service/ssh' configuration commands. --- templates/service/ssh/node.def | 15 ++++++---- templates/system/domain-name/node.def | 8 ++---- templates/system/domain-search/domain/node.def | 7 ++--- templates/system/host-name/node.def | 10 ++----- templates/system/login/node.def | 2 +- templates/system/login/radius-server/node.def | 8 ++---- templates/system/login/user/node.def | 14 +++++---- templates/system/name-server/node.def | 26 ++++++++--------- templates/system/ntp-server/node.def | 10 +++---- templates/system/options/reboot-on-panic/node.def | 10 ++----- templates/system/package/auto-sync/node.def | 7 ++--- templates/system/package/repository/node.def | 6 ++-- .../host-name/node.tag/alias/node.def | 33 ++++++---------------- .../host-name/node.tag/inet/node.def | 30 ++++++-------------- templates/system/syslog/console/facility/node.def | 7 ++--- .../system/syslog/file/node.tag/archive/node.def | 6 ++-- .../system/syslog/file/node.tag/facility/node.def | 8 ++---- templates/system/syslog/global/archive/node.def | 6 ++-- templates/system/syslog/global/facility/node.def | 7 ++--- .../system/syslog/host/node.tag/facility/node.def | 7 ++--- templates/system/syslog/node.def | 2 +- .../system/syslog/user/node.tag/facility/node.def | 8 ++---- templates/system/time-zone/node.def | 4 +-- 23 files changed, 86 insertions(+), 155 deletions(-) diff --git a/templates/service/ssh/node.def b/templates/service/ssh/node.def index df868743..17e9b3dd 100644 --- a/templates/service/ssh/node.def +++ b/templates/service/ssh/node.def @@ -1,14 +1,17 @@ help: "Enable/disable SSH protocol" -delete: "/usr/sbin/invoke-rc.d ssh stop; echo 'SSHD_OPTS=' > /etc/default/ssh" +delete: "sudo /usr/sbin/invoke-rc.d ssh stop && \ + sudo sh -c \"echo 'SSHD_OPTS=' > /etc/default/ssh\" " end: "if [ -z \"$(port/@)\" ]; then exit 0; fi; \ - [ -f /etc/ssh/ssh_host_key ] \ - || ssh-keygen -t rsa1 -N '' -f /etc/ssh/ssh_host_key; \ + sudo sh -c \ + \"[ -f /etc/ssh/ssh_host_key ] \ + || sudo ssh-keygen -t rsa1 -N '' -f /etc/ssh/ssh_host_key\"; \ case \"$(protocol-version/@)\" in \ v2) VER=2;; \ v1) VER=1;; \ all) VER=\"1,2\";; \ *) VER=2;; \ esac; \ - echo 'SSHD_OPTS=\"-p $(port/@) -o HostKey=/etc/ssh/ssh_host_key \ --o Protocol='\\\$VER\\\" > /etc/default/ssh; \ - /usr/sbin/invoke-rc.d ssh restart" + STR=\"SSHD_OPTS=\\\"-p $(port/@) -o HostKey=/etc/ssh/ssh_host_key \ +-o Protocol=\\\${VER}\\\"\"; \ + sudo sh -c \"echo '\\\$STR' > /etc/default/ssh\"; \ + sudo /usr/sbin/invoke-rc.d ssh restart" diff --git a/templates/system/domain-name/node.def b/templates/system/domain-name/node.def index 8f9d4579..111061cd 100644 --- a/templates/system/domain-name/node.def +++ b/templates/system/domain-name/node.def @@ -1,15 +1,11 @@ type: txt help: "Configure system domain name" syntax: pattern $(@) "^[-a-zA-Z0-9.]{0,63}$" ; "invalid domain name $(@)" -create: "sh -c \"if [ x$(@) == x ]; then exit 0; fi && \ -touch /etc/resolv.conf && \ -sed -i '/domain/d' /etc/resolv.conf && \ -echo \\\"domain\t $(@)\\\" >> /etc/resolv.conf\" " # also add localhost line into /etc/hosts (see host-name template)? -update: "sh -c \"if [ x$(@) == x ]; then exit 0; fi && \ +update: "sudo sh -c \"if [ x$(@) == x ]; then exit 0; fi && \ touch /etc/resolv.conf && \ sed -i '/domain/d' /etc/resolv.conf && \ echo \\\"domain\t $(@)\\\" >> /etc/resolv.conf\" " # also update localhost line in /etc/hosts (see host-name template)? -delete: "sh -c \"touch /etc/resolv.conf && \ +delete: "sudo sh -c \"touch /etc/resolv.conf && \ sed -i '/domain\\\\t $(@)/d' /etc/resolv.conf\" " diff --git a/templates/system/domain-search/domain/node.def b/templates/system/domain-search/domain/node.def index d4e6c3c7..bc259182 100644 --- a/templates/system/domain-search/domain/node.def +++ b/templates/system/domain-search/domain/node.def @@ -2,11 +2,8 @@ multi: type: txt help: "Configure DNS domain completion order" syntax: pattern $(@) "^[-a-zA-Z0-9.]+$" ; "invalid domain name $(@)" -create: "sh -c \"touch /etc/resolv.conf && \ +update: "sudo sh -c \"touch /etc/resolv.conf && \ if grep -q 'search\t $(@)' /etc/resolv.conf; then exit 0; \ else echo \\\"search\t $(@)\\\" >> /etc/resolv.conf; fi\" " -update: "sh -c \"touch /etc/resolv.conf && \ -if grep -q 'search\t $(@)' /etc/resolv.conf; then exit 0; \ -else echo \\\"search\t $(@)\\\" >> /etc/resolv.conf; fi\" " -delete: "sh -c \"touch /etc/resolv.conf && \ +delete: "sudo sh -c \"touch /etc/resolv.conf && \ sed -i '/search\\\\t $(@)/d' /etc/resolv.conf\" " diff --git a/templates/system/host-name/node.def b/templates/system/host-name/node.def index fc7c91ba..33ba25e1 100644 --- a/templates/system/host-name/node.def +++ b/templates/system/host-name/node.def @@ -2,14 +2,8 @@ type: txt help: "Configure system host name" default: "vyatta" syntax: pattern $(@) "^[-a-zA-Z0-9.]+$" ; "invalid host name $(@)" -create: "sh -c \"hostname '$(@)' && \ -touch /etc/hosts && \ -sed -i '/localhost/d' /etc/hosts && \ -echo \\\"127.0.0.1\t localhost $(@)\t #vyatta entry\\\" >> /etc/hosts && \ -if [ x$(../domain-name/@) != x ]; then \ -echo \\\"127.0.0.1\t localhost $(@).$(../domain-name/@)\t #vyatta entry\\\" \>> /etc/hosts; fi\" " # do we need to add ntpd restart here? -update: "sh -c \"hostname '$(@)' && \ +update: "sudo sh -c \"hostname '$(@)' && \ touch /etc/hosts && \ sed -i '/localhost/d' /etc/hosts && \ echo \\\"127.0.0.1\t localhost $(@)\t #vyatta entry\\\" >> /etc/hosts && \ @@ -17,7 +11,7 @@ if [ x$(../domain-name/@) != x ]; then \ echo \\\"127.0.0.1\t localhost $(@).$(../domain-name/@)\t #vyatta entry\\\" \ >> /etc/hosts; fi\" " # do we need to add ntpd restart here? -delete: "sh -c \"echo > /etc/hostname.conf && hostname '' && \ +delete: "sudo sh -c \"echo > /etc/hostname.conf && hostname '' && \ touch /etc/hosts && \ sed -i '/localhost.*#vyatta entry/d' /etc/hosts && \ if [ -f /etc/ntp/ntp.conf ] && grep -q 'server' /etc/ntp/ntp.conf; then \ diff --git a/templates/system/login/node.def b/templates/system/login/node.def index 12465148..bde75b4c 100644 --- a/templates/system/login/node.def +++ b/templates/system/login/node.def @@ -1,3 +1,3 @@ help: "Configure user access" -delete: "sh -c \"echo User root cannot be deleted 1>&2 && exit 1\" " +delete: "echo User root cannot be deleted 1>&2 && exit 1" diff --git a/templates/system/login/radius-server/node.def b/templates/system/login/radius-server/node.def index d12be764..0f4ffbfe 100644 --- a/templates/system/login/radius-server/node.def +++ b/templates/system/login/radius-server/node.def @@ -2,13 +2,9 @@ tag: type: ipv4 help: "Radius server authentication configuration" # need mandatory secret. also need port & timeout (default values?) -create: "sh -c \"touch /etc/raddb/server && \ +update: "sudo sh -c \"touch /etc/raddb/server && \ sed -i '/$(@)/d' /etc/raddb/server && \ echo \\\"$(@):$(port/@)\t$(secret/@)\t$(timeout/@)\\\" \ >> /etc/raddb/server\" " -update: "sh -c \"touch /etc/raddb/server && \ -sed -i '/$(@)/d' /etc/raddb/server && \ -echo \\\"$(@):$(port/@)\t$(secret/@)\t$(timeout/@)\\\" \ ->> /etc/raddb/server\" " -delete: "sh -c \"touch /etc/raddb/server && \ +delete: "sudo sh -c \"touch /etc/raddb/server && \ sed -i '/$(@)/d' /etc/raddb/server\" " diff --git a/templates/system/login/user/node.def b/templates/system/login/user/node.def index 0d09c4d0..2070cc95 100644 --- a/templates/system/login/user/node.def +++ b/templates/system/login/user/node.def @@ -7,11 +7,15 @@ syntax: pattern $(@) "^[a-zA-Z_][a-zA-Z0-9_-]*\\$?$" ; "invalid user name $(@)" end: "if [ -d /tmp/vyatta-delete-system-login-user-$(@).\\\$PPID ]; \ then rm -rf /tmp/vyatta-delete-system-login-user-$(@).\\\$PPID && exit 0; \ fi && \ -/opt/vyatta/sbin/vyatta_update_login_user.pl \ -'$(@)' '$(full-name/@)' '$(authentication/encrypted-password/@)'" +sudo /opt/vyatta/sbin/vyatta_update_login_user.pl \ + '$(@)' '$(full-name/@)' '$(authentication/encrypted-password/@)'" delete: "if [ x$(@) == x ]; then exit 1; fi && \ -if [ x$(@) == xroot ]; then echo Cannot delete user \"root\" 1>&2 && exit 2; \ +if [ x$(@) == xroot ]; then \ + echo Cannot delete user \"root\" 1>&2 && exit 2; \ fi && \ if mkdir /tmp/vyatta-delete-system-login-user-$(@).\\\$PPID >& /dev/null; \ -then /opt/vyatta/sbin/vyatta_update_login_user.pl -d '$(@)'; \ -else exit 1; fi" +then \ + sudo /opt/vyatta/sbin/vyatta_update_login_user.pl -d '$(@)'; \ +else \ + exit 1; \ +fi" diff --git a/templates/system/name-server/node.def b/templates/system/name-server/node.def index 2afe0b0d..ff6ddf2e 100644 --- a/templates/system/name-server/node.def +++ b/templates/system/name-server/node.def @@ -1,17 +1,17 @@ multi: type: ipv4 help: "Configure domain name server" -create: "sh -c \"touch /etc/resolv.conf && \ -if grep -q '$(@)' /etc/resolv.conf; then exit 0; \ -else echo \\\"nameserver\t $(@)\\\" >> /etc/resolv.conf; fi && \ -if [ -f /etc/ntp/ntp.conf ] && grep -q 'server' /etc/ntp/ntp.conf; then \ -/opt/vyatta/sbin/ntpd.init restart; fi\" " -update: "sh -c \"touch /etc/resolv.conf && \ -if grep -q '$(@)' /etc/resolv.conf; then exit 0; \ -else echo \\\"nameserver\t $(@)\\\" >> /etc/resolv.conf; fi && \ -if [ -f /etc/ntp/ntp.conf ] && grep -q 'server' /etc/ntp/ntp.conf; then \ -/opt/vyatta/sbin/ntpd.init restart; fi\" " -delete: "sh -c \"touch /etc/resolv.conf && \ +update: "sudo sh -c \"touch /etc/resolv.conf && \ +if grep -q '$(@)' /etc/resolv.conf; then \ + exit 0; \ +else \ + echo \\\"nameserver\t $(@)\\\" >> /etc/resolv.conf; \ +fi && \ +if [ -f /etc/ntp.conf ] && grep -q 'server' /etc/ntp.conf; then \ + /usr/sbin/invoke-rc.d ntp restart; \ +fi\" " +delete: "sudo sh -c \"touch /etc/resolv.conf && \ sed -i '/$(@)/d' /etc/resolv.conf && \ -if [ -f /etc/ntp/ntp.conf ] && grep -q 'server' /etc/ntp/ntp.conf; then \ -/opt/vyatta/sbin/ntpd.init restart; fi\" " +if [ -f /etc/ntp.conf ] && grep -q 'server' /etc/ntp.conf; then \ + /usr/sbin/invoke-rc.d ntp restart; \ +fi\" " diff --git a/templates/system/ntp-server/node.def b/templates/system/ntp-server/node.def index 230dd313..b121d3c3 100644 --- a/templates/system/ntp-server/node.def +++ b/templates/system/ntp-server/node.def @@ -1,12 +1,12 @@ multi: type: txt help: "Name or IP address of NTP server" -update: "touch /etc/ntp.conf && \ +update: "sudo sh -c \"touch /etc/ntp.conf && \ if ! grep -q 'server.*$(@)' /etc/ntp.conf; then \ - echo \"server $(@)\" >> /etc/ntp.conf && \ + echo \\\"server $(@)\\\" >> /etc/ntp.conf && \ /usr/sbin/invoke-rc.d ntp restart; \ -fi" -delete: "touch /etc/ntp.conf && \ +fi\" " +delete: "sudo sh -c \"touch /etc/ntp.conf && \ if grep -q 'server.*$(@)' /etc/ntp.conf; then \ sed -i '/server $(@)/d' /etc/ntp.conf && \ if grep -q '^server ' /etc/ntp.conf; then \ @@ -14,4 +14,4 @@ if grep -q 'server.*$(@)' /etc/ntp.conf; then \ else \ /usr/sbin/invoke-rc.d ntp stop; \ fi; \ -fi" +fi\" " diff --git a/templates/system/options/reboot-on-panic/node.def b/templates/system/options/reboot-on-panic/node.def index d84abc74..425f5a76 100644 --- a/templates/system/options/reboot-on-panic/node.def +++ b/templates/system/options/reboot-on-panic/node.def @@ -1,16 +1,10 @@ type: bool help: "Configure if kernel panic causes reboot" default: true -create: "sh -c \"if [ x$(@) == xfalse ]; \ +update: "sudo sh -c \"if [ x$(@) == xfalse ]; \ then \ echo 0 > /proc/sys/kernel/panic; \ else \ echo 60 > /proc/sys/kernel/panic; \ fi\" " -update: "sh -c \"if [ x$(@) == xfalse ]; \ -then \ - echo 0 > /proc/sys/kernel/panic; \ -else \ - echo 60 > /proc/sys/kernel/panic; \ -fi\" " -delete: "sh -c \"echo 60 > /proc/sys/kernel/panic\" " +delete: "sudo sh -c \"echo 60 > /proc/sys/kernel/panic\" " diff --git a/templates/system/package/auto-sync/node.def b/templates/system/package/auto-sync/node.def index 59f3e1e4..277a5fe4 100644 --- a/templates/system/package/auto-sync/node.def +++ b/templates/system/package/auto-sync/node.def @@ -5,11 +5,8 @@ type: u32 default: 1 help: "Update the the repository cache every n days. 0 disables auto-update." syntax: $(@) >= 0 && $(@) < 32 ; "auto-sync must be between 0 and 32 days" -create: "sh -c \"touch /etc/apt/apt.conf && \ +update: "sudo sh -c \"touch /etc/apt/apt.conf && \ sed -i '/APT::Periodic::Update-Package-Lists*/d' /etc/apt/apt.conf && \ echo \\\"APT::Periodic::Update-Package-Lists \\\"$(@)\\\";\\\" >> /etc/apt/apt.conf\" " -update: "sh -c \"touch /etc/apt/apt.conf && \ -sed -i '/APT::Periodic::Update-Package-Lists*/d' /etc/apt/apt.conf && \ -echo \\\"APT::Periodic::Update-Package-Lists \\\"$(@)\\\";\\\" >> /etc/apt/apt.conf\" " -delete: "sh -c \"touch /etc/apt/apt.conf && \ +delete: "sudo sh -c \"touch /etc/apt/apt.conf && \ sed -i '/APT::Periodic::Update-Package-Lists*/d' /etc/apt/apt.conf\" " diff --git a/templates/system/package/repository/node.def b/templates/system/package/repository/node.def index 104089a9..4fd6d587 100644 --- a/templates/system/package/repository/node.def +++ b/templates/system/package/repository/node.def @@ -4,11 +4,11 @@ help: "Repository name" # bug 1847: remove the previous repo line before adding new line. # need to prohibit '!' in repo name (sed delimiter) syntax: pattern $(@) "^[^!]+$" ; "Do not use '!' in repository name" -create: "sh -c \"touch /etc/apt/sources.list && \ +create: "sudo sh -c \"touch /etc/apt/sources.list && \ sed -i '\\!/ $(@) !d' /etc/apt/sources.list && \ echo \\\"deb $(url/@)/ $(@) $(component/@)\\\" >> /etc/apt/sources.list\" " -update: "sh -c \"touch /etc/apt/sources.list && \ +update: "sudo sh -c \"touch /etc/apt/sources.list && \ sed -i '\\!/ $(@) !d' /etc/apt/sources.list && \ echo \\\"deb $(url/@)/ $(@) $(component/@)\\\" >> /etc/apt/sources.list\" " -delete: "sh -c \"touch /etc/apt/sources.list && \ +delete: "sudo sh -c \"touch /etc/apt/sources.list && \ sed -i '\\! $(@) $(component/@)!d' /etc/apt/sources.list\" " diff --git a/templates/system/static-host-mapping/host-name/node.tag/alias/node.def b/templates/system/static-host-mapping/host-name/node.tag/alias/node.def index b6f897f3..c8f5cdef 100644 --- a/templates/system/static-host-mapping/host-name/node.tag/alias/node.def +++ b/templates/system/static-host-mapping/host-name/node.tag/alias/node.def @@ -1,33 +1,18 @@ multi: type: txt help: "Alias for this address" -create: "sh -c \"touch /etc/hosts && \ +update: "sudo sh -c \"touch /etc/hosts && \ sed -i '/$(../@).*#vyatta entry/d;/127\\.0\\.0\\.1.*#vyatta entry/d' \ -/etc/hosts && \ + /etc/hosts && \ echo \\\"$(../inet/@)\t $(../@) $(@) \t #vyatta entry\\\" \ ->> /etc/hosts && \ -if [ x$(../../../domain-name/@) == x ]; \ -then \ -echo \\\"127.0.0.1\t localhost $(../../../host-name/@)\t #vyatta entry\\\" \ ->> /etc/hosts; \ + >> /etc/hosts && \ +if [ x$(../../../domain-name/@) == x ]; then \ + echo \\\"127.0.0.1\t localhost $(../../../host-name/@)\t #vyatta entry\\\" \ + >> /etc/hosts; \ else \ -echo \\\"127.0.0.1\t localhost \ + echo \\\"127.0.0.1\t localhost \ $(../../../host-name/@).$(../../../domain-name/@)\t #vyatta entry\\\" \ ->> /etc/hosts; \ + >> /etc/hosts; \ fi\" " -update: "sh -c \"touch /etc/hosts && \ -sed -i '/$(../@).*#vyatta entry/d;/127\\.0\\.0\\.1.*#vyatta entry/d' \ -/etc/hosts && \ -echo \\\"$(../inet/@)\t $(../@) $(@) \t #vyatta entry\\\" \ ->> /etc/hosts && \ -if [ x$(../../../domain-name/@) == x ]; \ -then \ -echo \\\"127.0.0.1\t localhost $(../../../host-name/@)\t #vyatta entry\\\" \ ->> /etc/hosts; \ -else \ -echo \\\"127.0.0.1\t localhost \ -$(../../../host-name/@).$(../../../domain-name/@)\t #vyatta entry\\\" \ ->> /etc/hosts; \ -fi\" " -delete: "sh -c \"touch /etc/hosts && \ +delete: "sudo sh -c \"touch /etc/hosts && \ sed -i '/ $(../@) .*#vyatta entry/{/localhost/!d}' /etc/hosts\" " diff --git a/templates/system/static-host-mapping/host-name/node.tag/inet/node.def b/templates/system/static-host-mapping/host-name/node.tag/inet/node.def index 192273c3..47a84733 100644 --- a/templates/system/static-host-mapping/host-name/node.tag/inet/node.def +++ b/templates/system/static-host-mapping/host-name/node.tag/inet/node.def @@ -1,30 +1,16 @@ type: ipv4 help: "Internet address" -create: "sh -c \"touch /etc/hosts && \ +update: "sudo sh -c \"touch /etc/hosts && \ sed -i '/$(../@).*#vyatta entry/d;/127\\.0\\.0\\.1.*#vyatta entry/d' \ -/etc/hosts && \ + /etc/hosts && \ echo \\\"$(@)\t $(../@) \t #vyatta entry\\\" >> /etc/hosts && \ -if [ x$(../../../domain-name/@) == x ]; \ -then \ -echo \\\"127.0.0.1\t localhost $(../../../host-name/@)\t #vyatta entry\\\" \ ->> /etc/hosts; \ +if [ x$(../../../domain-name/@) == x ]; then \ + echo \\\"127.0.0.1\t localhost $(../../../host-name/@)\t #vyatta entry\\\" \ + >> /etc/hosts; \ else \ -echo \\\"127.0.0.1\t localhost \ + echo \\\"127.0.0.1\t localhost \ $(../../../host-name/@).$(../../../domain-name/@)\t #vyatta entry\\\" \ ->> /etc/hosts; \ + >> /etc/hosts; \ fi\" " -update: "sh -c \"touch /etc/hosts && \ -sed -i '/$(../@).*#vyatta entry/d;/127\\.0\\.0\\.1.*#vyatta entry/d' \ -/etc/hosts && \ -echo \\\"$(@)\t $(../@) \t #vyatta entry\\\" >> /etc/hosts && \ -if [ x$(../../../domain-name/@) == x ]; \ -then \ -echo \\\"127.0.0.1\t localhost $(../../../host-name/@)\t #vyatta entry\\\" \ ->> /etc/hosts; \ -else \ -echo \\\"127.0.0.1\t localhost \ -$(../../../host-name/@).$(../../../domain-name/@)\t #vyatta entry\\\" \ ->> /etc/hosts; \ -fi\" " -delete: "sh -c \"touch /etc/hosts && \ +delete: "sudo sh -c \"touch /etc/hosts && \ sed -i '/ $(../@) .*#vyatta entry/{/localhost/!d}' /etc/hosts\" " diff --git a/templates/system/syslog/console/facility/node.def b/templates/system/syslog/console/facility/node.def index bfe3856f..c5d0d76f 100644 --- a/templates/system/syslog/console/facility/node.def +++ b/templates/system/syslog/console/facility/node.def @@ -1,11 +1,8 @@ tag: type: txt help: "Configure facility for console logging" -create: "sh -c \"LVL=`echo -n $(level/@) | tr '[a-z]' '[A-Z]'` && \ +update: "sudo sh -c \"LVL=`echo -n $(level/@) | tr '[a-z]' '[A-Z]'` && \ /opt/vyatta/sbin/vyatta_update_syslog.pl '$(@)\\.' '\\/dev\\/console' \ \\\"$(@).\\\\\$LVL\t/dev/console\n\\\"\" " -update: "sh -c \"LVL=`echo -n $(level/@) | tr '[a-z]' '[A-Z]'` && \ -/opt/vyatta/sbin/vyatta_update_syslog.pl '$(@)\\.' '\\/dev\\/console' \ -\\\"$(@).\\\\\$LVL\t/dev/console\n\\\"\" " -delete: "sh -c \"/opt/vyatta/sbin/vyatta_update_syslog.pl \ +delete: "sudo sh -c \"/opt/vyatta/sbin/vyatta_update_syslog.pl \ '$(@)\\.' '\\/dev\\/console' ''\" " diff --git a/templates/system/syslog/file/node.tag/archive/node.def b/templates/system/syslog/file/node.tag/archive/node.def index d0b0e230..6e857360 100644 --- a/templates/system/syslog/file/node.tag/archive/node.def +++ b/templates/system/syslog/file/node.tag/archive/node.def @@ -1,8 +1,6 @@ help: "Configure log file size and rotation characteristics" # need mandatory files & size -create: "sh -c \"/opt/vyatta/sbin/vyatta_update_logrotate.pl \ +update: "sudo sh -c \"/opt/vyatta/sbin/vyatta_update_logrotate.pl \ '$(../@)' '$(files/@)' '$(size/@)' 1\" " -update: "sh -c \"/opt/vyatta/sbin/vyatta_update_logrotate.pl \ -'$(../@)' '$(files/@)' '$(size/@)' 1\" " -delete: "sh -c \"/opt/vyatta/sbin/vyatta_update_logrotate.pl \ +delete: "sudo sh -c \"/opt/vyatta/sbin/vyatta_update_logrotate.pl \ '$(../@)' '$(files/@)' '$(size/@)' 0\" " diff --git a/templates/system/syslog/file/node.tag/facility/node.def b/templates/system/syslog/file/node.tag/facility/node.def index 3ef56e35..af3ab498 100644 --- a/templates/system/syslog/file/node.tag/facility/node.def +++ b/templates/system/syslog/file/node.tag/facility/node.def @@ -1,13 +1,9 @@ tag: type: txt help: "Configure facility for file logging" -create: "sh -c \"LVL=`echo -n $(level/@) | tr '[a-z]' '[A-Z]'` && \ +update: "sudo sh -c \"LVL=`echo -n $(level/@) | tr '[a-z]' '[A-Z]'` && \ /opt/vyatta/sbin/vyatta_update_syslog.pl '$(@)\\.' \ '\\/var\\/log\\/user\\/$(../@)' \ \\\"$(@).\\\\\$LVL\t/var/log/user/$(../@) \n\\\"\" " -update: "sh -c \"LVL=`echo -n $(level/@) | tr '[a-z]' '[A-Z]'` && \ -/opt/vyatta/sbin/vyatta_update_syslog.pl '$(@)\\.' \ -'\\/var\\/log\\/user\\/$(../@)' \ -\\\"$(@).\\\\\$LVL\t/var/log/user/$(../@) \n\\\"\" " -delete: "sh -c \"/opt/vyatta/sbin/vyatta_update_syslog.pl '$(@)\\.' \ +delete: "sudo sh -c \"/opt/vyatta/sbin/vyatta_update_syslog.pl '$(@)\\.' \ '\\/var\\/log\\/user\\/$(../@)' ''\" " diff --git a/templates/system/syslog/global/archive/node.def b/templates/system/syslog/global/archive/node.def index dcfc2446..aefdb2d4 100644 --- a/templates/system/syslog/global/archive/node.def +++ b/templates/system/syslog/global/archive/node.def @@ -1,8 +1,6 @@ help: "Configure log file size and rotation characteristics" # need mandatory files & size -create: "sh -c \"/opt/vyatta/sbin/vyatta_update_logrotate.pl \ +update: "sudo sh -c \"/opt/vyatta/sbin/vyatta_update_logrotate.pl \ '$(files/@)' '$(size/@)' 1\" " -update: "sh -c \"/opt/vyatta/sbin/vyatta_update_logrotate.pl \ -'$(files/@)' '$(size/@)' 1\" " -delete: "sh -c \"/opt/vyatta/sbin/vyatta_update_logrotate.pl \ +delete: "sudo sh -c \"/opt/vyatta/sbin/vyatta_update_logrotate.pl \ '$(files/@)' '$(size/@)' 0\" " diff --git a/templates/system/syslog/global/facility/node.def b/templates/system/syslog/global/facility/node.def index cd037f6a..1cfb8223 100644 --- a/templates/system/syslog/global/facility/node.def +++ b/templates/system/syslog/global/facility/node.def @@ -1,11 +1,8 @@ tag: type: txt help: "Configure facility for system logging" -create: "sh -c \"LVL=`echo -n $(level/@) | tr '[a-z]' '[A-Z]'` && \ +update: "sudo sh -c \"LVL=`echo -n $(level/@) | tr '[a-z]' '[A-Z]'` && \ /opt/vyatta/sbin/vyatta_update_syslog.pl '' '\\/var\\/log\\/messages' \ \\\"$(@).\\\\\$LVL\t/var/log/messages \n\\\"\" " -update: "sh -c \"LVL=`echo -n $(level/@) | tr '[a-z]' '[A-Z]'` && \ -/opt/vyatta/sbin/vyatta_update_syslog.pl '' '\\/var\\/log\\/messages' \ -\\\"$(@).\\\\\$LVL\t/var/log/messages \n\\\"\" " -delete: "sh -c \"/opt/vyatta/sbin/vyatta_update_syslog.pl \ +delete: "sudo sh -c \"/opt/vyatta/sbin/vyatta_update_syslog.pl \ '' '\\/var\\/log\\/messages' '*.warning\t/var/log/messages \n'\" " diff --git a/templates/system/syslog/host/node.tag/facility/node.def b/templates/system/syslog/host/node.tag/facility/node.def index 2dc56e66..f4063eed 100644 --- a/templates/system/syslog/host/node.tag/facility/node.def +++ b/templates/system/syslog/host/node.tag/facility/node.def @@ -1,11 +1,8 @@ tag: type: txt help: "Configure facility for host logging" -create: "sh -c \"LVL=`echo -n $(level/@) | tr '[a-z]' '[A-Z]'` && \ +update: "sudo sh -c \"LVL=`echo -n $(level/@) | tr '[a-z]' '[A-Z]'` && \ /opt/vyatta/sbin/vyatta_update_syslog.pl '$(@)\\.' '@$(../@) ' \ \\\"$(@).\\\\\$LVL\t@$(../@) \n\\\"\" " -update: "sh -c \"LVL=`echo -n $(level/@) | tr '[a-z]' '[A-Z]'` && \ -/opt/vyatta/sbin/vyatta_update_syslog.pl '$(@)\\.' '@$(../@) ' \ -\\\"$(@).\\\\\$LVL\t@$(../@) \n\\\"\" " -delete: "sh -c \"/opt/vyatta/sbin/vyatta_update_syslog.pl '$(@)\\.' \ +delete: "sudo sh -c \"/opt/vyatta/sbin/vyatta_update_syslog.pl '$(@)\\.' \ '@$(../@) ' ''\" " diff --git a/templates/system/syslog/node.def b/templates/system/syslog/node.def index 04d3675e..e6e68aba 100644 --- a/templates/system/syslog/node.def +++ b/templates/system/syslog/node.def @@ -1,3 +1,3 @@ help: "Configure syslog daemon" -delete: "sh -c \"/opt/vyatta/sbin/vyatta_update_syslog.pl \ +delete: "sudo sh -c \"/opt/vyatta/sbin/vyatta_update_syslog.pl \ '' '\\/var\\/log\\/messages' '*.warning\t/var/log/messages \n'\" " diff --git a/templates/system/syslog/user/node.tag/facility/node.def b/templates/system/syslog/user/node.tag/facility/node.def index 1b227471..6a5d7228 100644 --- a/templates/system/syslog/user/node.tag/facility/node.def +++ b/templates/system/syslog/user/node.tag/facility/node.def @@ -1,14 +1,10 @@ tag: type: txt help: "Configure facility for user logging" -create: "sh -c \"LVL=`echo -n $(level/@) | tr '[a-z]' '[A-Z]'` && \ +update: "sudo sh -c \"LVL=`echo -n $(level/@) | tr '[a-z]' '[A-Z]'` && \ /opt/vyatta/sbin/vyatta_update_syslog.pl \\\"$(@)\\.\\\\\$LVL\\\" \ ' $(../@) ' \ \\\"$(@).\\\\\$LVL $(../@) \n\\\"\" " -update: "sh -c \"LVL=`echo -n $(level/@) | tr '[a-z]' '[A-Z]'` && \ -/opt/vyatta/sbin/vyatta_update_syslog.pl \\\"$(@)\\.\\\\\$LVL\\\" \ -' $(../@) ' \ -\\\"$(@).\\\\\$LVL $(../@) \n\\\"\" " -delete: "sh -c \"LVL=`echo -n $(level/@) | tr '[a-z]' '[A-Z]'` && \ +delete: "sudo sh -c \"LVL=`echo -n $(level/@) | tr '[a-z]' '[A-Z]'` && \ /opt/vyatta/sbin/vyatta_update_syslog.pl \\\"$(@)\\.\\\\\$LVL\\\" \ ' $(../@) ' ''\" " diff --git a/templates/system/time-zone/node.def b/templates/system/time-zone/node.def index 00da0133..22a2921e 100644 --- a/templates/system/time-zone/node.def +++ b/templates/system/time-zone/node.def @@ -12,5 +12,5 @@ case \"$(@)\" in \ [Pp][Hh][Oo]*) LTF=\"\\\$LTF/US/Arizona\" ;; \ *) LTF=\"\\\$LTF/Etc/$(@)\" ;; \ esac && \ -ln -fs \\\$LTF /etc/localtime" -delete: "ln -fs /usr/share/zoneinfo/GMT /etc/localtime" +sudo ln -fs \\\$LTF /etc/localtime" +delete: "sudo ln -fs /usr/share/zoneinfo/GMT /etc/localtime" -- cgit v1.2.3