Compare commits

18 Commits
Author SHA1 Message Date
Sean a0ec5ea341 tweaks 2019-08-02 12:18:14 -07:00
Sean b094e07be8 tweaks 2019-08-02 12:13:53 -07:00
Sean 10f2e69e1d tweaks 2019-08-02 12:13:16 -07:00
Sean 0427f538aa tweaks 2019-08-02 12:12:14 -07:00
Sean 308adda9f6 tweaks 2019-08-02 12:11:40 -07:00
Sean 25395bac75 tweaks 2019-08-02 12:09:01 -07:00
Sean 2af9bab0e9 tweaks 2019-08-02 12:08:18 -07:00
Sean 6558be3494 tweaks 2019-08-02 12:08:01 -07:00
Sean 1a981e96eb tweaks 2019-08-02 12:07:38 -07:00
Sean f53d7e663c tweaks 2019-08-02 12:05:24 -07:00
Sean 2eb3cbed10 tweaks 2019-08-02 12:02:27 -07:00
Sean cb45754131 tweaks 2019-08-02 11:55:13 -07:00
Sean f5f897f70d tweaks 2019-08-02 11:54:04 -07:00
Sean 8ed5b7181f tweaks 2019-08-02 11:53:28 -07:00
Sean 96e16483fc tweaks 2019-08-02 11:51:44 -07:00
Sean a47d06dc27 tweaks 2019-08-02 11:46:44 -07:00
Sean 779f1a4e58 Added basic maintenance script for testing 2019-08-02 11:39:55 -07:00
sean 7da8c6301c Modified server script to do a full ZFS root install with security features and UEFI support (no BIOS support yet) 2019-07-29 12:26:40 -07:00
3 changed files with 72 additions and 2 deletions
+4 -1
View File
@@ -1,5 +1,8 @@
Server Setup Script
=====================
#Use#
#Setup#
wget -qO - https://code.totosearch.org/Sean/ServerSetup/raw/branch/master/setup.sh | sudo bash
#Maintenance#
wget -qO - https://code.totosearch.org/Sean/ServerSetup/raw/branch/master/maintenance.sh | sudo bash
+67
View File
@@ -0,0 +1,67 @@
#! /bin/bash
echo ""
echo "Updating local packages..."
errors=`apt-add-repository universe >/dev/null 2>/dev/null && apt-get update 2>&1 >/dev/null && apt-get install -y zfs-initramfs`
if [ "$?" = "0" ]; then
echo "Done."
else
echo "Failed to add universal repository, update apt repository - $errors"
exit 1
fi
echo ""
echo "Importing boot pool and main OS pool..."
errors=$(zpool export -a 2>&1 1>/dev/null && zpool import -N -R /mnt rpool 2>&1 1>/dev/null && zpool import -N -R /mnt bpool 2>&1 1>/dev/null && zfs mount rpool/ROOT/ubuntu 2>&1 1>/dev/null)
# && zfs mount -a 2>&1 1>/dev/null
if [ "$?" = "0" ]; then
echo "Done."
else
echo "Failed to mount bpool or rpool - $errors"
exit 2
fi
echo ""
echo "Binding mounts..."
errors=`mount --rbind /dev /mnt/dev 2>&1 1>/dev/null && mount --rbind /proc /mnt/proc 2>&1 1>/dev/null && mount --rbind /sys /mnt/sys 2>&1 1>/dev/null`
if ! [ "$?" = "0" ]; then
echo "Failed to bind mounts - $errors"
exit 4
fi
echo "Done."
echo ""
echo "Entering chroot, type \"exit\" to leave..."
echo ""
echo "#!/bin/bash" > /mnt/maintenance.sh
chmod +x /mnt/maintenance.sh
echo "zfs mount -a && mount /boot" >> /mnt/maintenance.sh
echo "/bin/bash" >> /mnt/maintenance.sh
echo "umount /boot" >> /mnt/maintenance.sh
echo "zfs umount -a" >> /mnt/maintenance.sh
chroot /mnt /maintenance.sh --login < /dev/tty
rm /mnt/maintenance.sh
if ! [ "$?" = "0" ]; then
echo "Chroot failed with an error"
exit $?
fi
echo ""
echo "Unbinding mounts..."
errors=`mount | grep -v zfs | tac | awk '/\\/mnt/ {print \$3}' | xargs -i{} umount -lf \{\} 2>&1 1>/dev/null && zpool export -a 2>&1 1>/dev/null`
if ! [ "$?" = "0" ]; then
echo "Failed to unbind mounts - $errors"
exit 4
fi
echo "Done."
echo ""
exit 0
+1 -1
View File
@@ -2,7 +2,7 @@
echo ""
echo "Updating local packages..."
errors=`apt-add-repository universe >/dev/null 2>/dev/null && apt update 2>&1 >/dev/null`
errors=`apt-add-repository universe >/dev/null 2>&1 1>/dev/null && apt update 2>&1 >/dev/null`
if [ "$?" = "0" ]; then
echo "Done."
else