Skip to content

Commit

Permalink
tinirc: Wait for epair on start
Browse files Browse the repository at this point in the history
This applies to pots without an rc script.

Closes bsdpot#201
  • Loading branch information
grembo committed Feb 7, 2022
1 parent c25c0c7 commit be44c06
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- attribute no-etchosts: an attribute, to not inject additional /etc/hosts entries from `potnet`
- last-run-stats: new command to get statistics on the last run of a pot, currently contains "ExitCode", which is the exit code of pot.cmd (#200)
- start: return with code 125 in case pot.cmd of a non-persistent pot failed (#200)
- tinirc: wait for epair interface, exit early if it doesn't become available (#204)

### Changed
- Stop logging trivial commands like get-rss to syslog by default (#190)
Expand Down
13 changes: 11 additions & 2 deletions share/pot/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,17 @@ _js_vnet()
## if norcscript - write a ad-hoc one
if [ "$(_get_conf_var "$_pname" "pot.attr.no-rc-script")" = "YES" ]; then
touch "${POT_FS_ROOT}/jails/$_pname/m/tmp/tinirc"
echo "ifconfig ${_epairb} inet $_ip netmask $POT_NETMASK" >> "${POT_FS_ROOT}/jails/$_pname/m/tmp/tinirc"
echo "route add default $POT_GATEWAY" >> "${POT_FS_ROOT}/jails/$_pname/m/tmp/tinirc"
cat >>"${POT_FS_ROOT}/jails/$_pname/m/tmp/tinirc" <<-EOT
if ! ifconfig ${_epairb} >/dev/null 2>&1; then
sleep 1
if ! ifconfig ${_epairb} >/dev/null 2>&1; then
>&2 echo "Interface ${_epairb} does not exist"
exit 1
fi
fi
ifconfig ${_epairb} inet $_ip netmask $POT_NETMASK
route add default $POT_GATEWAY
EOT
else # use rc scripts
# set the network configuration in the pot's rc.conf
if [ -w "${POT_FS_ROOT}/jails/$_pname/m/etc/rc.conf" ]; then
Expand Down

0 comments on commit be44c06

Please # to comment.