Update 2018
This commit is contained in:
parent
d311f9e7da
commit
96635f6bab
1 changed files with 41 additions and 23 deletions
64
setup-usl-mm
64
setup-usl-mm
|
@ -1,23 +1,36 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
pre_reboot_script () {
|
pre_reboot_script () {
|
||||||
echo "Setting timezone to Prague"
|
|
||||||
timedatectl set-timezone Europe/Prague
|
|
||||||
|
|
||||||
echo "Installing requirements"
|
pass_var=$(dialog --passwordbox "Enter password to crypted partition for containers:" 25 25 --output-fd 1)
|
||||||
apt install cryptsetup ecryptfs-utils zfsutils-linux -y
|
pass_var2=$(dialog --passwordbox "Enter password to crypted partition for containers again:" 25 25 --output-fd 1)
|
||||||
|
|
||||||
|
if [ "$pass_var" == "$pass_var2" ]; then
|
||||||
|
echo "Passwords match!"
|
||||||
|
else
|
||||||
|
echo "Passwords not match!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Exec ifconfig"
|
||||||
|
ifconfig
|
||||||
|
read -p "Enter interface for configure bridge:" NET_IF
|
||||||
|
|
||||||
|
echo "Starting lsblk"
|
||||||
|
lsblk
|
||||||
|
read -p "Enter partition to encrypt:" PARTITION
|
||||||
|
|
||||||
|
echo "Installing requirements"
|
||||||
|
apt install cryptsetup ecryptfs-utils zfsutils-linux -y
|
||||||
|
|
||||||
|
echo "Setting timezone to Prague"
|
||||||
|
timedatectl set-timezone Europe/Prague
|
||||||
|
|
||||||
echo "Disabling zpool auto-scrub"
|
echo "Disabling zpool auto-scrub"
|
||||||
sed -i 's/^/#/' /etc/cron.d/zfsutils-linux
|
sed -i 's/^/#/' /etc/cron.d/zfsutils-linux
|
||||||
|
|
||||||
echo "Starting ecryptfs-setup-swap"
|
echo "Starting ecryptfs-setup-swap"
|
||||||
ecryptfs-setup-swap
|
ecryptfs-setup-swap -f
|
||||||
|
|
||||||
echo "Starting lsblk"
|
|
||||||
lsblk
|
|
||||||
|
|
||||||
read -p "Enter partition to encrypt:" PARTITION
|
|
||||||
pass_var=$(dialog --passwordbox "Enter password to crypted partition:" 25 25 --output-fd 1)
|
|
||||||
|
|
||||||
echo "Starting luksFormat"
|
echo "Starting luksFormat"
|
||||||
echo -n "$pass_var" | cryptsetup luksFormat $PARTITION -
|
echo -n "$pass_var" | cryptsetup luksFormat $PARTITION -
|
||||||
|
@ -60,9 +73,6 @@ pre_reboot_script () {
|
||||||
update-initramfs -u
|
update-initramfs -u
|
||||||
|
|
||||||
echo "Configuring network to use bridge"
|
echo "Configuring network to use bridge"
|
||||||
echo "Exec ifconfig"
|
|
||||||
ifconfig
|
|
||||||
read -p "Enter interface for configure bridge:" NET_IF
|
|
||||||
echo "auto lo" > /etc/network/interfaces
|
echo "auto lo" > /etc/network/interfaces
|
||||||
echo "iface lo inet loopback" >> /etc/network/interfaces
|
echo "iface lo inet loopback" >> /etc/network/interfaces
|
||||||
echo " " >> /etc/network/interfaces
|
echo " " >> /etc/network/interfaces
|
||||||
|
@ -89,15 +99,23 @@ echo " bridge_fd 0" >> /etc/network/interfaces
|
||||||
apt update
|
apt update
|
||||||
apt dist-upgrade -y
|
apt dist-upgrade -y
|
||||||
|
|
||||||
echo "Creating onstart script in /root"
|
echo "Creating onstart script in /root"
|
||||||
echo "#!/bin/bash" > /root/onstart
|
echo "#!/bin/bash" > /root/onstart
|
||||||
echo "read -p \"Press any button to start...\"" >> /root/onstart
|
echo "read -p \"Press any button to start...\"" >> /root/onstart
|
||||||
echo "pass_var=\$(dialog --passwordbox \"Enter password:\" 25 25 --output-fd 1)" >> /root/onstart
|
echo "pass_var=\$(dialog --passwordbox \"Enter password:\" 25 25 --output-fd 1)" >> /root/onstart
|
||||||
|
echo "pass_var2=\$(dialog --passwordbox \"Enter password again:\" 25 25 --output-fd 1)" >> /root/onstart
|
||||||
|
echo "if [ \"\$pass_var\" == \"\$pass_var2\" ]; then" >> /root/onstart
|
||||||
|
echo "echo \"Passwords match!\"" >> /root/onstart
|
||||||
|
echo "else" >> /root/onstart
|
||||||
|
echo "echo \"Passwords not match!\"" >> /root/onstart
|
||||||
|
echo "exit 1" >> /root/onstart
|
||||||
|
echo "fi" >> /root/onstart
|
||||||
echo "echo \"Opening encrypted partition\"" >> /root/onstart
|
echo "echo \"Opening encrypted partition\"" >> /root/onstart
|
||||||
echo "echo \$pass_var | cryptsetup open $PARTITION crypt -c -" >> /root/onstart
|
echo "echo \$pass_var | cryptsetup open $PARTITION crypt -c -" >> /root/onstart
|
||||||
echo "partprobe" >> /root/onstart
|
echo "partprobe" >> /root/onstart
|
||||||
echo "zpool import -d /dev/mapper crypt -f -m" >> /root/onstart
|
echo "zpool import -d /dev/mapper crypt -f -m" >> /root/onstart
|
||||||
echo "systemctl start lxd" >> /root/onstart
|
echo "systemctl start lxd" >> /root/onstart
|
||||||
|
|
||||||
chmod +x /root/onstart
|
chmod +x /root/onstart
|
||||||
read -p "Press any key for reboot"
|
read -p "Press any key for reboot"
|
||||||
reboot
|
reboot
|
||||||
|
|
Loading…
Reference in a new issue