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

View file

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