Bugfix for jail_list

If jail_list wasn't already defined in /etc/rc.conf, gencode-remote wasn't adding the variable to the file.
This commit is contained in:
Jake Guffey 2012-04-06 13:32:59 -04:00
parent ace13f3582
commit f5437ccce6
1 changed files with 6 additions and 1 deletions

View File

@ -266,7 +266,12 @@ if [ "$onboot" = "true" ]; then
cat <<EOF
eval \$(grep '^jail_list=' /etc/rc.conf)
jail_list="\${jail_list} ${name}"
sed -i '.bak' "s/^jail_list=\".*\"/jail_list=\"\${jail_list}\"/" /etc/rc.conf
grep -q '^jail_list=' /etc/rc.conf
if [ "\$?" -eq "0" ]; then
sed -i '.bak' "s/^jail_list=\".*\"/jail_list=\"\${jail_list}\"/" /etc/rc.conf
else
echo jail_list=\"\${jail_list}\" >>/etc/rc.conf
fi
unset jail_list
rm -f /etc/rc.conf.bak
EOF