test
sean 7 years ago
parent 40009a0e2f
commit 124dfa2609

@ -271,8 +271,7 @@ echo "cp /usr/share/zoneinfo/$timezone /etc/localtime" >> /mnt/setup-chroot.sh
echo "echo \"Done.\"" >> /mnt/setup-chroot.sh echo "echo \"Done.\"" >> /mnt/setup-chroot.sh
echo "echo \"\"" >> /mnt/setup-chroot.sh echo "echo \"\"" >> /mnt/setup-chroot.sh
echo "echo \"Installing linux image, ifupdown dnsutils nfs-kernel-server apparmor-profiles vim, libvirt-bin, bridge-utils net-tools bash screen tmux zfs-initramfs dosfstools mailutils ssmtp openssh-server ufw docker.io sharutils...\"" >> /mnt/setup-chroot.sh echo "echo \"Installing linux image, ifupdown dnsutils nfs-kernel-server apparmor-profiles vim, libvirt-bin, bridge-utils, net-tools, bash, screen, tmux, zfs-initramfs, dosfstools, mailutils, ssmtp, openssh-server, ufw, docker.io, sharutils...\"" >> /mnt/setup-chroot.sh
echo "errors=\$(DEBCONF_FRONTEND='noninteractive' apt install -y --no-install-recommends linux-image-generic 2>&1 1>/dev/null && apt purge -y netplan 2>&1 1>/dev/null && apt autoremove -y 2>&1 1>/dev/null && DEBCONF_FRONTEND='noninteractive' apt install -y ifupdown dnsutils nfs-kernel-server apparmor-profiles vim libvirt-bin bridge-utils net-tools bash screen tmux zfs-initramfs dosfstools mailutils ssmtp openssh-server ufw docker.io sharutils 2>&1 1>/dev/null)" >> /mnt/setup-chroot.sh echo "errors=\$(DEBCONF_FRONTEND='noninteractive' apt install -y --no-install-recommends linux-image-generic 2>&1 1>/dev/null && apt purge -y netplan 2>&1 1>/dev/null && apt autoremove -y 2>&1 1>/dev/null && DEBCONF_FRONTEND='noninteractive' apt install -y ifupdown dnsutils nfs-kernel-server apparmor-profiles vim libvirt-bin bridge-utils net-tools bash screen tmux zfs-initramfs dosfstools mailutils ssmtp openssh-server ufw docker.io sharutils 2>&1 1>/dev/null)" >> /mnt/setup-chroot.sh
echo 'if ! [ "$?" = "0" ]; then '>> /mnt/setup-chroot.sh echo 'if ! [ "$?" = "0" ]; then '>> /mnt/setup-chroot.sh
@ -474,6 +473,34 @@ if ! [ "$?" = "0" ]; then
exit 45 exit 45
fi fi
echo "echo \"\"" >> /mnt/setup-chroot.sh
echo "echo \"Enabling UFW and apparmor on boot...\"" >> /mnt/setup-chroot.sh
echo "errors=\$(systemctl enable ufw 2>&1 1>/dev/null && systemctl enable apparmor 2>&1 1>/dev/null)" >> /mnt/setup-chroot.sh
echo 'if ! [ "$?" = "0" ]; then '>> /mnt/setup-chroot.sh
echo ' echo "Failed to enable UFW - $errors"' >> /mnt/setup-chroot.sh
echo " exit 1">> /mnt/setup-chroot.sh
echo "fi">> /mnt/setup-chroot.sh
echo "echo \"Done.\"" >> /mnt/setup-chroot.sh
echo "echo \"0 0 * * 1 /zfshealth.sh\" | crontab" >> /mnt/setup-chroot.sh
echo "systemctl unmask cron 2>/dev/null 1>/dev/null; systemctl enable cron 2>/dev/null 1>/dev/null" >> /mnt/setup-chroot.sh
chroot /mnt /setup-chroot.sh chroot /mnt /setup-chroot.sh
if ! [ "$?" = "0" ]; then if ! [ "$?" = "0" ]; then
exit $? exit $?
@ -509,17 +536,7 @@ echo " bridge_stp on" >> /mnt/etc/network/interfaces.d/br0
echo "source-directory /etc/network/interfaces.d" > /mnt/etc/network/interfaces echo "source-directory /etc/network/interfaces.d" > /mnt/etc/network/interfaces
echo "Done." echo "Done."
echo "echo \"\"" >> /mnt/setup-chroot.sh
echo "echo \"Enabling UFW and apparmor on boot...\"" >> /mnt/setup-chroot.sh
echo "errors=\$(systemctl enable ufw 2>&1 1>/dev/null && systemctl enable apparmor 2>&1 1>/dev/null)" >> /mnt/setup-chroot.sh
echo 'if ! [ "$?" = "0" ]; then '>> /mnt/setup-chroot.sh
echo ' echo "Failed to enable UFW - $errors"' >> /mnt/setup-chroot.sh
echo " exit 1">> /mnt/setup-chroot.sh
echo "fi">> /mnt/setup-chroot.sh
echo "echo \"Done.\"" >> /mnt/setup-chroot.sh
echo "systemctl unmask cron 2>/dev/null 1>/dev/null; systemctl enable cron 2>/dev/null 1>/dev/null" >> /mnt/setup-chroot.sh
#crontab -l > mycron #crontab -l > mycron
#echo new cron into cron file #echo new cron into cron file
#echo "00 09 * * 1-5 echo hello" >> mycron #echo "00 09 * * 1-5 echo hello" >> mycron
@ -576,7 +593,6 @@ echo "fi" >> /mnt/zfshealth.sh
echo "echo -e \"\$emailMessage \n\n\n \`/sbin/zpool list\` \n\n\n \`/sbin/zpool status\`\" | mail -r \"${email}\" -s \"\$emailSubject\" \"${admins}\"" >> /mnt/zfshealth.sh echo "echo -e \"\$emailMessage \n\n\n \`/sbin/zpool list\` \n\n\n \`/sbin/zpool status\`\" | mail -r \"${email}\" -s \"\$emailSubject\" \"${admins}\"" >> /mnt/zfshealth.sh
echo "if [ \"\$problems\" -ne 0 ]; then logger \$emailSubject; fi" >> /mnt/zfshealth.sh echo "if [ \"\$problems\" -ne 0 ]; then logger \$emailSubject; fi" >> /mnt/zfshealth.sh
echo "echo \"0 0 * * 1 /zfshealth.sh\" | crontab" >> /mnt/zfshealth.sh
chmod +x /mnt/zfshealth.sh chmod +x /mnt/zfshealth.sh

Loading…
Cancel
Save