pilpil-client/utils/cleanup.sh

27 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
#
GIT_URL="https://forge.chapril.org/pilpil/pilpil-client.git"
# dhcpcd.conf : Remove 2 last lines
sed -i "$(( $(wc -l < /etc/dhcpcd.conf) - 2 +1 )),$ d" /etc/dhcpcd.conf
# sshd_config : Remove 3 last lines
sed -i "$(( $(wc -l < /etc/ssh/sshd_config) - 3 +1 )),$ d" /etc/ssh/sshd_config
# wpa_supplicant.conf : subs SSID and PW
sed -i 's/\(ssid=\"\).*/\1pilpil\"/' /etc/wpa_supplicant/wpa_supplicant.conf
sed -i 's/\(psk=\"\).*/\1poilpoil\"/' /etc/wpa_supplicant/wpa_supplicant.conf
# Clear git/ssh credentials
#~ cd /home/pil/pilpil-client/
#~ git config --global --unset credential.helper
#~ git config --local --unset credential.helper
#~ git config --unset credential.helper
#~ rm /home/pil/.ssh/*
# sed -i "s:localgit:$GIT_URL:g" .git/config
# Empty a few folders
rm -rf /home/pil/.ssh/authorized_keys /home/pil/Videos/* /etc/ssl/private/nginx-selfsigned.key /etc/ssl/certs/nginx-selfsigned.crt
# Create dummy file in ~/Videos to reserve some space
dd if=/dev/zero of=/home/pil/Videos/remove_me bs=4MB count=100
# hostname : Change hostname
echo "pilpil" | sudo tee /etc/hostname
# hosts : Replace with hostname
sed -i 's/\(127.0.1.1\t\).*/\1pilpil/' /etc/hosts
#awk '{print $0" consoleblank=1"}' /boot/cmdline.txt