pilpil-client/utils/cleanup.sh

16 lines
770 B
Bash
Executable File

#!/bin/bash
#
# Empty a few folders
sudo rm -rf /home/pil/.ssh/authorized_keys /home/pil/Videos/* /etc/ssl/private/nginx-selfsigned.key /etc/ssl/certs/nginx-selfsigned.crt
# hostname : Change hostname
echo "pilpil" | sudo tee /etc/hostname
# hosts : Replace with hostname
sudo sed -i 's/\(127.0.1.1\t\).*/\1pilpil/' /etc/hosts
# dhcpcd.conf : Remove 2 last lines
sudo sed -i "$(( $(wc -l < /etc/dhcpcd.conf) - 2 +1 )),$ d" /etc/dhcpcd.conf
# sshd_config : Remove 3 last lines
sudo sed -i "$(( $(wc -l < /etc/ssh/sshd_config) - 3 +1 )),$ d" /etc/ssh/sshd_config
# wpa_supplicant.conf : subs SSID and PW
sudo sed -i 's/\(ssid=\"\).*/\1pilpil\"/' /etc/wpa_supplicant/wpa_supplicant.conf
sudo sed -i 's/\(psk=\"\).*/\1poilpoil\"/' /etc/wpa_supplicant/wpa_supplicant.conf