From e26290c9e88ce568029514d107c30ea29c70de83 Mon Sep 17 00:00:00 2001 From: sean Date: Tue, 9 Jul 2019 16:27:22 -0700 Subject: [PATCH] testing --- setup.sh | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 102 insertions(+), 4 deletions(-) diff --git a/setup.sh b/setup.sh index de91b15..983a15c 100644 --- a/setup.sh +++ b/setup.sh @@ -105,7 +105,8 @@ echo "Done." echo "" echo "Starting debian bootstrap..." -errors=`debootstrap bionic /mnt 2>&1 1>/dev/null` +debootstrap bionic /mnt +#errors=`debootstrap bionic /mnt 2>&1 1>/dev/null` if ! [ "$?" = "0" ]; then echo "Failed to bootstrap root - $errors" exit 6 @@ -164,9 +165,106 @@ mount --rbind /proc /mnt/proc mount --rbind /sys /mnt/sys echo "Done." -echo "" -echo "Downloading chroot configuration script..." -wget -qO - https://code.totosearch.org/Sean/ServerSetup/raw/branch/master/setup-chroot.sh > /mnt/setup-chroot.sh +echo "Entering chroot..." + + + + + + + +echo "#! /bin/bash" > /mnt/setup-chroot.sh + +echo "echo \"\"" >> /mnt/setup-chroot.sh +echo "echo \"Mounting /proc/self/mounts...\"" >> /mnt/setup-chroot.sh +echo "ln -s /proc/self/mounts /etc/mtab" >> /mnt/setup-chroot.sh +echo "echo \"Done.\"" >> /mnt/setup-chroot.sh +echo "echo \"\"" >> /mnt/setup-chroot.sh +echo "echo \"Updating apt repositories inside chroot...\"" >> /mnt/setup-chroot.sh +echo "errors=`apt update 2>&1 1>/dev/null`" >> /mnt/setup-chroot.sh +echo "if ! [ \"$?\" = \"0\" ]; then ">> /mnt/setup-chroot.sh +echo " echo \"Failed to update apt repositories inside chroot - $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 \"\"">> /mnt/setup-chroot.sh +echo "echo \"Setting locale...\"" >> /mnt/setup-chroot.sh +echo "echo 'LANG=\"en_US.UTF-8\"' > /etc/default/locale" >> /mnt/setup-chroot.sh +echo "echo 'LANGUAGE=\"en_US:en\"' >> /etc/default/locale">> /mnt/setup-chroot.sh +echo "echo \"Done.\"" >> /mnt/setup-chroot.sh +#dpkg-reconfigure tzdata +#apt install -y --no-install-recommends linux-image-generic +#apt install -y vim bash screen tmux zfs-initramfs dosfstools openssh-server +echo "i=\"0\"" >> /mnt/setup-chroot.sh +echo "for disk in \"$disks\"; do" >> /mnt/setup-chroot.sh +echo " echo \"mkdosfs -F 32 -s 1 -n EFI /dev/disk/by-id/${disk}-part2\"" >> /mnt/setup-chroot.sh +echo " echo \"mkdir /boot/efi${i}\"" >> /mnt/setup-chroot.sh +echo " echo \"echo PARTUUID=$(blkid -s PARTUUID -o value /dev/disk/by-id/${disk}-part2) /boot/efi${i} vfat nofail,x-systemd.device-timeout=0 0 1 >> /etc/fstab\"" >> /mnt/setup-chroot.sh +echo " echo \"mount /boot/efi${i}\"" >> /mnt/setup-chroot.sh +echo " i=$((i + 1))" >> /mnt/setup-chroot.sh +echo "done" >> /mnt/setup-chroot.sh +echo "apt install -y grub-efi-amd64-signed shim-signed" >> /mnt/setup-chroot.sh +echo "echo \"ubuntu\" | passwd --stdin" >> /mnt/setup-chroot.sh +echo "exit 0" >> /mnt/setup-chroot.sh +#passwd + +#echo "[Unit]\n DefaultDependencies=no\n Before=zfs-import-scan.service\n Before=zfs-import-cache.service\n \n [Service]\n Type=oneshot\n RemainAfterExit=yes\n ExecStart=/sbin/zpool import -N -o cachefile=none bpool\n [Install]\n WantedBy=zfs-import.target " > /etc/systemd/system/zfs-import-bpool.Service" +#systemctl enable zfs-import-bpool.Service + +#cp /usr/sharesystemd/tmp.mount /etc/systemd/system/ +#systemctl enable tmp.mount +#addgroup --system lpadmin +#addgroup --system sambashare + +#zfscheck=`grub-probe /boot` +#update-initramfs -u -k all + +# you need sed to do this right! +# GRUB_CMDLINE_LINUX="root=ZFS=rpool/ROOT/ubuntu" <--- replace this + +#update-grub +#i="0" +#for f in "$disks"; do + #echo "grub-install --target=x86_64-efi --efi-directory=/boot/efi${i} --botloader-id=ubuntu --recheck --no-floppy" + #echo "umount /boot/efi${i}" + #i=$((i + 1)) +#done + +#zfs set mountpoint=legacy bpool/BOOT/ubuntu +#echo bpool/BOOT/ubuntu /boot zfs nodev,relatime,x-systemd.requires=zfs-import-bpool.service 0 0 >> /etc/fstab +#zfs set mountpoint=legacy rpool/var/log +#echo rpool/var/log /var/log zfs nodev,relatime 0 0 >> /etc/fstab +#zfs set mountpoint=legacy rpool/var/spool +#echo rpool/var/spool /var/spool zfs nodev,relatime 0 0 >> /etc/fstab +#zfs set mountpoint=legacy rpool/var/tmp +#echo rpool/var/tmp /var/tmp zfs nodev,relatime 0 0 >> /etc/fstab +#zfs set mountpoint=legacy rpool/tmp +#echo rpool/tmp /tmp zfs nodev,relatime 0 0 >> /etc/fstab +#systemctl enable openssh-server + + + +# create parker user automated way +#zfs create rpool/home/YOURUSERNAME +# adduser YOURUSERNAME +# cp -a /etc/skel/.[!.]* /home/YOURUSERNAME +# chown -R YOURUSERNAME:YOURUSERNAME /home/YOURUSERNAME +# usermod -a -G adm,cdrom,dip,lpadmin,plugdev,sambashare,sudo YOURUSERNAME + +#create swap space, too if necessary + + + + +#exit 0 + + + + + + + + chmod +x /mnt/setup-chroot.sh echo "Done." chroot /mnt /setup-chroot.sh --login