summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorBob Gilligan <gilligan@vyatta.com>2009-07-30 13:53:48 -0700
committerBob Gilligan <gilligan@vyatta.com>2009-07-30 14:08:21 -0700
commitd89b40e09c5753fabd5e642477c311b82ba82790 (patch)
tree01c4550026dbc528ad5cb355508a338b9d74b0b0 /templates
parent4933b638324177d0e5254f13c00e9df1ccbe0c21 (diff)
downloadvyatta-cfg-quagga-d89b40e09c5753fabd5e642477c311b82ba82790.tar.gz
vyatta-cfg-quagga-d89b40e09c5753fabd5e642477c311b82ba82790.zip
Bugfix 4700: Move processing to "end" field so that param modifications are handled.
In order to correctly handle cases where parameters are changed after a repository configuration has been set up, we need to do the work in an "end" field instead of a "create" field. The "create" field is only executed when the node itself is created, not when nodes below it are modified. (cherry picked from commit e500a9e4494649e0ecb523d36b28452f2e9dd326)
Diffstat (limited to 'templates')
-rw-r--r--templates/system/package/auto-sync/node.def12
-rw-r--r--templates/system/package/repository/node.def31
-rw-r--r--templates/system/package/repository/node.tag/components/node.def2
-rw-r--r--templates/system/package/repository/node.tag/description/node.def1
-rw-r--r--templates/system/package/repository/node.tag/distribution/node.def2
-rw-r--r--templates/system/package/repository/node.tag/url/node.def2
6 files changed, 36 insertions, 14 deletions
diff --git a/templates/system/package/auto-sync/node.def b/templates/system/package/auto-sync/node.def
index 3d14ab04..299b43bf 100644
--- a/templates/system/package/auto-sync/node.def
+++ b/templates/system/package/auto-sync/node.def
@@ -1,12 +1,18 @@
# this will set APT::Periodic::Update-Package-Lists in /etc/apt/apt.conf
# apt.conf is in turn read by the apt cron file loacted in /etc/cron.daily/apt
# the /etc/crontab file must have the daily line for daily to be run
+
type: u32
+
default: 1
+
help: Set to update the the repository cache every n days (0 disables auto-update)
+
syntax:expression: $VAR(@) >= 0 && $VAR(@) < 32 ; "auto-sync must be between 0 and 32 days"
+
update:expression: "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 \\\"$VAR(@)\\\";\\\" >> /etc/apt/apt.conf\" "
+ sed -i '/APT::Periodic::Update-Package-Lists*/d' /etc/apt/apt.conf && \
+ echo \\\"APT::Periodic::Update-Package-Lists \\\"$VAR(@)\\\";\\\" >> /etc/apt/apt.conf\" "
+
delete:expression: "sudo sh -c \"touch /etc/apt/apt.conf && \
-sed -i '/APT::Periodic::Update-Package-Lists*/d' /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 17d5d162..40504bf1 100644
--- a/templates/system/package/repository/node.def
+++ b/templates/system/package/repository/node.def
@@ -8,16 +8,25 @@ commit:expression: $VAR(./url/) != ""; "Must configure the repository URL"
commit:expression: $VAR(./distribution/) != ""; "Must configure the repository distribution"
commit:expression: $VAR(./components/) != ""; "Must configure the repository components"
-create: sudo bash -c "touch /etc/apt/sources.list && \
- sed -i '\\!# $VAR(@) #!d' /etc/apt/sources.list && \
- echo \"deb $VAR(url/@) $VAR(distribution/@) $VAR(components/@) # $VAR(@) #\" >> /tmp/$$-sources.list && \
- if [ $VAR(password/@) ] || [ $VAR(username/@) ]; \
- then \
+end:
+ if [ ${COMMIT_ACTION} = 'SET' -o ${COMMIT_ACTION} = 'ACTIVE' ]; then
+ if [ ${COMMIT_ACTION} = 'SET' ]; then
+ echo "Adding new entry to /etc/apt/sources.list..."
+ else
+ echo "Updating /etc/apt/sources.list..."
+ fi
+ sudo bash -c "touch /etc/apt/sources.list && \
+ sed -i '\\!# $VAR(@) #!d' /etc/apt/sources.list && \
+ echo \"deb $VAR(url/@) $VAR(distribution/@) $VAR(components/@) # $VAR(@) #\" >> /tmp/$$-sources.list && \
+ if [ $VAR(password/@) ] || [ $VAR(username/@) ]; \
+ then \
sed -i "s!://.*@!://!" /tmp/$$-sources.list; \
sed -i "s!://!://$VAR(username/@):$VAR(password/@)@!" /tmp/$$-sources.list; \
- fi && \
- cat /tmp/$$-sources.list>>/etc/apt/sources.list ; \
- rm -f /tmp/$$-sources.list"
-
-delete: sudo sh -c "touch /etc/apt/sources.list && \
-sed -i '\\!# $VAR(@) #!d' /etc/apt/sources.list"
+ fi && \
+ cat /tmp/$$-sources.list>>/etc/apt/sources.list ; \
+ rm -f /tmp/$$-sources.list"
+ elif [ ${COMMIT_ACTION} = 'DELETE' ]; then
+ echo "Removing entry from /etc/apt/sources.list..."
+ sudo sh -c "touch /etc/apt/sources.list && \
+ sed -i '\\!# $VAR(@) #!d' /etc/apt/sources.list"
+ fi
diff --git a/templates/system/package/repository/node.tag/components/node.def b/templates/system/package/repository/node.tag/components/node.def
index 60605b89..313ab614 100644
--- a/templates/system/package/repository/node.tag/components/node.def
+++ b/templates/system/package/repository/node.tag/components/node.def
@@ -1,4 +1,6 @@
type: txt
+
help: Set repository component names
+
# need to prohibit '!' in repo name (sed delimiter)
syntax:expression: pattern $VAR(@) "^[^!]+$" ; "Do not use '!' in component name"
diff --git a/templates/system/package/repository/node.tag/description/node.def b/templates/system/package/repository/node.tag/description/node.def
index 8ebfacb0..613b0d28 100644
--- a/templates/system/package/repository/node.tag/description/node.def
+++ b/templates/system/package/repository/node.tag/description/node.def
@@ -1,2 +1,3 @@
type: txt
+
help: Set repository description
diff --git a/templates/system/package/repository/node.tag/distribution/node.def b/templates/system/package/repository/node.tag/distribution/node.def
index ce5219bc..353f59b6 100644
--- a/templates/system/package/repository/node.tag/distribution/node.def
+++ b/templates/system/package/repository/node.tag/distribution/node.def
@@ -1,4 +1,6 @@
type: txt
+
help: Set distribution name
+
# need to prohibit '!' in repo name (sed delimiter)
syntax:expression: pattern $VAR(@) "^[^!]+$" ; "Do not use '!' in distribution name"
diff --git a/templates/system/package/repository/node.tag/url/node.def b/templates/system/package/repository/node.tag/url/node.def
index 07021671..3fad02e8 100644
--- a/templates/system/package/repository/node.tag/url/node.def
+++ b/templates/system/package/repository/node.tag/url/node.def
@@ -1,4 +1,6 @@
type: txt
+
help: Repository URL
+
# need to prohibit '!' in url (sed delimiter)
syntax:expression: pattern $VAR(@) "^[^!]+$" ; "URL must not be null and must not contain '!'"