Page MenuHomeDevCentral

routes.sh
No OneTemporary

routes.sh

#!/bin/sh
# -------------------------------------------------------------
# Network — routes configuration for Linux systems
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# License: Trivial work, not eligible to copyright
# Source file: roles/core/network/files/Linux/routes.sh
# Dependencies: iproute
# GNU xargs for -r
# -------------------------------------------------------------
#
# <auto-generated>
# This file is managed by our rOPS SaltStack repository.
#
# Changes to this file may cause incorrect behavior
# and will be lost if the state is redeployed.
# </auto-generated>
ROUTES_CONFIG_PATH=/etc/routes.conf
# -------------------------------------------------------------
# Ensure user is root
#
# Note: POSIX shells don't always define $UID or $EUID.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# shellcheck disable=SC3028
if [ "${EUID:-$(id -u)}" -ne 0 ]; then
echo "This command must be run as root." >&2
exit 1
fi
# Warn about configuration missing
if [ ! -f $ROUTES_CONFIG_PATH ]; then
echo No routes configuration file found at $ROUTES_CONFIG_PATH >&2
exit 2
fi
# Apply routes
# Ignore comments and blank line, pass the remaining lines to `ip route`
grep '^[^#]' $ROUTES_CONFIG_PATH | xargs -L 1 -r ip route replace

File Metadata

Mime Type
text/x-shellscript
Expires
Fri, Nov 6, 21:50 (1 d, 43 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3979603
Default Alt Text
routes.sh (1 KB)

Event Timeline