Compare commits
	
		
			11 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 2f1cf770cd | |||
| 2f5a374523 | |||
| 76ca2dfdc7 | |||
| f05688dc12 | |||
| 091b5deaa8 | |||
| 93e4beb61f | |||
| 76b4ff511d | |||
| 2995207e6b | |||
| 5aa8bd3333 | |||
| 699ea06445 | |||
| 4b9a883113 | 
							
								
								
									
										2
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Makefile
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| VERSION=0.22 | VERSION=0.23 | ||||||
|  |  | ||||||
| TOOLS = artools | TOOLS = artools | ||||||
| PREFIX ?= /usr | PREFIX ?= /usr | ||||||
|   | |||||||
| @@ -86,9 +86,9 @@ make_rootfs() { | |||||||
|  |  | ||||||
|         basestrap "${basestrap_args[@]}" "${rootfs}" "${packages[@]}" |         basestrap "${basestrap_args[@]}" "${rootfs}" "${packages[@]}" | ||||||
|  |  | ||||||
|         copy_overlay "${ROOT_OVERLAY}" "${rootfs}" |         copy_overlay "${root_overlay}" "${rootfs}" | ||||||
|  |  | ||||||
|         [[ -z ${LIVE_LIST} ]] && configure_chroot "${rootfs}" |         [[ -z ${live_list} ]] && configure_chroot "${rootfs}" | ||||||
|  |  | ||||||
|         clean_up_chroot "${rootfs}" |         clean_up_chroot "${rootfs}" | ||||||
|  |  | ||||||
| @@ -109,7 +109,7 @@ make_livefs() { | |||||||
|  |  | ||||||
|         basestrap "${basestrap_args[@]}" "${livefs}" "${packages[@]}" |         basestrap "${basestrap_args[@]}" "${livefs}" "${packages[@]}" | ||||||
|  |  | ||||||
|         copy_overlay "${LIVE_OVERLAY}" "${livefs}" |         copy_overlay "${live_overlay}" "${livefs}" | ||||||
|  |  | ||||||
|         configure_chroot "${livefs}" |         configure_chroot "${livefs}" | ||||||
|  |  | ||||||
| @@ -154,7 +154,7 @@ make_grub(){ | |||||||
|         msg "Prepare [/iso/boot/grub]" |         msg "Prepare [/iso/boot/grub]" | ||||||
|  |  | ||||||
|         local layer=${work_dir}/rootfs |         local layer=${work_dir}/rootfs | ||||||
|         [[ -n ${LIVE_LIST} ]] && layer=${work_dir}/livefs |         [[ -n ${live_list} ]] && layer=${work_dir}/livefs | ||||||
|  |  | ||||||
|         prepare_grub "${work_dir}/rootfs" "$layer" |         prepare_grub "${work_dir}/rootfs" "$layer" | ||||||
|  |  | ||||||
| @@ -248,10 +248,10 @@ mk_boot(){ | |||||||
| } | } | ||||||
|  |  | ||||||
| mk_chroots(){ | mk_chroots(){ | ||||||
|     load_pkgs "${ROOT_LIST}" "${INITSYS}" |     load_pkgs "${root_list}" | ||||||
|     run_safe "make_rootfs" |     run_safe "make_rootfs" | ||||||
|     if [[ -n ${LIVE_LIST} ]]; then |     if [[ -n ${live_list} ]]; then | ||||||
|         load_pkgs "${LIVE_LIST}" "${INITSYS}" |         load_pkgs "${live_list}" | ||||||
|         run_safe "make_livefs" |         run_safe "make_livefs" | ||||||
|     fi |     fi | ||||||
| } | } | ||||||
|   | |||||||
| @@ -64,7 +64,7 @@ check_db(){ | |||||||
|  |  | ||||||
|         for name in "${pkgname[@]}"; do |         for name in "${pkgname[@]}"; do | ||||||
|             if ! is_db_entry "$name-$artixver" "$repo"; then |             if ! is_db_entry "$name-$artixver" "$repo"; then | ||||||
|                 msg_row_upgrade "${tableU}" "$repo" "$name" "$artixver" "false" |                 msg_row_red "${tableU}" "$repo" "$name" "$artixver" "false" | ||||||
|             else |             else | ||||||
|                 ${all_db} && msg_row "${tableU}" "$repo" "$name" "$artixver" "true" |                 ${all_db} && msg_row "${tableU}" "$repo" "$name" "$artixver" "true" | ||||||
|             fi |             fi | ||||||
|   | |||||||
| @@ -34,10 +34,12 @@ write_list(){ | |||||||
| compare_m(){ | compare_m(){ | ||||||
|     case ${artixrepo} in |     case ${artixrepo} in | ||||||
|         *testing*|*staging*|*rebuild) |         *testing*|*staging*|*rebuild) | ||||||
|             if [[ "${a}" == "${b}" ]] || [[ "${a}" == 'staging' && "${b}" == 'rebuild' ]]; then |             if [[ "${a}" == "${b}" ]]; then | ||||||
|                 msg_row "${table}" "${a}" "${b}" "$pkg" "$archver" "$artixver" "${group#*-}" |                 msg_row "${table}" "${a}" "${b}" "$pkg" "$archver" "$artixver" "${group#*-}" | ||||||
|  |             elif [[ "${a}" == 'staging' && "${b}" == 'rebuild' ]]; then | ||||||
|  |                 msg_row_yellow "${table}" "${a}" "${b}" "$pkg" "$archver" "$artixver" "${group#*-}" | ||||||
|             else |             else | ||||||
|                 msg_row_notify "${table}" "${a}" "${b}" "$pkg" "$archver" "$artixver" "${group#*-}" |                 msg_row_green "${table}" "${a}" "${b}" "$pkg" "$archver" "$artixver" "${group#*-}" | ||||||
|                 [[ -n "$archrepo" ]] && write_list "${a}:${b}:$pkg" pkg_moves |                 [[ -n "$archrepo" ]] && write_list "${a}:${b}:$pkg" pkg_moves | ||||||
|             fi |             fi | ||||||
|         ;; |         ;; | ||||||
| @@ -46,7 +48,7 @@ compare_m(){ | |||||||
|  |  | ||||||
| compare_u(){ | compare_u(){ | ||||||
|     if [ "$result" -eq -1 ];then |     if [ "$result" -eq -1 ];then | ||||||
|         msg_row_upgrade "${table}" "${a}" "${b}" "$pkg" "$archver" "$artixver" "${group#*-}" |         msg_row_red "${table}" "${a}" "${b}" "$pkg" "$archver" "$artixver" "${group#*-}" | ||||||
|         write_list "${a}:$pkg" pkg_upgrades |         write_list "${a}:$pkg" pkg_upgrades | ||||||
|     fi |     fi | ||||||
| } | } | ||||||
| @@ -54,7 +56,7 @@ compare_u(){ | |||||||
| compare_d(){ | compare_d(){ | ||||||
|     if [ "$result" -eq 1 ];then |     if [ "$result" -eq 1 ];then | ||||||
|         if [[ -n "$archver" ]] && [[ -n "$archrepo" ]];then |         if [[ -n "$archver" ]] && [[ -n "$archrepo" ]];then | ||||||
|             msg_row_downgrade "${table}" "${a}" "${b}" "$pkg" "$archver" "$artixver" "${group#*-}" |             msg_row_yellow "${table}" "${a}" "${b}" "$pkg" "$archver" "$artixver" "${group#*-}" | ||||||
|         fi |         fi | ||||||
|     fi |     fi | ||||||
| } | } | ||||||
| @@ -158,7 +160,7 @@ move=false | |||||||
| readonly table="%-18s %-18s %-25s %-27s %-27s %-10s" | readonly table="%-18s %-18s %-25s %-27s %-27s %-10s" | ||||||
|  |  | ||||||
| usage() { | usage() { | ||||||
|     echo "Usage: ${0##*/} [options] (with -q [libname])" |     echo "Usage: ${0##*/} [options]" | ||||||
|     echo '    -u            Show upgrade packages' |     echo '    -u            Show upgrade packages' | ||||||
|     echo '    -d            Show downgrade packages' |     echo '    -d            Show downgrade packages' | ||||||
|     echo '    -m            Show packages to move' |     echo '    -m            Show packages to move' | ||||||
|   | |||||||
| @@ -92,6 +92,10 @@ passfiles=("$@") | |||||||
| repo_path=${REPOS_ROOT}/${dest_repo}/os/${CARCH} | repo_path=${REPOS_ROOT}/${dest_repo}/os/${CARCH} | ||||||
|  |  | ||||||
| if [[ -n "${passfiles[*]}" ]]; then | if [[ -n "${passfiles[*]}" ]]; then | ||||||
|     ${add_pkg} && repo_action add |     if ${add_pkg}; then | ||||||
|     ${rm_pkg} && repo_action remove |         repo_action add | ||||||
|  |     fi | ||||||
|  |     if ${rm_pkg}; then | ||||||
|  |         repo_action remove | ||||||
|  |     fi | ||||||
| fi | fi | ||||||
|   | |||||||
| @@ -247,6 +247,15 @@ download_sources() { | |||||||
|         die "Could not download sources." |         die "Could not download sources." | ||||||
| } | } | ||||||
|  |  | ||||||
|  | move_logfiles() { | ||||||
|  |     local l | ||||||
|  |     for l in "$copydir"/logdest/*; do | ||||||
|  |         [[ $l == */logpipe.* ]] && continue | ||||||
|  |         chown "$src_owner" "$l" | ||||||
|  |         mv "$l" "$LOGDEST" | ||||||
|  |     done | ||||||
|  | } | ||||||
|  |  | ||||||
| move_products() { | move_products() { | ||||||
|     local pkgfile |     local pkgfile | ||||||
|     for pkgfile in "$copydir"/pkgdest/*; do |     for pkgfile in "$copydir"/pkgdest/*; do | ||||||
| @@ -259,12 +268,7 @@ move_products() { | |||||||
|         fi |         fi | ||||||
|     done |     done | ||||||
|  |  | ||||||
|     local l |     move_logfiles | ||||||
|     for l in "$copydir"/logdest/*; do |  | ||||||
|         [[ $l == */logpipe.* ]] && continue |  | ||||||
|         chown "$src_owner" "$l" |  | ||||||
|         mv "$l" "$LOGDEST" |  | ||||||
|     done |  | ||||||
|  |  | ||||||
|     for s in "$copydir"/srcpkgdest/*; do |     for s in "$copydir"/srcpkgdest/*; do | ||||||
|         chown "$src_owner" "$s" |         chown "$src_owner" "$s" | ||||||
| @@ -379,6 +383,7 @@ then | |||||||
|     move_products |     move_products | ||||||
| else | else | ||||||
|     (( ret += 1 )) |     (( ret += 1 )) | ||||||
|  |     move_logfiles | ||||||
| fi | fi | ||||||
|  |  | ||||||
| (( temp_chroot )) && delete_chroot "$copydir" "$copy" | (( temp_chroot )) && delete_chroot "$copydir" "$copy" | ||||||
|   | |||||||
| @@ -8,7 +8,7 @@ | |||||||
| # the dist release; default: auto | # the dist release; default: auto | ||||||
| # ISO_VERSION=$(date +%Y%m%d) | # ISO_VERSION=$(date +%Y%m%d) | ||||||
|  |  | ||||||
| # possible values: openrc, runit, s6 | # possible values: openrc, runit, s6, 66 | ||||||
| # INITSYS="openrc" | # INITSYS="openrc" | ||||||
|  |  | ||||||
| # gpg key; leave empty or commented to skip img signing | # gpg key; leave empty or commented to skip img signing | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ DLAGENTS=('file::/usr/bin/curl -gqC - -o %o %u' | |||||||
|           'ftp::/usr/bin/curl -gqfC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u' |           'ftp::/usr/bin/curl -gqfC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u' | ||||||
|           'http::/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u' |           'http::/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u' | ||||||
|           'https::/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u' |           'https::/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u' | ||||||
|           'rsync::/usr/bin/rsync --no-motd -z %u %o' |           'rsync::/usr/bin/rsync --no-motd -zz %u %o' | ||||||
|           'scp::/usr/bin/scp -C %u %o') |           'scp::/usr/bin/scp -C %u %o') | ||||||
|  |  | ||||||
| # Other common tools: | # Other common tools: | ||||||
|   | |||||||
| @@ -2,30 +2,6 @@ | |||||||
|  |  | ||||||
| #{{{ calamares | #{{{ calamares | ||||||
|  |  | ||||||
| write_users_conf(){ |  | ||||||
|     local yaml |  | ||||||
|     yaml=$(write_yaml_header) |  | ||||||
|     yaml+=$(write_yaml_map 0 'defaultGroups') |  | ||||||
|     local IFS=',' |  | ||||||
|     for g in "${ADDGROUPS[@]}"; do |  | ||||||
|         yaml+=$(write_yaml_seq 2 "$g") |  | ||||||
|     done |  | ||||||
|     unset IFS |  | ||||||
|     yaml+=$(write_yaml_map 0 'autologinGroup' 'autologin') |  | ||||||
|     yaml+=$(write_yaml_map 0 'doAutologin' 'false') |  | ||||||
|     yaml+=$(write_yaml_map 0 'sudoersGroup' 'wheel') |  | ||||||
|     yaml+=$(write_yaml_map 0 'setRootPassword' 'true') |  | ||||||
|     yaml+=$(write_yaml_map 0 'availableShells' '/bin/bash, /bin/zsh') |  | ||||||
| #     yaml+=$(write_yaml_map 0 'passwordRequirements') |  | ||||||
| #     yaml+=$(write_yaml_map 2 'minLength' '-1') |  | ||||||
| #     yaml+=$(write_yaml_map 2 'maxLength' '-1') |  | ||||||
| #     yaml+=$(write_yaml_map 2 'libpwquality') |  | ||||||
| #     yaml+=$(write_yaml_seq 4 "minlen=8") |  | ||||||
| #     yaml+=$(write_yaml_seq 4 "minclass=80") |  | ||||||
|     yaml+=$(write_empty_line) |  | ||||||
|     printf '%s' "${yaml}" |  | ||||||
| } |  | ||||||
|  |  | ||||||
| write_services_conf(){ | write_services_conf(){ | ||||||
|     local key1="$1" val1="$2" key2="$3" val2="$4" |     local key1="$1" val1="$2" key2="$3" val2="$4" | ||||||
|     local yaml |     local yaml | ||||||
| @@ -55,6 +31,11 @@ write_services_s6_conf(){ | |||||||
|     write_services_conf 'svDir' '/etc/s6/sv' 'dbDir' '/etc/s6/rc/compiled' > "$conf" |     write_services_conf 'svDir' '/etc/s6/sv' 'dbDir' '/etc/s6/rc/compiled' > "$conf" | ||||||
| } | } | ||||||
|  |  | ||||||
|  | write_services_66_conf(){ | ||||||
|  |     local conf="$1"/services-66.conf | ||||||
|  |     write_services_conf 'svDir' '/etc/66/service' 'dbDir' '/run/66/tree' > "$conf" | ||||||
|  | } | ||||||
|  |  | ||||||
| write_postcfg(){ | write_postcfg(){ | ||||||
|     local yaml |     local yaml | ||||||
|     yaml=$(write_yaml_header) |     yaml=$(write_yaml_header) | ||||||
| @@ -70,13 +51,10 @@ write_unpackfs() { | |||||||
|     local yaml |     local yaml | ||||||
|     yaml=$(write_yaml_header) |     yaml=$(write_yaml_header) | ||||||
|     yaml+=$(write_yaml_map 0 'unpack') |     yaml+=$(write_yaml_map 0 'unpack') | ||||||
| #     if ${persist}; then |     local fs="squashfs" | ||||||
| #         yaml+=$(write_yaml_seq_map 2 'source' '"/run/artix/bootmnt/LiveOS/rootfs.img"') | #     ${persist} && fs="ext4" | ||||||
| #         yaml+=$(write_yaml_map 4 'sourcefs' '"ext4"') |  | ||||||
| #     else |  | ||||||
|     yaml+=$(write_yaml_seq_map 2 'source' '"/run/artix/bootmnt/LiveOS/rootfs.img"') |     yaml+=$(write_yaml_seq_map 2 'source' '"/run/artix/bootmnt/LiveOS/rootfs.img"') | ||||||
|     yaml+=$(write_yaml_map 4 'sourcefs' '"squashfs"') |     yaml+=$(write_yaml_map 4 'sourcefs' \'"$fs"\') | ||||||
| #     fi |  | ||||||
|     yaml+=$(write_yaml_map 4 'destination' '""') |     yaml+=$(write_yaml_map 4 'destination' '""') | ||||||
|     yaml+=$(write_empty_line) |     yaml+=$(write_empty_line) | ||||||
|     printf '%s' "${yaml}" |     printf '%s' "${yaml}" | ||||||
| @@ -86,7 +64,6 @@ configure_calamares(){ | |||||||
|     local mods="$1/etc/calamares/modules" |     local mods="$1/etc/calamares/modules" | ||||||
|     if [[ -d "$mods" ]];then |     if [[ -d "$mods" ]];then | ||||||
|         msg2 "Configuring: Calamares" |         msg2 "Configuring: Calamares" | ||||||
|         write_users_conf > "$mods"/users.conf |  | ||||||
|         write_services_"${INITSYS}"_conf "$mods" |         write_services_"${INITSYS}"_conf "$mods" | ||||||
|         write_postcfg > "$mods"/postcfg.conf |         write_postcfg > "$mods"/postcfg.conf | ||||||
|         write_unpackfs > "$mods"/unpackfs.conf |         write_unpackfs > "$mods"/unpackfs.conf | ||||||
|   | |||||||
| @@ -2,46 +2,23 @@ | |||||||
|  |  | ||||||
| #{{{ session | #{{{ session | ||||||
|  |  | ||||||
| configure_hosts(){ |  | ||||||
|     sed -e "s|localhost.localdomain|localhost.localdomain ${HOST_NAME}|" -i "$1"/etc/hosts |  | ||||||
| } |  | ||||||
|  |  | ||||||
| configure_logind(){ |  | ||||||
|     local conf=$1/etc/elogind/logind.conf |  | ||||||
|     if [[ -e "$conf" ]];then |  | ||||||
|         msg2 "Configuring: logind" |  | ||||||
|         sed -i 's/#\(HandleSuspendKey=\)suspend/\1ignore/' "$conf" |  | ||||||
|         sed -i 's/#\(HandleLidSwitch=\)suspend/\1ignore/' "$conf" |  | ||||||
|         sed -i 's/#\(HandleHibernateKey=\)hibernate/\1ignore/' "$conf" |  | ||||||
|     fi |  | ||||||
| } |  | ||||||
|  |  | ||||||
| configure_services(){ | configure_services(){ | ||||||
|     local mnt="$1" |     local mnt="$1" | ||||||
|     add_svc_"${INITSYS}" "$mnt" "${SERVICES[*]} ${SERVICES_LIVE[*]}" |     add_svc_"${INITSYS}" "$mnt" "${SERVICES[*]}" | ||||||
| } | } | ||||||
|  |  | ||||||
| configure_system(){ |  | ||||||
|     local mnt="$1" |  | ||||||
|     configure_logind "$mnt" |  | ||||||
|     echo "${HOST_NAME}" > "$mnt"/etc/hostname |  | ||||||
| } |  | ||||||
|  |  | ||||||
| write_live_session_conf(){ | write_live_session_conf(){ | ||||||
|     local conf='' |     local conf='' | ||||||
|     conf+=$(printf '%s\n' '# live session configuration') |     conf+=$(printf '%s\n' '# live session configuration') | ||||||
|     conf+=$(printf "\nAUTOLOGIN=%s\n" "${AUTOLOGIN}") |     conf+=$(printf "\nAUTOLOGIN=%s\n" "${AUTOLOGIN}") | ||||||
|     conf+=$(printf "\nUSER_NAME=%s\n" "${USER_NAME}") |  | ||||||
|     conf+=$(printf "\nPASSWORD=%s\n" "${PASSWORD}") |     conf+=$(printf "\nPASSWORD=%s\n" "${PASSWORD}") | ||||||
|     conf+=$(printf "\nADDGROUPS='%s'\n" "${ADDGROUPS}") |  | ||||||
|     printf '%s' "$conf" |     printf '%s' "$conf" | ||||||
| } | } | ||||||
|  |  | ||||||
| configure_chroot(){ | configure_chroot(){ | ||||||
|     local fs="$1" |     local fs="$1" | ||||||
|     msg "Configuring [%s]" "${fs##*/}" |     msg "Configuring [%s]" "${fs##*/}" | ||||||
|     configure_hosts "$fs" |  | ||||||
|     configure_system "$fs" |  | ||||||
|     configure_services "$fs" |     configure_services "$fs" | ||||||
|     configure_calamares "$fs" |     configure_calamares "$fs" | ||||||
|     [[ ! -d "$fs/etc/artools" ]] && mkdir -p "$fs/etc/artools" |     [[ ! -d "$fs/etc/artools" ]] && mkdir -p "$fs/etc/artools" | ||||||
|   | |||||||
| @@ -5,80 +5,81 @@ | |||||||
| show_profile(){ | show_profile(){ | ||||||
|     msg2 "iso_file: %s" "${iso_file}" |     msg2 "iso_file: %s" "${iso_file}" | ||||||
|     msg2 "AUTOLOGIN: %s" "${AUTOLOGIN}" |     msg2 "AUTOLOGIN: %s" "${AUTOLOGIN}" | ||||||
|     msg2 "HOST_NAME: %s" "${HOST_NAME}" |  | ||||||
|     msg2 "USER_NAME: %s" "${USER_NAME}" |  | ||||||
|     msg2 "PASSWORD: %s" "${PASSWORD}" |     msg2 "PASSWORD: %s" "${PASSWORD}" | ||||||
|     msg2 "ADDGROUPS: %s" "${ADDGROUPS}" |  | ||||||
|     msg2 "SERVICES_LIVE: %s" "${SERVICES_LIVE[*]}" |  | ||||||
|     msg2 "SERVICES: %s" "${SERVICES[*]}" |     msg2 "SERVICES: %s" "${SERVICES[*]}" | ||||||
| } | } | ||||||
|  |  | ||||||
| load_profile(){ | load_profile(){ | ||||||
|     local profile_dir="${DATADIR}/iso-profiles" |     local profile_dir="${DATADIR}/iso-profiles" | ||||||
|     [[ -d ${WORKSPACE_DIR}/iso-profiles ]] && profile_dir=${WORKSPACE_DIR}/iso-profiles |     [[ -d "${WORKSPACE_DIR}"/iso-profiles ]] && profile_dir="${WORKSPACE_DIR}"/iso-profiles | ||||||
|  |  | ||||||
|     ROOT_LIST="$profile_dir/${profile}/Packages-Root" |     root_list="$profile_dir/${profile}/Packages-Root" | ||||||
|     ROOT_OVERLAY="$profile_dir/${profile}/root-overlay" |     root_overlay="$profile_dir/${profile}/root-overlay" | ||||||
|  |  | ||||||
|     [[ -f "$profile_dir/${profile}/Packages-Live" ]] && LIVE_LIST="$profile_dir/${profile}/Packages-Live" |     [[ -f "$profile_dir/${profile}/Packages-Live" ]] && live_list="$profile_dir/${profile}/Packages-Live" | ||||||
|     [[ -d "$profile_dir/${profile}/live-overlay" ]] && LIVE_OVERLAY="$profile_dir/${profile}/live-overlay" |     [[ -d "$profile_dir/${profile}/live-overlay" ]] && live_overlay="$profile_dir/${profile}/live-overlay" | ||||||
|  |  | ||||||
|  |     common_dir="${DATADIR}/iso-profiles/common" | ||||||
|  |     [[ -d "$profile_dir"/common ]] && common_dir="${profile_dir}"/common | ||||||
|  |  | ||||||
|     [[ -f $profile_dir/${profile}/profile.conf ]] || return 1 |     [[ -f $profile_dir/${profile}/profile.conf ]] || return 1 | ||||||
|  |  | ||||||
|     # shellcheck disable=1090 |     # shellcheck disable=1090 | ||||||
|     [[ -r "$profile_dir/${profile}"/profile.conf ]] && . "$profile_dir/${profile}"/profile.conf |     [[ -r "$profile_dir/${profile}"/profile.conf ]] && . "$profile_dir/${profile}"/profile.conf | ||||||
|  |  | ||||||
|     DISPLAYMANAGER=${DISPLAYMANAGER:-'none'} |     AUTOLOGIN=${AUTOLOGIN:-true} | ||||||
|  |  | ||||||
|     AUTOLOGIN=${AUTOLOGIN:-"true"} |  | ||||||
|     [[ ${DISPLAYMANAGER} == 'none' ]] && AUTOLOGIN="false" |  | ||||||
|  |  | ||||||
|     HOST_NAME=${HOST_NAME:-'artix'} |  | ||||||
|  |  | ||||||
|     USER_NAME=${USER_NAME:-'artix'} |  | ||||||
|  |  | ||||||
|     PASSWORD=${PASSWORD:-'artix'} |     PASSWORD=${PASSWORD:-'artix'} | ||||||
|  |  | ||||||
|     ADDGROUPS=${ADDGROUPS:-"video,power,optical,network,lp,scanner,wheel,users,log"} |  | ||||||
|  |  | ||||||
|     if [[ -z "${SERVICES[*]}" ]];then |     if [[ -z "${SERVICES[*]}" ]];then | ||||||
|         SERVICES=('acpid' 'bluetoothd' 'cronie' 'cupsd' 'syslog-ng' 'connmand') |         SERVICES=('acpid' 'bluetoothd' 'cronie' 'cupsd' 'syslog-ng' 'connmand') | ||||||
|     fi |     fi | ||||||
|  |  | ||||||
|     if [[ ${DISPLAYMANAGER} != "none" ]];then |  | ||||||
|         case "${INITSYS}" in |  | ||||||
|             'openrc') SERVICES+=('xdm') ;; |  | ||||||
|             'runit'|'s6') SERVICES+=("${DISPLAYMANAGER}") ;; |  | ||||||
|         esac |  | ||||||
|     fi |  | ||||||
|  |  | ||||||
|     SERVICES_LIVE=('artix-live' 'pacman-init') |  | ||||||
|  |  | ||||||
|     return 0 |     return 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| load_pkgs(){ | read_from_list() { | ||||||
|     local pkglist="$1" init="$2" |     local list="$1" | ||||||
|     msg2 "Loading Packages: [%s] ..." "${pkglist##*/}" |     local _space="s| ||g" | ||||||
|  |     local _clean=':a;N;$!ba;s/\n/ /g' | ||||||
|  |     local _com_rm="s|#.*||g" | ||||||
|  |  | ||||||
|     local _init="s|@$init||g" _init_rm1 _init_rm2 |     local _init="s|@initsys@|${INITSYS}|g" | ||||||
|     case "$init" in |  | ||||||
|         'openrc') _init_rm1="s|@runit.*||g"; _init_rm2="s|@s6.*||g" ;; |  | ||||||
|         's6') _init_rm1="s|@runit.*||g"; _init_rm2="s|@openrc.*||g" ;; |  | ||||||
|         'runit') _init_rm1="s|@s6.*||g"; _init_rm2="s|@openrc.*||g" ;; |  | ||||||
|     esac |  | ||||||
|  |  | ||||||
|     local _space="s| ||g" \ |     msg2 "Loading Packages: [%s] ..." "${list##*/}" | ||||||
|         _clean=':a;N;$!ba;s/\n/ /g' \ |     packages+=($(sed "$_com_rm" "$list" \ | ||||||
|         _com_rm="s|#.*||g" |  | ||||||
|  |  | ||||||
|     packages=($(sed "$_com_rm" "$pkglist" \ |  | ||||||
|             | sed "$_space" \ |             | sed "$_space" \ | ||||||
|             | sed "$_purge" \ |  | ||||||
|             | sed "$_init" \ |             | sed "$_init" \ | ||||||
|             | sed "$_init_rm1" \ |  | ||||||
|             | sed "$_init_rm2" \ |  | ||||||
|             | sed "$_clean")) |             | sed "$_clean")) | ||||||
| } | } | ||||||
|  |  | ||||||
|  | read_from_services() { | ||||||
|  |     for svc in "${SERVICES[@]}"; do | ||||||
|  |         case "$svc" in | ||||||
|  |             sddm|gdm|lightdm|mdm|greetd|lxdm|xdm) packages+=("$svc-${INITSYS}") ;; | ||||||
|  |             NetworkManager) packages+=("networkmanager-${INITSYS}") ;; | ||||||
|  |             connmand) packages+=("connman-${INITSYS}") ;; | ||||||
|  |             cupsd) packages+=("cups-${INITSYS}") ;; | ||||||
|  |             bluetoothd) packages+=("bluez-${INITSYS}") ;; | ||||||
|  |             syslog-ng|metalog) packages+=("$svc-${INITSYS}") ;; | ||||||
|  |         esac | ||||||
|  |     done | ||||||
|  | } | ||||||
|  |  | ||||||
|  | load_pkgs(){ | ||||||
|  |     local pkglist="$1" | ||||||
|  |     packages=() | ||||||
|  |  | ||||||
|  |     if [[ "${pkglist##*/}" == "Packages-Root" ]]; then | ||||||
|  |         read_from_list "${common_dir}/Packages-base" | ||||||
|  |         read_from_list "${common_dir}/Packages-apps" | ||||||
|  |         read_from_list "${common_dir}/Packages-${INITSYS}" | ||||||
|  |         [[ -n "${live_list}" ]] && read_from_list "${common_dir}/Packages-xorg" | ||||||
|  |         read_from_list "$pkglist" | ||||||
|  |         read_from_services | ||||||
|  |     else | ||||||
|  |         read_from_list "$pkglist" | ||||||
|  |     fi | ||||||
|  | } | ||||||
|  |  | ||||||
| #}}} | #}}} | ||||||
|   | |||||||
| @@ -2,19 +2,11 @@ | |||||||
|  |  | ||||||
| #{{{ services | #{{{ services | ||||||
|  |  | ||||||
| set_xdm(){ |  | ||||||
|     if [[ -f "$1"/etc/conf.d/xdm ]];then |  | ||||||
|         local conf='DISPLAYMANAGER="'${DISPLAYMANAGER}'"' |  | ||||||
|         sed -i -e "s|^.*DISPLAYMANAGER=.*|${conf}|" "$1"/etc/conf.d/xdm |  | ||||||
|     fi |  | ||||||
| } |  | ||||||
|  |  | ||||||
| add_svc_openrc(){ | add_svc_openrc(){ | ||||||
|     local mnt="$1" names="$2" rlvl="${3:-default}" |     local mnt="$1" names="$2" rlvl="${3:-default}" | ||||||
|     for svc in $names; do |     for svc in $names; do | ||||||
|         if [[ -f $mnt/etc/init.d/$svc ]];then |         if [[ -f $mnt/etc/init.d/$svc ]];then | ||||||
|             msg2 "Setting [%s]: %s" "${INITSYS}" "$svc" |             msg2 "Setting %s: [%s]" "${INITSYS}" "$svc" | ||||||
|             [[ $svc == "xdm" ]] && set_xdm "$mnt" |  | ||||||
|             chroot "$mnt" rc-update add "$svc" "$rlvl" &>/dev/null |             chroot "$mnt" rc-update add "$svc" "$rlvl" &>/dev/null | ||||||
|         fi |         fi | ||||||
|     done |     done | ||||||
| @@ -24,7 +16,7 @@ add_svc_runit(){ | |||||||
|     local mnt="$1" names="$2" rlvl="${3:-default}" |     local mnt="$1" names="$2" rlvl="${3:-default}" | ||||||
|     for svc in $names; do |     for svc in $names; do | ||||||
|         if [[ -d $mnt/etc/runit/sv/$svc ]]; then |         if [[ -d $mnt/etc/runit/sv/$svc ]]; then | ||||||
|             msg2 "Setting [%s]: %s" "${INITSYS}" "$svc" |             msg2 "Setting %s: [%s]" "${INITSYS}" "$svc" | ||||||
|             chroot "$mnt" ln -s /etc/runit/sv/"$svc" /etc/runit/runsvdir/"$rlvl" &>/dev/null |             chroot "$mnt" ln -s /etc/runit/sv/"$svc" /etc/runit/runsvdir/"$rlvl" &>/dev/null | ||||||
|         fi |         fi | ||||||
|     done |     done | ||||||
| @@ -32,21 +24,34 @@ add_svc_runit(){ | |||||||
|  |  | ||||||
| add_svc_s6(){ | add_svc_s6(){ | ||||||
|     local mnt="$1" names="$2" rlvl="${3:-default}" error ret |     local mnt="$1" names="$2" rlvl="${3:-default}" error ret | ||||||
|  |     local db=/etc/s6/rc/compiled | ||||||
|     for svc in $names; do |     for svc in $names; do | ||||||
|         error=false |         error=false | ||||||
|         chroot "$mnt" s6-rc-db -c /etc/s6/rc/compiled type "$svc" &> /dev/null || error=true |         chroot "$mnt" s6-rc-db -c "$db" type "$svc" &> /dev/null || error=true | ||||||
|         ret="$?" |         ret="$?" | ||||||
|         if [ $ret -eq 0 ] && [[ "$error" == false ]]; then |         if [ $ret -eq 0 ] && [[ "$error" == false ]]; then | ||||||
|             msg2 "Setting [%s]: %s" "${INITSYS}" "$svc" |             msg2 "Setting %s: [%s]" "${INITSYS}" "$svc" | ||||||
|             chroot "$mnt" s6-rc-bundle-update -c /etc/s6/rc/compiled add "$rlvl" "$svc" |             chroot "$mnt" s6-rc-bundle-update -c "$db" add "$rlvl" "$svc" | ||||||
|         fi |         fi | ||||||
|     done |     done | ||||||
|  |  | ||||||
|  |     local rlvl=/etc/s6/current | ||||||
|     # rebuild s6-linux-init binaries |     # rebuild s6-linux-init binaries | ||||||
|     chroot "$mnt" rm -r /etc/s6/current |     chroot "$mnt" rm -r "$rlvl" | ||||||
|     chroot "$mnt" s6-linux-init-maker -1 -N -f /etc/s6/skel -G "/usr/bin/agetty -L -8 tty1 115200" -c /etc/s6/current /etc/s6/current |     chroot "$mnt" s6-linux-init-maker -1 -N -f /etc/s6/skel -G "/usr/bin/agetty -L -8 tty1 115200" -c "$rlvl" "$rlvl" | ||||||
|     chroot "$mnt" mv /etc/s6/current/bin/init /etc/s6/current/bin/s6-init |     chroot "$mnt" mv "$rlvl"/bin/init "$rlvl"/bin/s6-init | ||||||
|     chroot "$mnt" cp -a /etc/s6/current/bin /usr |     chroot "$mnt" cp -a "$rlvl"/bin /usr | ||||||
|  | } | ||||||
|  |  | ||||||
|  | add_svc_66(){ | ||||||
|  |     local mnt="$1" names="$2" | ||||||
|  |     chroot "$mnt" 66-tree -cnE root &>/dev/null | ||||||
|  |     for svc in $names; do | ||||||
|  |         if [[ -f $mnt/etc/66/service/$svc ]]; then | ||||||
|  |             chroot "$mnt" 66-enable -t root $svc &>/dev/null | ||||||
|  |             chroot "$mnt" 66-start -t root $svc &>/dev/null | ||||||
|  |         fi | ||||||
|  |     done | ||||||
| } | } | ||||||
|  |  | ||||||
| #}}} | #}}} | ||||||
|   | |||||||
| @@ -8,13 +8,13 @@ msg_table_header(){ | |||||||
|     printf "${BLUE} ${mesg} ${ALL_OFF}\n" "$@" >&2 |     printf "${BLUE} ${mesg} ${ALL_OFF}\n" "$@" >&2 | ||||||
| } | } | ||||||
|  |  | ||||||
| msg_row_downgrade(){ | msg_row_yellow(){ | ||||||
|     local mesg=$1; shift |     local mesg=$1; shift | ||||||
|     # shellcheck disable=2059 |     # shellcheck disable=2059 | ||||||
|     printf "${YELLOW} ${mesg}${ALL_OFF}\n" "$@" >&2 |     printf "${YELLOW} ${mesg}${ALL_OFF}\n" "$@" >&2 | ||||||
| } | } | ||||||
|  |  | ||||||
| msg_row_notify(){ | msg_row_green(){ | ||||||
|     local mesg=$1; shift |     local mesg=$1; shift | ||||||
|     # shellcheck disable=2059 |     # shellcheck disable=2059 | ||||||
|     printf "${GREEN} ${mesg}${ALL_OFF}\n" "$@" >&2 |     printf "${GREEN} ${mesg}${ALL_OFF}\n" "$@" >&2 | ||||||
| @@ -27,7 +27,7 @@ msg_row(){ | |||||||
|     printf "${WHITE} ${mesg}${ALL_OFF}\n" "$@" >&2 |     printf "${WHITE} ${mesg}${ALL_OFF}\n" "$@" >&2 | ||||||
| } | } | ||||||
|  |  | ||||||
| msg_row_upgrade(){ | msg_row_red(){ | ||||||
|     local mesg=$1; shift |     local mesg=$1; shift | ||||||
|     # shellcheck disable=2059 |     # shellcheck disable=2059 | ||||||
|     printf "${RED} ${mesg} ${ALL_OFF}\n" "$@" >&2 |     printf "${RED} ${mesg} ${ALL_OFF}\n" "$@" >&2 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user