pilpil-client/utils/cleanup.sh

18 lines
887 B
Bash
Raw Normal View History

#!/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
2022-10-21 17:45:22 +02:00
# Create dummy file in ~/Videos to reserve some space
dd if=/dev/zero of=/home/pil/Videos/remove_me bs=4MB count=100