Skip to content
This repository was archived by the owner on Jan 16, 2024. It is now read-only.

Commit

Permalink
B #83: Fix route metrics for CentOS
Browse files Browse the repository at this point in the history
+ small refactor
+ fix whitespace

Signed-off-by: Petr Ospalý <[email protected]>
  • Loading branch information
Petr Ospalý authored and Vlastimil Holer committed May 22, 2020
1 parent 3de259b commit a8bed00
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
1 change: 1 addition & 0 deletions pkg/postinstall
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ if [ -d /etc/sysconfig/network-scripts ]; then
# Prepare network files
find /etc/sysconfig/network-scripts -type f \
-name 'ifcfg-*' ! -name 'ifcfg-lo' \
-o -name 'route-*' ! -name 'route-lo' \
-exec rm -f {} \;

if [ "${NETWORK_EC2}" = 'yes' ]; then
Expand Down
11 changes: 5 additions & 6 deletions src/etc/one-context.d/loc-10-network##network-scripts.one
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,11 @@ EOT

if [ -n "$GATEWAY" ]; then
if [ "$CONFIG_PATH" = "/etc/sysconfig/network" ]; then
echo "default $GATEWAY - $DEV" ${METRIC:+metric ${METRIC}} >> /etc/sysconfig/network/ifroute-$DEV
echo "default $GATEWAY - $DEV ${METRIC:+metric ${METRIC}}" \
>> "${CONFIG_PATH}/ifroute-${DEV}"
else
echo "GATEWAY=$GATEWAY"

if [ -n "$METRIC" ]; then
echo "METRIC=$METRIC"
fi
echo "default via $GATEWAY dev $DEV ${METRIC:+metric ${METRIC}}" \
>> "${CONFIG_PATH}/route-${DEV}"
fi
fi

Expand Down Expand Up @@ -244,6 +242,7 @@ gen_network_configuration()
[ -z "${DEV}" ] && continue

(
rm -f /etc/sysconfig/network-scripts/route-$DEV
rm -f /etc/sysconfig/network/ifroute-$DEV
rm -f /etc/sysconfig/network/ifsysctl-$DEV

Expand Down
6 changes: 3 additions & 3 deletions src/etc/one-context.d/loc-10-network-pci##one
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ for pci in $PCI_INTERFACES; do
if [ -n "$IP" ]; then
ip address add $IP/$MASK dev $DEV

if [ -n "$GATEWAY" ]; then
ip route add default via $GATEWAY dev $DEV ${METRIC:+metric ${METRIC}}
fi
if [ -n "$GATEWAY" ]; then
ip route add default via $GATEWAY dev $DEV ${METRIC:+metric ${METRIC}}
fi
fi

# IPv6
Expand Down

0 comments on commit a8bed00

Please sign in to comment.