jobcore/jobo-setup/joborun-setup

250 lines
12 KiB
Bash
Executable file

#!/bin/zsh
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 " "
echo "As Obarun says, 'control you own data', do not let the system and those who create or influence it control you through data. We just bring you a step or two closer to this goal!"
echo "You build your own packages/software, you configure your system, and then you get close 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 " 10 reboot"
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 to a complete bootable installation."
echo " Hit enter to continue, hit Ctrl-C to abort script "
read
clear && cat /etc/motd | grep -v joborun
echo " "
echo "This script should run as user using sudo in front, although it can run fine as user alone, it will not be able to make any changes to your system."
echo " "
echo "As we do not believe in handholding automation, we suggest and explain the minimal necessary steps but we do not make automatic/default choices for you."
echo " "
echo "First and most crucial step after chrooting into the installation (system partition), is to create a good fstab map of mounted systems. We assume you have setup your /boot efi partition if used, a swap partition if you so choose, and all other mountable filesystems, like /home /var or /var/cache, etc."
echo " "
echo "Enter to continue or Ctrl-C to abort the script"
read
clear && cat /etc/motd | grep -v joborun
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 " "
echo "This is your current list of partition UUIDs and their labels, if they have any"
df
echo " "
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, ' % swapon /dev/sdd32 ' will begin swapping memmory at /dev/sdd32"
echo " You can do it within this sub-shell, enter exit when you are done to continue the script."
zsh
echo " .... to continue press enter "
read
echo " Now that you have mounted everything you wanted mounted at boot time, run the following command: "
echo " Note that if you are in a chroot session /etc/resolv.conf is mounted from the 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 it is best to examine the output before you enter it. To make life easier (without flipping from tty to tty or teminal tab to terminal tab, we created /tmp/fstab for you, 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 to assume everything is well, since you know better. When done copy it from tmp to etc and then enter ' % mount -a ' to verify you get no errors, '% df ' afterwards to see what is mounted, ' % free ' to see that your swap memmory is working."
echo " "
echo " You can do it within this sub-shell, enter exit when you are done to continue the 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 enter or Ctrl-C to interrupt the script."
read
clear && cat /etc/motd | grep -v joborun
echo " "
echo " 2 locale "
echo " "
echo "now we can set the locale"
echo "edit the '/etc/locale.gen' and enter your choice as found in ' /etc/locale.gen.pacnew ' . The current default value is 'cat /etc/locale.gen' :"
echo "/etc/locale.gen"
cat /etc/locale.gen
echo " "
echo " Run /usr/bin/locale-gen as root to establish your choice into the system. You can do it within this shell, enter exit when you are done to continue the script."
zsh
echo " .... to continue press enter "
read
clear && cat /etc/motd | grep -v joborun
echo " "
echo " 3 timezone "
echo " "
echo "We will now select the timezone of the system. Even though that both runit have a boot rc configuration file to do so, and 66 has its boot module, it is good practice to have the traditional unix timezone set before first boot, if runit or 66 miss doing so."
echo "You will find a file in /etc/timezone where you can enter your choice. This is old-school. The new fashion is to link /etc/localtime to a /usr/share/zoneinfo/ choice such as the default below"
echo "/etc/localtime :"
ls -l /etc/localtime
echo "enter the shell now and create the link by example root command ' # ln -sf /usr/share/zoneinfo/Europe/Madrid /etc/localtime ' for example and verify the results by ' ls -l /etc/localtime ' "
echo "Again, editing /etc/rc.conf or /etc/runit/rc.conf and filling the fields available for runit should take care of all these, but we can't assume you are not trying something else as init and service supervision, like minit or sinit. "
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 " 4 hostname "
echo "Hostname, simply edit /etc/hostname, or fill the /etc/rc.conf, or enter the following command ' # hostname <the system's 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 the sub-shell and return to the script."
read
zsh
clear && cat /etc/motd | grep -v joborun
echo " "
echo " 5 passwords "
echo " To set passwords you simply use the passwd command"
echo " ' % passwd ' as root to set root's password"
echo " ' % passwd make ' as root to set user make password, if you haven't added other users or changed the name of 'make' "
echo " To do so now, within this sub-shell enter, then execute the commands by entering your password twice when asked, then exit to return to the script."
echo " You should get the output 'your password has been changed' 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 " 6 pacman "
echo "Your system should be up to date, and to have this done as a first time you 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 the script."
zsh
echo "Enter to continue or Ctrl-C to abort the script"
read
clear && cat /etc/motd | grep -v joborun
echo " "
echo " 7 Kernel choice"
echo " "
echo "Choose kernel from joborun's 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 "
echo " 'pacman -S linux-lts' "
echo "To do so, do it here, then type exit to continue the script."
zsh
echo "Enter to continue or Ctrl-C to abort the script"
clear && cat /etc/motd | grep -v joborun
echo " "
echo " 8 Bootloader "
echo " First install the bootloader of choice syslinux or grub are on main repositories, lilo and lilo-git are on AUR"
echo " We will describe a common legacy grub installation here, for anything else go to wiki.archlinux.org and follow the instructions there. "
echo " '% pacman -S grub' "
echo " Make sure you have installed a kernel properly by looking at the contents of /boot for an initrd image"
echo " Edit /etc/default/grub if you want specialized configuration, os-prober is pre-installed and configured via hook to run during grub configuration. OS-prober scans for other installations on the same system, linux/unix or otherwise, and adds an entry on the boot screen after Joborun. "
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 the script."
zsh
echo "Enter to continue or Ctrl-C to abort the script"
read
clear && cat /etc/motd | grep -v joborun
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 Artix to learn more about how runit works".
echo " For now, and for those that know runit, what is found linked to /etc/runit/runsvdir/default directory will be initiated after boot (stage 1). To deactivate/disable a service you simply remove the link, this stops supervision, doesn't necesseraly end the service, but also look up runsv -d functionality. To start a service supervision other than an extra tty (/etc/runit/sv/) look up the service scripts in /usr/lib/runit/sv. Link a service from there to the above mentioned .../runsvdir/default/ directory and service supervision for this service will immediately start."
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 ntpd in runit."
echo " Runit has a minimalist configuration boot script stored in /etc/rc/rc.conf linked for ease of access to /etc/rc.conf"
echo " Simply edit /etc/rc.conf to customize your runit boot settings."
zsh
echo "Enter to continue or Ctrl-C to abort the script"
read
echo " To add 66 look up in user's home ~/add.66 setup.66 and if you dislike it ~/rm.66. Runit will still be there unaffected when you finish playing with 66, and you can boot either system if 66 is installed."
echo " It is best you add s6/66 after your first successful boot with runit. "
echo "Enter to continue or Ctrl-C to abort the script"
read
echo "Enter to continue or Ctrl-C to abort the script"
read
clear && cat /etc/motd | grep -v joborun
echo " "
echo " 10 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 'sudo sh /usr/local/bin/joborun-setup' as many times as you need, it doesn't hurt, it only guides you to do what you have to do. As user also look at the scripts stored in the home directory ~/ or /home/make on how to have X installed if you want it, or have s6 and 66 installed and setup."
echo " "
echo "Enter to exit"
read
clear && cat /etc/motd | grep -v joborun
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 " ______________________ "