3-xen-orchestra-install #4
							
								
								
									
										139
									
								
								setup.sh
									
									
									
									
									
								
							
							
						
						
									
										139
									
								
								setup.sh
									
									
									
									
									
								
							| @@ -289,13 +289,6 @@ function copy_zpool_cache () { | |||||||
|     zpool set 'cachefile=/etc/zfs/'"${zpool_name}"'.cache' "${zpool_name}" |     zpool set 'cachefile=/etc/zfs/'"${zpool_name}"'.cache' "${zpool_name}" | ||||||
| } | } | ||||||
|  |  | ||||||
| function pacman_dl_parallel () { |  | ||||||
|     #2.4 |  | ||||||
|     # We're setting this in Arch Linux ISO CD while we install proper Arch. |  | ||||||
|     # No need to revert this later as it is ephemeral anyway. |  | ||||||
|     sed -ri -e 's'$'\x1''^.*?(ParallelDownloads)[^\r\n\f]*'$'\x1''\1 = 20'$'\x1''g' '/etc/pacman.conf' |  | ||||||
| } |  | ||||||
|  |  | ||||||
| function pacman_dont_check_space () { | function pacman_dont_check_space () { | ||||||
|     # See pacman bug comment |     # See pacman bug comment | ||||||
|     # https://bugs.archlinux.org/task/45070#comment142712 |     # https://bugs.archlinux.org/task/45070#comment142712 | ||||||
| @@ -406,13 +399,6 @@ function add_zfs_files_to_new_os () { | |||||||
|     done |     done | ||||||
| } | } | ||||||
|  |  | ||||||
| function enter_chroot () { |  | ||||||
|     #2.1 |  | ||||||
|     arch-chroot /mnt /bin/bash -xe <<EOF |  | ||||||
| curl --silent '${this_script_url}' | bash |  | ||||||
| EOF |  | ||||||
| } |  | ||||||
|  |  | ||||||
| function create_unpriv_user () { | function create_unpriv_user () { | ||||||
|     account_name="${1:?}" |     account_name="${1:?}" | ||||||
|     full_name="${2:-${account_name}}" |     full_name="${2:-${account_name}}" | ||||||
| @@ -424,6 +410,52 @@ function create_unpriv_user () { | |||||||
|     chown -R "${account_name}"':' '/home/'"${account_name}"; chmod -R 'u=rwX,go=' "$(dirname "${authorized_keys_abs_path}")" |     chown -R "${account_name}"':' '/home/'"${account_name}"; chmod -R 'u=rwX,go=' "$(dirname "${authorized_keys_abs_path}")" | ||||||
| } | } | ||||||
|  |  | ||||||
|  | function enter_chroot () { | ||||||
|  |     #2.1 | ||||||
|  |     arch-chroot /mnt /bin/bash -xe <<EOF | ||||||
|  | curl --silent '${this_script_url}' | bash | ||||||
|  | EOF | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function keep_initiramfs_root_only_rw () { | ||||||
|  |     #2.3 | ||||||
|  |     declare systemd_local_admin_override_path unit_name | ||||||
|  |     systemd_local_admin_override_path='/etc/systemd/system' | ||||||
|  |     unit_name='chmod-initramfs' | ||||||
|  |     path_unit="${systemd_local_admin_override_path%/}"'/'"${unit_name}"'.path' | ||||||
|  |     service_unit="${systemd_local_admin_override_path%/}"'/'"${unit_name}"'.service' | ||||||
|  |  | ||||||
|  |     cat > "${path_unit}" <<"EOF" | ||||||
|  | [Unit] | ||||||
|  | Description=chmod initramfs to be root-read-writable only | ||||||
|  |  | ||||||
|  | [Path] | ||||||
|  | PathChanged=/boot/initramfs-linux.img | ||||||
|  |  | ||||||
|  | [Install] | ||||||
|  | WantedBy=multi-user.target | ||||||
|  | WantedBy=system-update.target | ||||||
|  | EOF | ||||||
|  |  | ||||||
|  |     cat > "${service_unit}" <<"EOF" | ||||||
|  | [Unit] | ||||||
|  | Description=chmod initramfs to be root-read-writable only | ||||||
|  |  | ||||||
|  | [Service] | ||||||
|  | Type=oneshot | ||||||
|  | ExecStart=/usr/bin/chmod 600 /boot/initramfs-linux.img | ||||||
|  | EOF | ||||||
|  |  | ||||||
|  |     systemctl enable "${path_unit}" | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function pacman_dl_parallel () { | ||||||
|  |     #2.4 | ||||||
|  |     # We're setting this in Arch Linux ISO CD while we install proper Arch. | ||||||
|  |     # No need to revert this later as it is ephemeral anyway. | ||||||
|  |     sed -ri -e 's'$'\x1''^.*?(ParallelDownloads)[^\r\n\f]*'$'\x1''\1 = 20'$'\x1''g' '/etc/pacman.conf' | ||||||
|  | } | ||||||
|  |  | ||||||
| function unleash_makepkg () { | function unleash_makepkg () { | ||||||
|     #2.5 |     #2.5 | ||||||
|     local path_prefix |     local path_prefix | ||||||
| @@ -436,6 +468,25 @@ function unleash_makepkg () { | |||||||
|         "${path_prefix}"'/etc/makepkg.conf' |         "${path_prefix}"'/etc/makepkg.conf' | ||||||
| } | } | ||||||
|  |  | ||||||
|  | function add_motd_getting_started_msg () { | ||||||
|  |     #2.6 | ||||||
|  |     cat > '/etc/motd' <<"EOF" | ||||||
|  |  | ||||||
|  | #################### | ||||||
|  |  | ||||||
|  | GUI basics: | ||||||
|  |  | ||||||
|  |     paru -S xorg plasma-meta kde-applications-meta sddm | ||||||
|  |     localectl set-x11-keymap de | ||||||
|  |     useradd --create-home --shell /bin/bash --user-group --groups wheel <user> | ||||||
|  |     passwd <user> | ||||||
|  |     systemctl enable --now sddm.service | ||||||
|  |  | ||||||
|  | #################### | ||||||
|  |  | ||||||
|  | EOF | ||||||
|  | } | ||||||
|  |  | ||||||
| function get_aur_helper () { | function get_aur_helper () { | ||||||
|     #2.7 |     #2.7 | ||||||
|     create_unpriv_user 'build' |     create_unpriv_user 'build' | ||||||
| @@ -519,55 +570,17 @@ EOF | |||||||
|     zfs set org.zfsbootmenu:commandline='rw nowatchdog rd.vconsole.keymap=de-latin1' "${zpool_name}"'/root/'"${zfs_arch_dataset_name}" |     zfs set org.zfsbootmenu:commandline='rw nowatchdog rd.vconsole.keymap=de-latin1' "${zpool_name}"'/root/'"${zfs_arch_dataset_name}" | ||||||
| } | } | ||||||
|  |  | ||||||
| function keep_initiramfs_root_only_rw () { | function get_disks_with_one_efipart () { | ||||||
|     #2.3 |     local disks_with_one_efipart | ||||||
|     declare systemd_local_admin_override_path unit_name |     # Find disks that have exactly one EFI partition and where that EFI | ||||||
|     systemd_local_admin_override_path='/etc/systemd/system' |     # partition is partition number 1. We expect exactly one disk to meet | ||||||
|     unit_name='chmod-initramfs' |     # these criteria. Anything else and we bail. | ||||||
|     path_unit="${systemd_local_admin_override_path%/}"'/'"${unit_name}"'.path' |     disks_with_one_efipart="$(lsblk --output PATH,PARTTYPE --json --tree | jq --raw-output '.[][] | select(.children | length > 0) | select( any (.children[]; (.path | test("^[^[:digit:]]+1")) and (.parttype=="c12a7328-f81f-11d2-ba4b-00a0c93ec93b")) and ([select(.children[].parttype=="c12a7328-f81f-11d2-ba4b-00a0c93ec93b")] | length == 1) ) | .path')" | ||||||
|     service_unit="${systemd_local_admin_override_path%/}"'/'"${unit_name}"'.service' |     if [[ "$(wc -l <<<"${disks_with_one_efipart}")" -eq '1' ]] && [[ "$(wc -c <<<"${disks_with_one_efipart}")" -gt '1' ]]; then | ||||||
|  |         printf -- '%s' "${disks_with_one_efipart}" | ||||||
|     cat > "${path_unit}" <<"EOF" |         return 0 | ||||||
| [Unit] |     fi | ||||||
| Description=chmod initramfs to be root-read-writable only |     return 1 | ||||||
|  |  | ||||||
| [Path] |  | ||||||
| PathChanged=/boot/initramfs-linux.img |  | ||||||
|  |  | ||||||
| [Install] |  | ||||||
| WantedBy=multi-user.target |  | ||||||
| WantedBy=system-update.target |  | ||||||
| EOF |  | ||||||
|  |  | ||||||
|     cat > "${service_unit}" <<"EOF" |  | ||||||
| [Unit] |  | ||||||
| Description=chmod initramfs to be root-read-writable only |  | ||||||
|  |  | ||||||
| [Service] |  | ||||||
| Type=oneshot |  | ||||||
| ExecStart=/usr/bin/chmod 600 /boot/initramfs-linux.img |  | ||||||
| EOF |  | ||||||
|  |  | ||||||
|     systemctl enable "${path_unit}" |  | ||||||
| } |  | ||||||
|  |  | ||||||
| function add_motd_getting_started_msg () { |  | ||||||
|     #2.6 |  | ||||||
|     cat > '/etc/motd' <<"EOF" |  | ||||||
|  |  | ||||||
| #################### |  | ||||||
|  |  | ||||||
| GUI basics: |  | ||||||
|  |  | ||||||
|     paru -S xorg plasma-meta kde-applications-meta sddm |  | ||||||
|     localectl set-x11-keymap de |  | ||||||
|     useradd --create-home --shell /bin/bash --user-group --groups wheel <user> |  | ||||||
|     passwd <user> |  | ||||||
|     systemctl enable --now sddm.service |  | ||||||
|  |  | ||||||
| #################### |  | ||||||
|  |  | ||||||
| EOF |  | ||||||
| } | } | ||||||
|  |  | ||||||
| function install_os_in_chroot () { | function install_os_in_chroot () { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user