jobcore/jobo-setup/joborun-setup

450 lines
16 KiB
Bash
Executable file

#!/bin/zsh
mkdir -p /tmp/jobo-subshell
cd /tmp/jobo-subshell/
cat /etc/fstab >/tmp/jobo-subshell/state.0
cat /etc/locale.gen >>/tmp/jobo-subshell/state.0
cat /etc/timezone >>/tmp/jobo-subshell/state.0
ls -l /etc/localtime >>/tmp/jobo-subshell/state.0
cat /etc/hostname >>/tmp/jobo-subshell/state.0
grep -i hostname /etc/rc.conf >>/tmp/jobo-subshell/state.0
ls -l /boot >>/tmp/jobo-subshell/state.0
ls -l /boot/grub >>/tmp/jobo-subshell/state.0
ls -l /etc/runit/runsvdir/default >>/tmp/jobo-subshell/state.0
clear
cat /etc/motd | grep -v joborun
echo " "
echo " "
echo " As Obarun says, 'control you own data', do not let the system and those who create "
echo " or influence it control you through your data. We just bring you a step or two closer "
echo " to this goal!"
echo " "
echo " "
echo " You choose whether to build your own packages/software, you configure your system,"
echo " and then you get closer in being in control of your data. "
echo " "
echo " "
echo " "
echo " Enter to continue or Ctrl-C to abort the script at any stage"
echo " Run the script over and over again, it will affect nothing unless"
echo " you modify something withing the subshells triggered."
read
clear && cat /etc/motd | grep -v joborun
echo " "
echo " "
echo " Steps of the script - skip as you wish"
echo " _________________________________________________ "
echo " 1 fstab "
echo " 2 locale "
echo " 3 timezone "
echo " 4 hostname "
echo " 5 password "
echo " 6 pacman --init and update/upgrade "
echo " 7 kernel and headers "
echo " 8 bootloader "
echo " 9 configure runit "
echo " 10 add graphic environment (optional) "
echo " 11 reboot "
echo " "
echo " "
echo " Enter to continue or Ctrl-C to abort the script "
read
clear && cat /etc/motd | grep -v joborun
echo " "
echo " "
echo " "
echo " This is a script so you can go from installing the minimal Joborun tarball image"
echo " to a complete bootable installation."
echo " "
echo " "
echo " Hit enter to continue, hit Ctrl-C to abort script "
echo " "
echo " "
read
clear && cat /etc/motd | grep -v joborun
echo " "
echo " "
echo " This script should run as root so on each step where a subshell opens to give you"
echo " the chance to configure the system you will not have to use sudo or doas on each command."
echo " The script itself makes no changes to the system at all, no matter how many times"
echo " it runs. It only takes you step by step to the minimal configurations you should"
echo " make to have a bootable system."
echo " "
echo " "
echo " As we do not believe in handholding automation, we suggest and explain the minimal"
echo " necessary steps, but we do not make automatic/default choices for you, beyond what"
echo " comes from upstream and arch-linux."
echo " "
echo " "
echo " Enter to continue or Ctrl-C to abort the script"
read
clear && cat /etc/motd | grep -v joborun
echo " "
echo " "
echo " 1 fstab "
echo " "
echo " "
echo " First and most crucial step after chrooting into the installation (system partition),"
echo " is to create a good fstab map of mounted systems. We assume you have setup your /boot"
echo " efi partition if used, a swap partition, and all other mountable filesystems, like"
echo " /home /var or /var/cache, etc."
echo " "
echo " "
echo "cat /etc/fstab"
cat /etc/fstab
echo " "
echo " this is your current /etc/fstab and below is your current state of mounted filesystems"
echo " "
df
echo " "
echo " "
echo " This is your current list of partition UUIDs and their labels, if they have any"
echo " "
echo " 'ls -lh /dev/disk/by-uuid'"
ls -lh /dev/disk/by-uuid
echo " "
echo " "
echo "ls -lh /dev/disk/by-label"
ls -lh /dev/disk/by-label
echo " "
echo " "
echo " '% mount /dev/sdc13 /home' will mount sdc13 partition to /home directory,"
echo " '% swapon /dev/sdd32 ' will begin swapping memmory at /dev/sdd32"
echo " You can do this within this sub-shell, enter exit when you are done to continue this script."
zsh
echo " "
echo " .... to continue press enter "
read
clear && cat /etc/motd | grep -v joborun
echo " "
echo " "
echo " Now that you have mounted everything you wanted mounted at boot time, run the"
echo " following command: "
echo " "
echo " % genfstab -U / | grep -v resolv >/tmp/fstab"
echo " "
echo " "
echo " Note that if you are in a chroot session /etc/resolv.conf is mounted from the"
echo " host system, and this should not be included in your fstab. "
echo " "
echo " "
echo " you can point the output to /etc/fstab directly as you are running as root but"
echo " it is best to examine the output before you enter it. To make life easier "
echo " (without flipping from tty to tty or teminal tab to terminal tab), we created"
echo " /tmp/fstab for you"
echo " hit enter to see it!"
echo " "
echo " "
read
genfstab -U / | grep -v resolv >/tmp/fstab
echo " "
cat /tmp/fstab
echo " "
echo " "
echo " you can edit and then as root 'cp /tmp/fstab /etc/fstab' but we are not going"
echo " to assume everything is well, since you know better. When done copy it from tmp"
echo " to etc and then enter ' % mount -a ' to verify you get no errors, '% df ' "
echo " afterwards to see what is mounted, ' % free ' to see that your swap memmory is working."
echo " "
echo " "
echo " You can do this within this sub-shell, enter exit when you are done to continue this script."
echo " "
echo " "
zsh
echo " .... to continue press enter "
read
echo " "
mount -a
echo " "
df
echo " "
free
echo " If the 2nd line of data for command free shows memmory size your swap is enabled"
echo " "
echo " .... if everything seems ok to you and you get no errors after 'mount -a' press"
echo " enter or Ctrl-C to interrupt the script."
read
clear && cat /etc/motd | grep -v joborun
echo " "
echo " "
echo " 2 locale"
echo " "
echo " "
echo " Now we can set the locale of the system."
echo " edit the '/etc/locale.gen' and enter your choice as found in ' /etc/locale.gen.pacnew '"
echo " The current default value is 'cat /etc/locale.gen' :"
echo " "
echo " "
cat /etc/locale.gen
echo " "
echo " "
echo " Run /usr/bin/locale-gen to establish your choice into the system. You can do it within"
echo " this sub-shell, enter exit when you are done to continue this script."
zsh
echo " "
echo " .... to continue press enter "
echo " "
read
clear && cat /etc/motd | grep -v joborun
echo " "
echo " "
echo " 3 timezone "
echo " "
echo " "
echo " We will now select the timezone of the system. Even though that both runit have a"
echo " boot rc configuration file to do so, and 66 has its boot module, it is good practice"
echo " to have the traditional unix timezone set before first boot, if runit or 66 miss doing so."
echo " "
echo " "
echo " You will find a file in /etc/timezone where you can enter your choice."
echo " This is old-school, a practice eliminated by systemd-ish msWin-ish automation."
echo " The new fashion is to link /etc/localtime to a /usr/share/zoneinfo/ choice such as "
echo " the default below"
echo " "
echo " "
echo "/etc/localtime :"
ls -l /etc/localtime
echo " "
echo " enter the sub-shell now and create the link by example root command:"
echo " ' # ln -sf /usr/share/zoneinfo/Europe/Madrid /etc/localtime ' "
echo " for example and verify the results by ' ls -l /etc/localtime ' "
echo " "
echo " "
echo " Again, editing /etc/rc.conf or /etc/runit/rc.conf and filling the fields available"
echo " for runit should take care of all these, but we can t assume you are not trying "
echo " something else as init and service supervision, like minit or sinit. "
echo " "
echo " "
echo " exit the shell to return to the script"
echo " "
zsh
echo " "
echo " Enter to continue or Ctrl-C to abort the script"
echo " "
echo " "
read
clear && cat /etc/motd | grep -v joborun
echo " "
echo " "
echo " 4 hostname"
echo " "
echo " "
echo " For Hostname, simply edit /etc/hostname, or fill the /etc/rc.conf, or enter the "
echo " following command ' # hostname <the systems hostname goes here> ' "
echo " Your current hostname is: "
echo " "
hostname
echo " "
echo " Enter to continue in a sub-shell or Ctrl-C to abort the script, or exit to exit"
echo " the sub-shell and return to the script."
echo " "
echo " "
read
zsh
clear && cat /etc/motd | grep -v joborun
echo " "
echo " "
echo " 5 passwords"
echo " "
echo " "
echo " To set passwords you simply use the passwd command"
echo " ' % passwd ' as root to set roots password"
echo " ' % passwd make ' as root to set user makes password,"
echo " if you havent added other users or changed the name of 'make', do the same"
echo " for your other users."
echo " "
echo " "
echo " To do so now, within this sub-shell enter, then execute the commands by entering"
echo " your password twice when asked, then exit to return to the script."
echo " You should get the output 'your password has been changed' each time"
echo " if you executed passwd correctly."
echo " "
echo " "
read
zsh
echo " "
echo "Enter to continue or Ctrl-C to abort the script"
read
clear && cat /etc/motd | grep -v joborun
echo " "
echo " "
echo " 6 pacman"
echo " "
echo " "
echo " Your system should be up to date, and to have this done as a first time setup you"
echo " need to initialize pacman"
echo " 1st command is ' % pacman-key --init ' "
echo " 2nd comman is ' % pacman -Suy ' "
echo " To do so, do it here, then type exit to continue this script."
echo " "
echo " "
zsh
echo " Enter to continue or Ctrl-C to abort the script"
echo " "
echo " "
read
clear && cat /etc/motd | grep -v joborun
echo " "
echo " "
echo " 7 Kernel choice"
echo " "
echo " "
echo " Choose kernel from joboruns list or from arch by entering on of those as on the list"
echo " 'linux-lts' (5.10 joborun) recommended light LTS"
echo " 'linux' (5.15 joborun) linux LTS 5.15 - best running overall in most machines 5-15y old"
echo " 'linux6.6 (6.6 joborun) linux-lts 6.6 - for v2 or newer machines with similar joborun choices"
echo " Or use arch kernels where ipv6 is enabled, zstd is doing the compression, facilitates systemd choices :) "
echo " 'core/linux' (arch current 6.10?) "
echo " 'core/linux-lts' (arch LTS 6.6)"
echo " 'extra/linux-hardened'"
echo " 'extra/linux-zen'"
echo " "
echo " "
echo " The command to add one kernel and its corresponding header would be such as the 3 examples below: "
echo " 'pacman -S linux-lts linux-lts-headers' "
echo " or "
echo " 'pacman -S extra/linux-zen extra/linux-zen-headers' "
echo " or for kernel and no headers"
echo " 'pacman -S linux-lts' "
echo " To do so, do it here, then type exit to continue this script."
echo " "
echo " "
zsh
echo " Enter to continue or Ctrl-C to abort the script"
echo " "
echo " "
clear && cat /etc/motd | grep -v joborun
echo " "
echo " "
echo " 8 Bootloader "
echo " "
echo " "
echo " First install the bootloader of choice syslinux, lilo, limine, or grub"
echo " are on our repositories."
echo " We will describe a common legacy grub installation here, for anything else go to"
echo " wiki.archlinux.org and follow the instructions there, obarun.org wiki, or our own"
echo " "
echo " Note: if you are not using ext4 as a filesystem, (ie btrfs, xfs, ..), make sure the "
echo " bootloader of choice supports this filesystem. If not you may need an EFI solution"
echo " where the bootloader is on vfat and the system is in you fs of choice. "
echo " "
echo " '% pacman -S grub' "
echo " "
echo " Make sure you have installed a kernel properly by looking at the contents of "
echo " /boot for an initrd image"
echo " "
echo " "
echo " Edit /etc/default/grub if you want specialized configuration, os-prober is pre-installed"
echo " and configured via hook to run during grub configuration. OS-prober scans for other"
echo " installations on the same system, linux/unix or otherwise, and adds an entry on the "
echo " boot screen after Joborun. It is not 100% reliable but mostly works for other systems."
echo " os-prober also works much faster if the systems to be discovered are already mounted."
echo " "
echo " "
echo " '% makedir -p /boot/grub ' "
echo " '% grub-mkconfig -o /boot/grub/grub.cfg' "
echo " To install grub s binary in the MBR of disk 'example: /dev/sda ' simply enter the command: "
echo " '% grub-install /dev/sda' "
echo " To do so, do it here, then type exit to continue this script."
echo " "
echo " "
zsh
echo " Enter to continue or Ctrl-C to abort the script"
echo " "
read
clear && cat /etc/motd | grep -v joborun
echo " "
echo " "
echo " 9 Runit setup"
echo " "
echo " "
echo " It is best to follow the links on our wiki and the links to Void s wiki and/or "
echo " Artix to learn more about how runit works".
echo " For now, and for those that know runit, what is found linked to "
echo " /etc/runit/runsvdir/default directory will be initiated after boot (stage 1)."
echo " To deactivate/disable a service you simply remove the link, this stops supervision,"
echo " doesnt necesseraly end the service, but also look up runsv -d functionality."
echo " To start a service supervision other than an extra tty (/etc/runit/sv/) look up"
echo " the service scripts in /usr/lib/runit/sv Link a service from there to the above"
echo " mentioned .../runsvdir/default/ directory and service supervision for this service"
echo " will immediately start. Void and Artix will tell you to link to /run/runit/..."
echo " which works on a running system but not on a chroot, since /run either does not exist"
echo " or is mounted ro so you can not link anything, or have the system remember what was "
echo " linked in a temporary filesystem. When the system boots what is on the default "
echo " /etc/runit/runsvdir/default will be linked to /run/..."
echo " "
echo " "
echo " For example:"
echo " ' % ln -s /usr/lib/runit/sv/ntpd /etc/runit/runsvdir/default' "
echo " This example shows how you activate/enable service supervision for"
echo " ntpd in runit."
echo " "
echo " "
echo " Runit has a minimalist configuration boot script stored in /etc/rc/rc.conf"
echo " linked for ease of access to /etc/rc.conf. Simply edit /etc/rc.conf to customize"
echo " your runit boot settings."
echo " "
zsh
echo " "
echo " Enter to continue or Ctrl-C to abort the script"
echo " "
read
clear && cat /etc/motd | grep -v joborun
echo " "
echo " "
echo " 10 To add a graphic environment either X11 openbox, jwm, vtwm, etc. "
echo " or a wayland window manager openbox equivalent (labwc) run the "
echo " add-gfx script when you finish setup"
echo " "
echo " "
read
clear && cat /etc/motd | grep -v joborun
echo " "
echo " "
echo " 11 Exit chroot and Reboot "
echo " "
echo " "
echo " You should now be able to exit the chroot, reboot the system, and try a true joborun system."
echo " "
echo " "
echo " If you are unsure of everything done here re-run the script as many times as you like,"
echo " it doesn t hurt anything, it only guides you to do what you want to do. As user also "
echo " look at the scripts stored in the home directory ~/ or /home/make on how to have an X11"
echo " window manager or wayland environment installed, if you that is what you want."
echo " "
echo " "
echo " Enter to finally exit"
echo " "
read
clear && cat /etc/motd | grep -v joborun
echo " "
echo " "
echo " Thank you for trying Joborun"
echo " "
echo " "
cat /etc/fstab
echo " ______________________ "
cat /etc/locale.gen
echo " ______________________ "
cat /etc/timezone
echo " ______________________ "
ls -l /etc/localtime
echo " ______________________ "
cat /etc/hostname
echo " ______________________ "
grep -i hostname /etc/rc.conf
echo " ______________________ "
ls -l /boot
echo " ______________________ "
ls -l /boot/grub
echo " ______________________ "
ls -l /etc/runit/runsvdir/default
echo " ______________________ "
echo " This is what the system configuration looks like now "
echo " Hit enter to see how it was before you started "
echo " "
read
echo " "
echo " __________________________________________________ "
cat /tmp/state.0
echo " __________________________________________________ "
echo " "