-
-
Save Blackdixxa/de16e8066813ea79a87b68dddbe80b5a to your computer and use it in GitHub Desktop.
Restore custom config into edgerouter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# to be stored into /config/scripts/post-config.d/10_restore-custom.sh | |
config_root=/config/user-data/root/ | |
cp /config/user-data/root/sbin/dhclient3 /sbin/ | |
dpkg -i /config/user-data/root/unbound_install/*.deb | |
mkdir /unbound_install | |
mkdir -p /var/log/vlmcsd | |
mkdir -p /opt/kms | |
useradd vlmcsd | |
# custom PS1 | |
sed -i -e 's/^PS1=.*$/PS1='"'"'\\[\\033[01;32m\\]\\u@\\h\\[\\033[01;34m\\] \\w \\$\\[\\033[00m\\] '"'"'/' /etc/bash.bashrc | |
# disable ipv6 on eth2 because I do not use the tunnel from sfr | |
echo 0 > /proc/sys/net/ipv6/conf/eth0/disable_ipv6 | |
# synchronize the config tree with root | |
if [ ! -d "$config_root" ]; then | |
echo "Nothing to sync" | |
exit 0 | |
fi | |
find "$config_root" -type f -print | \ | |
while read i; | |
do | |
target=$(echo $i | cut -d'/' -f5-) | |
cp "$i" "/$target" | |
done | |
# adjust kms permissions & start service | |
chown vlmcsd:vlmcsd /var/log/vlmcsd | |
chmod +x /opt/kms/vlmcsd | |
systemctl enable vlmcsd | |
# specific tasks for ipsec | |
ipsec rereadall | |
ipsec reload | |
# specific tasks for unbound | |
curl "https://pgl.yoyo.org/adservers/serverlist.php?hostformat=unbound&showintro=1&mimetype=plaintext" > /etc/unbound/unbound_ad_servers | |
install -d -o unbound -g unbound -m 755 /var/log/unbound | |
service unbound restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment