jobcore/jobo-setup/joborun-setup

381 lines
14 KiB
Bash
Executable file

#!/bin/zsh
mkdir -p /tmp/jobo-subshell
cd /tmp/jobo-subshell
cat /etc/fstab >/tmp/state.0
cat /etc/locale.gen >>/tmp/state.0
cat /etc/timezone >>/tmp/state.0
ls -l /etc/localtime >>/tmp/state.0
cat /etc/hostname >>/tmp/state.0
grep -i hostname /etc/rc.conf >>/tmp/state.0
ls -l /boot >>/tmp/state.0
ls -l /boot/grub >>/tmp/state.0
ls -l /etc/runit/runsvdir/default >>/tmp/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"
read
clear && cat /etc/motd | grep -v joborun
echo " "
echo " "
echo " Steps of the script "
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 " 9.1 add s6 and 66"
echo " 10 configure .xinitrc"
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 " This is a script so you can go from installing the minimal Joborun tarball image"
echo " to a complete bootable installation."
echo " "
echo " Hit enter to continue, hit Ctrl-C to abort script "
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 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 " 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."
echo " "
echo " "
echo "Enter to continue or Ctrl-C to abort the script"
read
clear && cat /etc/motd | grep -v joborun
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 " 1 fstab "
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 " 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 "ls -lh /dev/disk/by-label"
ls -lh /dev/disk/by-label
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 " .... to continue press enter "
read
echo " Now that you have mounted everything you wanted mounted at boot time, run the"
echo " following command: "
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 " % genfstab -U / | grep -v resolv >/tmp/fstab"
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!"
read
genfstab -U / | grep -v resolv >/tmp/fstab
echo " "
cat /tmp/fstab
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 " You can do this within this sub-shell, enter exit when you are done to continue this script."
zsh
echo " .... to continue press enter "
read
mount -a
df
free
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 " "
cat /etc/locale.gen
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 " .... to continue press enter "
read
clear && cat /etc/motd | grep -v joborun
echo " "
echo " "
echo " 3 timezone "
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 " 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 "/etc/localtime :"
ls -l /etc/localtime
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 " 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 " exit the shell to return to the script"
zsh
echo " Enter to continue or Ctrl-C to abort the script"
read
clear && cat /etc/motd | grep -v joborun
echo " "
echo " "
echo " 4 hostname"
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: "
hostname
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."
read
zsh
clear && cat /etc/motd | grep -v joborun
echo " "
echo " "
echo " 5 passwords"
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 " 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."
read
zsh
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 " 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."
zsh
echo " Enter to continue or Ctrl-C to abort the script"
read
clear && cat /etc/motd | grep -v joborun
echo " "
echo " "
echo " 7 Kernel choice"
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 previous LTS"
echo " 'linux' (5.15 joborun) current linux LTS "
echo " 'linux-lts54' (5.4 joborun older LTS)"
echo " 'core/linux' (arch current) "
echo " 'core/linux-lts' (arch LTS 5.15)"
echo " 'extra/linux-hardened'"
echo " 'extra/linux-zen'"
echo " "
echo " The command to add one kernel and its corresponding header would be such as the 3 examples below: "
echo " 'pacman -S linux-lts54 linux-lts54-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."
zsh
echo " Enter to continue or Ctrl-C to abort the script"
clear && cat /etc/motd | grep -v joborun
echo " "
echo " "
echo " 8 Bootloader "
echo " First install the bootloader of choice syslinux or grub are on main repositories,"
echo " lilo and lilo-git are on AUR, you can use cower to download and build 'cower -d lilo-git'"
echo " We will describe a common legacy grub installation here, for anything else go to"
echo " wiki.archlinux.org and follow the instructions there. "
echo " "
echo " '% pacman -S grub' "
echo " Make sure you have installed a kernel properly by looking at the contents of "
echo " /boot for an initrd image"
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. "
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."
zsh
echo " Enter to continue or Ctrl-C to abort the script"
read
clear && cat /etc/motd | grep -v joborun
echo " "
echo " "
echo " 9 Runit setup"
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."
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 " 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."
zsh
echo " Enter to continue or Ctrl-C to abort the script"
read
clear && cat /etc/motd | grep -v joborun
echo " "
echo " 9.1 add s6 & 66 "
echo " "
echo " "
echo " To add 66 run the add.66 script then setup.66 to setup the system. "
echo " If you reboot and decide you don t want it, execute rm.66 and "
echo " s6/66 will be removed "
echo " Runit will still be there unaffected when you finish playing with 66, and you can"
echo " boot either system if 66 is installed. "
echo " "
echo " It is best you add s6/66 after your first successful boot with runit, unless you"
echo " are really proficient with both systems."
echo " "
echo " Enter to continue or Ctrl-C to abort the script"
read
clear && cat /etc/motd | grep -v joborun
echo " "
echo " "
echo " Enter to continue or Ctrl-C to abort the script"
read
clear && cat /etc/motd | grep -v joborun
echo " "
echo " "
echo " 10 Your .xinitrc "
echo " "
echo " Whether you use the xinit command, or startx, to start"
echo " your X session your ~/.xinitrc should have at least one"
echo " executable command in it."
echo " exec jwm"
echo " for starting a jwm session "
echo " exec openbox-session"
echo " for starting an openbox session"
echo " exec vtwm"
echo " for starting a vtwm session "
echo " "
echo " To do so, do it here, simply edit as user ~/.xinitrc then type exit to continue this script."
zsh
echo " "
echo " Now, next time you login to your shell type xinit or startx and your favorite window"
echo " manager will start up."
echo " "
echo " "
echo " Enter to finally get to the last step of your configuration."
read
clear && cat /etc/motd | grep -v joborun
echo " "
echo " 11 Exit chroot and Reboot "
echo " "
echo " You should now be able to exit the chroot, reboot the system, and try a true joborun system."
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 have to do. As user also "
echo " look at the scripts stored in the home directory ~/ or /home/make on how to have X wm"
echo " environment installed if you want it, or have s6 and 66 installed and set up."
echo " "
echo " Enter to finally exit"
read
clear && cat /etc/motd | grep -v joborun
echo " "
echo " "
echo " Thank you for trying Joborun"
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 s configuration looks like now "
echo " Hit enter to see the picture before you started "
read
echo " __________________________________________________ "
cat /tmp/state.0
echo " __________________________________________________ "