Commit 5ad41b18 authored by Ophélie Gagnard's avatar Ophélie Gagnard

installation: Create get-network.sh from host information.

parent 1c959167
#!/bin/bash
# Generate /etc/opt/slapos/get-network.sh
# from "$GIT_ROOT"/installation/get-network.sh.in
# using "$GIT_ROOT"/installation/display-host-information.sh
set -e
# get the root of the git repository (requires git to be installed)
GIT_ROOT=$(git rev-parse --show-toplevel)
cd "$GIT_ROOT"
source "$GIT_ROOT"/installation/display-host-information.sh
sed "s|%DEFAULT_NETMASK%|$DEFAULT_NETMASK|g;s|%DEFAULT_NETMASK_NUMBER%|$DEFAULT_NETMASK_NUMBER|g;s|%DEFAULT_INTERFACE%|$DEFAULT_INTERFACE|g;s|%DEFAULT_ROUTER%|$DEFAULT_ROUTER|g;s|%DEFAULT_IP%|$DEFAULT_IP|g" "$GIT_ROOT"/installation/get-network.sh.in > /etc/opt/slapos/get-network.sh
echo -e "nameserver 1.1.1.1\nnameserver 8.8.8.8" > /etc/resolv.conf
ip a del dev %DEFAULT_INTERFACE% 10.42.42.42/32
ip a add dev %DEFAULT_INTERFACE% %DEFAULT_IP%/%DEFAULT_NETMASK_NUMBER%
ip r del default via 10.42.42.42 dev eno1
ip l set %DEFAULT_INTERFACE% up
ip r add default via %DEFAULT_ROUTER% dev %DEFAULT_INTERFACE% onlink
ip r add %DEFAULT_NETMASK% dev %DEFAULT_INTERFACE% proto kernel scope link src %DEFAULT_IP%
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment