image_builder: add echo_stamp to other files

This commit is contained in:
Artem Smirnov
2018-08-20 19:06:41 +03:00
parent a008f6b57c
commit 3fc266a061
7 changed files with 211 additions and 57 deletions

View File

@@ -1,9 +1,31 @@
#!/bin/bash
echo -e "\033[0;31m\033[1m$(date) | #1 Rename SSID\033[0m\033[0m"
echo_stamp() {
# STATIC FUNCTION
# TEMPLATE: echo_stamp <TEXT> <TYPE>
# TYPE: SUCCESS, ERROR, INFO
# More info there https://www.shellhacks.com/ru/bash-colors/
TEXT="$(date) | $1"
TEXT="\e[1m$TEXT\e[0m" # BOLD
case "$2" in
SUCCESS)
TEXT="\e[32m${TEXT}\e[0m";; # GREEN
ERROR)
TEXT="\e[31m${TEXT}\e[0m";; # RED
*)
TEXT="\e[34m${TEXT}\e[0m";; # BLUE
esac
echo -e ${TEXT}
}
echo_stamp "#1 Rename SSID"
sudo sed -i.OLD "s/CLEVER/CLEVER-$(head -c 100 /dev/urandom | xxd -ps -c 100 | sed -e 's/[^0-9]//g' | cut -c 1-4)/g" /etc/wpa_supplicant/wpa_supplicant.conf
echo -e "\033[0;31m\033[1m$(date) | #2 Harware setup\033[0m\033[0m"
echo_stamp "#2 Harware setup"
/root/hardware_setup.sh
echo -e "\033[0;31m\033[1m$(date) | #3 End of network installation\033[0m\033[0m"