Compare commits
16
Commits
nobridge
...
a0ec5ea341
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a0ec5ea341 | ||
|
|
b094e07be8 | ||
|
|
10f2e69e1d | ||
|
|
0427f538aa | ||
|
|
308adda9f6 | ||
|
|
25395bac75 | ||
|
|
2af9bab0e9 | ||
|
|
6558be3494 | ||
|
|
1a981e96eb | ||
|
|
f53d7e663c | ||
|
|
2eb3cbed10 | ||
|
|
cb45754131 | ||
|
|
f5f897f70d | ||
|
|
8ed5b7181f | ||
|
|
96e16483fc | ||
|
|
a47d06dc27 |
@@ -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
|
||||
+16
-6
@@ -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>/dev/null && apt-get update 2>&1 >/dev/null && apt-get install -y zfs-initramfs`
|
||||
if [ "$?" = "0" ]; then
|
||||
echo "Done."
|
||||
else
|
||||
@@ -12,7 +12,8 @@ fi
|
||||
|
||||
echo ""
|
||||
echo "Importing boot pool and main OS pool..."
|
||||
errors=$(zfs export -a 2>&1 1>/dev/null && zfs import -N -R /mnt rpool 2>&1 1>/dev/null && zfs 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)
|
||||
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
|
||||
@@ -31,10 +32,19 @@ fi
|
||||
echo "Done."
|
||||
|
||||
echo ""
|
||||
echo "Entering chroot..."
|
||||
echo "Please execute \"mount /boot\" to access boot partition, type exit to leave:"
|
||||
echo "Entering chroot, type \"exit\" to leave..."
|
||||
echo ""
|
||||
chroot /mnt /bin/bash --login
|
||||
|
||||
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"
|
||||
@@ -45,7 +55,7 @@ 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)
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user