From e264b44682a930f70715ea58cf96e69c87a86b64 Mon Sep 17 00:00:00 2001 From: David Runge Date: Sat, 30 May 2020 00:01:28 +0200 Subject: Add license and basic documentation LICENSE: Add GPL-3.0 license. {{archiso,configs}/*,.editorconfig,.gitlab-ci.yml}: Add SPDX license identifier. Makefile: Add SPDX license identifier. Install the `run_archiso.sh` script as global executable `run_archiso`. Use -D and -t flags to install to install files more generically (without a previous call to install the directory). README.rst: Add README outlining the project's scope, how to build images from the profiles and how to test. AUTHORS.rst: Add list of all direct contributors to the repository. CONTRIBUTING.rst: Add basic contribution guidelines, explaining the linter and the license in use. Closes #7 Closes #3 --- Makefile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 3ee8a6a..a274282 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,6 @@ +# +# SPDX-License-Identifier: GPL-3.0-or-later + INSTALL_FILES=$(wildcard archiso/initcpio/install/*) HOOKS_FILES=$(wildcard archiso/initcpio/hooks/*) SCRIPT_FILES=$(wildcard archiso/initcpio/script/*) @@ -6,7 +9,7 @@ INSTALL_DIR=$(DESTDIR)/usr/lib/initcpio/install HOOKS_DIR=$(DESTDIR)/usr/lib/initcpio/hooks SCRIPT_DIR=$(DESTDIR)/usr/lib/initcpio -DOC_FILES=$(wildcard docs/*) +DOC_FILES=$(wildcard docs/*) $(wildcard *.rst) DOC_DIR=$(DESTDIR)/usr/share/doc/archiso @@ -25,7 +28,8 @@ check: install: install-program install-initcpio install-examples install-doc install-program: - install -D -m 755 archiso/mkarchiso $(DESTDIR)/usr/bin/mkarchiso + install -vDm 755 archiso/mkarchiso -t "$(DESTDIR)/usr/bin/" + install -vDm 755 scripts/run_archiso.sh "$(DESTDIR)/usr/bin/run_archiso" install-initcpio: install -d $(SCRIPT_DIR) $(HOOKS_DIR) $(INSTALL_DIR) @@ -38,7 +42,6 @@ install-examples: cp -a --no-preserve=ownership configs $(DESTDIR)/usr/share/archiso/ install-doc: - install -d $(DOC_DIR) - install -m 644 -t $(DOC_DIR) $(DOC_FILES) + install -vDm 644 $(DOC_FILES) -t $(DOC_DIR) .PHONY: check install install-program install-initcpio install-examples install-doc -- cgit v1.2.3-54-g00ecf From e9303ca175ecfe1d7ca23bbcacf8b7f3d2ae85c1 Mon Sep 17 00:00:00 2001 From: nl6720 Date: Wed, 29 Jul 2020 19:14:59 +0300 Subject: Makefile: do not install mkinitcpio hooks by default They are not required in the host system. See https://gitlab.archlinux.org/archlinux/archiso/-/issues/34 . --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index a274282..ff43376 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ check: configs/releng/airootfs/usr/local/bin/choose-mirror shellcheck -s dash $(HOOKS_FILES) $(SCRIPT_FILES) -install: install-program install-initcpio install-examples install-doc +install: install-program install-examples install-doc install-program: install -vDm 755 archiso/mkarchiso -t "$(DESTDIR)/usr/bin/" -- cgit v1.2.3-54-g00ecf From d7fc56e0066fc0bdfd1d45e4e67f53b218609897 Mon Sep 17 00:00:00 2001 From: nl6720 Date: Thu, 30 Jul 2020 10:00:37 +0300 Subject: Move shell script linting into a separate make target Makefile: Move shellcheck to a "lint" target and change "check" so that it runs "lint". This provides a more finer grained control and allows to extend "check" with things beyond just linting. .gitlab-ci.yml: Run `make lint` in the lint job. --- .gitlab-ci.yml | 2 +- Makefile | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'Makefile') diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d85b887..e5a4e03 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,4 +10,4 @@ default: lint: stage: build script: - - make check + - make lint diff --git a/Makefile b/Makefile index ff43376..573d044 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,9 @@ DOC_DIR=$(DESTDIR)/usr/share/doc/archiso all: -check: +check: lint + +lint: shellcheck -s bash archiso/mkarchiso \ scripts/run_archiso.sh \ $(INSTALL_FILES) \ @@ -44,4 +46,4 @@ install-examples: install-doc: install -vDm 644 $(DOC_FILES) -t $(DOC_DIR) -.PHONY: check install install-program install-initcpio install-examples install-doc +.PHONY: check install install-program install-initcpio install-examples install-doc lint -- cgit v1.2.3-54-g00ecf From 1cc7375c2576fe2cce6352e7e9c860a4b222d0ab Mon Sep 17 00:00:00 2001 From: nl6720 Date: Fri, 14 Aug 2020 07:52:59 +0300 Subject: archiso/mkarchiso: start preparing a build_profile command Nothing is implemented yet! configs/releng/profiledef.sh: A test profile. --- Makefile | 1 + archiso/mkarchiso | 122 +++++++++++++++++++++++++++---------------- configs/releng/profiledef.sh | 12 +++++ 3 files changed, 91 insertions(+), 44 deletions(-) create mode 100644 configs/releng/profiledef.sh (limited to 'Makefile') diff --git a/Makefile b/Makefile index 573d044..2890026 100644 --- a/Makefile +++ b/Makefile @@ -23,6 +23,7 @@ lint: scripts/run_archiso.sh \ $(INSTALL_FILES) \ $(wildcard configs/*/build.sh) \ + $(wildcard configs/*/profiledef.sh) \ configs/releng/airootfs/root/.automated_script.sh \ configs/releng/airootfs/usr/local/bin/choose-mirror shellcheck -s dash $(HOOKS_FILES) $(SCRIPT_FILES) diff --git a/archiso/mkarchiso b/archiso/mkarchiso index 1dca307..626fb6d 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -9,22 +9,31 @@ umask 0022 export LANG="C" export SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-"$(date +%s)"}" +# mkarchiso defaults app_name="${0##*/}" -arch="$(uname -m)" pkg_list=() run_cmd="" quiet="y" -pacman_conf="/etc/pacman.conf" -iso_label="ARCH_$(date +%Y%m)" -iso_publisher="Arch Linux " -iso_application="Arch Linux Live/Rescue CD" -install_dir="arch" work_dir="work" out_dir="out" +img_name="${app_name}.iso" sfs_mode="sfs" sfs_comp="xz" gpg_key="" +# profile defaults +profile="" +iso_name="${app_name}" +iso_label="${app_name^^}" +iso_publisher="${app_name}" +iso_application="${app_name} iso" +iso_version="" +install_dir="${app_name}" +arch="$(uname -m)" +pacman_conf="/etc/pacman.conf" +bootmodes=() + + # Show an INFO message # $1: message string _msg_info() { @@ -33,6 +42,13 @@ _msg_info() { } +# Show a WARNING message +# $1: message string +_msg_warning() { + local _msg="${1}" + printf '\n[%s] WARNING: %s\n\n' "${app_name}" "${_msg}" >&2 +} + # Show an ERROR message then exit with status # $1: message string # $2: exit code number (with 0 does not exit) @@ -46,19 +62,19 @@ _msg_error() { } _chroot_init() { - mkdir -p -- "${work_dir}/airootfs" + mkdir -p -- "${airootfs_dir}" _pacman base syslinux } _chroot_run() { - eval -- arch-chroot "${work_dir}/airootfs" "${run_cmd}" + eval -- arch-chroot "${airootfs_dir}" "${run_cmd}" } _mount_airootfs() { trap "_umount_airootfs" EXIT HUP INT TERM mkdir -p -- "${work_dir}/mnt/airootfs" - _msg_info "Mounting '${work_dir}/airootfs.img' on '${work_dir}/mnt/airootfs'" - mount -- "${work_dir}/airootfs.img" "${work_dir}/mnt/airootfs" + _msg_info "Mounting '${airootfs_dir}.img' on '${work_dir}/mnt/airootfs'" + mount -- "${airootfs_dir}.img" "${work_dir}/mnt/airootfs" _msg_info "Done!" } @@ -156,12 +172,12 @@ _show_config () { # Install desired packages to airootfs _pacman () { - _msg_info "Installing packages to '${work_dir}/airootfs/'..." + _msg_info "Installing packages to '${airootfs_dir}/'..." if [[ "${quiet}" = "y" ]]; then - pacstrap -C "${pacman_conf}" -c -G -M -- "${work_dir}/airootfs" "$@" &> /dev/null + pacstrap -C "${pacman_conf}" -c -G -M -- "${airootfs_dir}" "$@" &> /dev/null else - pacstrap -C "${pacman_conf}" -c -G -M -- "${work_dir}/airootfs" "$@" + pacstrap -C "${pacman_conf}" -c -G -M -- "${airootfs_dir}" "$@" fi _msg_info "Packages installed successfully!" @@ -172,32 +188,32 @@ _cleanup () { _msg_info "Cleaning up what we can on airootfs..." # Delete initcpio image(s) - if [[ -d "${work_dir}/airootfs/boot" ]]; then - find "${work_dir}/airootfs/boot" -type f -name '*.img' -delete + if [[ -d "${airootfs_dir}/boot" ]]; then + find "${airootfs_dir}/boot" -type f -name '*.img' -delete fi # Delete kernel(s) - if [[ -d "${work_dir}/airootfs/boot" ]]; then - find "${work_dir}/airootfs/boot" -type f -name 'vmlinuz*' -delete + if [[ -d "${airootfs_dir}/boot" ]]; then + find "${airootfs_dir}/boot" -type f -name 'vmlinuz*' -delete fi # Delete pacman database sync cache files (*.tar.gz) - if [[ -d "${work_dir}/airootfs/var/lib/pacman" ]]; then - find "${work_dir}/airootfs/var/lib/pacman" -maxdepth 1 -type f -delete + if [[ -d "${airootfs_dir}/var/lib/pacman" ]]; then + find "${airootfs_dir}/var/lib/pacman" -maxdepth 1 -type f -delete fi # Delete pacman database sync cache - if [[ -d "${work_dir}/airootfs/var/lib/pacman/sync" ]]; then - find "${work_dir}/airootfs/var/lib/pacman/sync" -delete + if [[ -d "${airootfs_dir}/var/lib/pacman/sync" ]]; then + find "${airootfs_dir}/var/lib/pacman/sync" -delete fi # Delete pacman package cache - if [[ -d "${work_dir}/airootfs/var/cache/pacman/pkg" ]]; then - find "${work_dir}/airootfs/var/cache/pacman/pkg" -type f -delete + if [[ -d "${airootfs_dir}/var/cache/pacman/pkg" ]]; then + find "${airootfs_dir}/var/cache/pacman/pkg" -type f -delete fi # Delete all log files, keeps empty dirs. - if [[ -d "${work_dir}/airootfs/var/log" ]]; then - find "${work_dir}/airootfs/var/log" -type f -delete + if [[ -d "${airootfs_dir}/var/log" ]]; then + find "${airootfs_dir}/var/log" -type f -delete fi # Delete all temporary files and dirs - if [[ -d "${work_dir}/airootfs/var/tmp" ]]; then - find "${work_dir}/airootfs/var/tmp" -mindepth 1 -delete + if [[ -d "${airootfs_dir}/var/tmp" ]]; then + find "${airootfs_dir}/var/tmp" -mindepth 1 -delete fi # Delete package pacman related files. find "${work_dir}" \( -name '*.pacnew' -o -name '*.pacsave' -o -name '*.pacorig' \) -delete @@ -206,51 +222,51 @@ _cleanup () { # Makes a ext4 filesystem inside a SquashFS from a source directory. _mkairootfs_img () { - if [[ ! -e "${work_dir}/airootfs" ]]; then - _msg_error "The path '${work_dir}/airootfs' does not exist" 1 + if [[ ! -e "${airootfs_dir}" ]]; then + _msg_error "The path '${airootfs_dir}' does not exist" 1 fi _msg_info "Creating ext4 image of 32GiB..." - truncate -s 32G -- "${work_dir}/airootfs.img" + truncate -s 32G -- "${airootfs_dir}.img" if [[ "${quiet}" == "y" ]]; then - mkfs.ext4 -q -O '^has_journal,^resize_inode' -E 'lazy_itable_init=0' -m 0 -F -- "${work_dir}/airootfs.img" + mkfs.ext4 -q -O '^has_journal,^resize_inode' -E 'lazy_itable_init=0' -m 0 -F -- "${airootfs_dir}.img" else - mkfs.ext4 -O '^has_journal,^resize_inode' -E 'lazy_itable_init=0' -m 0 -F -- "${work_dir}/airootfs.img" + mkfs.ext4 -O '^has_journal,^resize_inode' -E 'lazy_itable_init=0' -m 0 -F -- "${airootfs_dir}.img" fi - tune2fs -c 0 -i 0 -- "${work_dir}/airootfs.img" &> /dev/null + tune2fs -c 0 -i 0 -- "${airootfs_dir}.img" &> /dev/null _msg_info "Done!" _mount_airootfs - _msg_info "Copying '${work_dir}/airootfs/' to '${work_dir}/mnt/airootfs/'..." - cp -aT -- "${work_dir}/airootfs/" "${work_dir}/mnt/airootfs/" + _msg_info "Copying '${airootfs_dir}/' to '${work_dir}/mnt/airootfs/'..." + cp -aT -- "${airootfs_dir}/" "${work_dir}/mnt/airootfs/" chown root:root -- "${work_dir}/mnt/airootfs/" _msg_info "Done!" _umount_airootfs mkdir -p -- "${work_dir}/iso/${install_dir}/${arch}" _msg_info "Creating SquashFS image, this may take some time..." if [[ "${quiet}" = "y" ]]; then - mksquashfs "${work_dir}/airootfs.img" "${work_dir}/iso/${install_dir}/${arch}/airootfs.sfs" -noappend \ + mksquashfs "${airootfs_dir}.img" "${work_dir}/iso/${install_dir}/${arch}/airootfs.sfs" -noappend \ -comp "${sfs_comp}" -no-progress &> /dev/null else - mksquashfs "${work_dir}/airootfs.img" "${work_dir}/iso/${install_dir}/${arch}/airootfs.sfs" -noappend \ + mksquashfs "${airootfs_dir}.img" "${work_dir}/iso/${install_dir}/${arch}/airootfs.sfs" -noappend \ -comp "${sfs_comp}" fi _msg_info "Done!" - rm -- "${work_dir}/airootfs.img" + rm -- "${airootfs_dir}.img" } # Makes a SquashFS filesystem from a source directory. _mkairootfs_sfs () { - if [[ ! -e "${work_dir}/airootfs" ]]; then - _msg_error "The path '${work_dir}/airootfs' does not exist" 1 + if [[ ! -e "${airootfs_dir}" ]]; then + _msg_error "The path '${airootfs_dir}' does not exist" 1 fi mkdir -p -- "${work_dir}/iso/${install_dir}/${arch}" _msg_info "Creating SquashFS image, this may take some time..." if [[ "${quiet}" = "y" ]]; then - mksquashfs "${work_dir}/airootfs" "${work_dir}/iso/${install_dir}/${arch}/airootfs.sfs" -noappend \ + mksquashfs "${airootfs_dir}" "${work_dir}/iso/${install_dir}/${arch}/airootfs.sfs" -noappend \ -comp "${sfs_comp}" -no-progress &> /dev/null else - mksquashfs "${work_dir}/airootfs" "${work_dir}/iso/${install_dir}/${arch}/airootfs.sfs" -noappend \ + mksquashfs "${airootfs_dir}" "${work_dir}/iso/${install_dir}/${arch}/airootfs.sfs" -noappend \ -comp "${sfs_comp}" fi _msg_info "Done!" @@ -272,11 +288,12 @@ _mksignature () { _msg_info "Done!" } + command_pkglist () { _show_config pkglist _msg_info "Creating a list of installed packages on live-enviroment..." - pacman -Q --sysroot "${work_dir}/airootfs" > "${work_dir}/iso/${install_dir}/pkglist.${arch}.txt" + pacman -Q --sysroot "${airootfs_dir}" > "${work_dir}/iso/${install_dir}/pkglist.${arch}.txt" _msg_info "Done!" } @@ -386,8 +403,19 @@ command_run() { _chroot_run } -while getopts 'p:r:C:L:P:A:D:w:o:s:c:g:vh' arg; do +command_build_profile() { + _msg_warning "The ${FUNCNAME[0]#command_} command is not fully implemented yet :(" + # Set up essential directory paths + airootfs_dir="${work_dir}/${arch}/airootfs" + + exit 1 +} + +while getopts 'B:p:r:C:L:P:A:D:w:o:s:c:g:vh' arg; do case "${arg}" in + B) + profile="$(realpath -- "${OPTARG}")" + ;; p) read -r -a opt_pkg_list <<< "${OPTARG}" pkg_list+=("${opt_pkg_list[@]}") @@ -424,6 +452,9 @@ if (( $# < 1 )); then fi command_name="${1}" +# Set directory path defaults +airootfs_dir="${work_dir}/airootfs" + case "${command_name}" in init) command_init @@ -448,6 +479,9 @@ case "${command_name}" in img_name="${2}" command_iso ;; + build_profile) + command_build_profile + ;; *) _msg_error "Invalid command name '${command_name}'" 0 _usage 1 diff --git a/configs/releng/profiledef.sh b/configs/releng/profiledef.sh new file mode 100644 index 0000000..5eb5c5a --- /dev/null +++ b/configs/releng/profiledef.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +# shellcheck disable=SC2034 + +iso_name="archlinux" +iso_label="ARCH_$(date +%Y%m)" +iso_publisher="Arch Linux " +iso_application="Arch Linux Live/Rescue CD" +iso_version="$(date +%Y.%m.%d)" +install_dir="arch" +bootmodes=() +arch="x86_64" +pacman_conf="pacman.conf" -- cgit v1.2.3-54-g00ecf From 6a39300b0f0a08574038bad4537a27bb614a841d Mon Sep 17 00:00:00 2001 From: Alexander Epaneshnikov Date: Sat, 3 Oct 2020 22:32:05 +0300 Subject: implement accessibility support in archiso this fixes #67 --- Makefile | 3 +- .../etc/systemd/system/livecd-alsa-unmuter.service | 16 ++ .../etc/systemd/system/livecd-talk.service | 23 ++ .../multi-user.target.wants/livecd-talk.service | 1 + .../sound.target.wants/livecd-alsa-unmuter.service | 1 + configs/releng/airootfs/root/.zlogin | 5 + configs/releng/airootfs/usr/local/bin/livecd-sound | 252 +++++++++++++++++++++ .../usr/local/share/livecd-sound/asound.conf.in | 3 + .../entries/archiso-x86_64-speech-linux.conf | 9 + configs/releng/efiboot/loader/loader.conf | 2 +- configs/releng/packages.x86_64 | 4 + configs/releng/syslinux/archiso_head.cfg | 1 + configs/releng/syslinux/archiso_sys-linux.cfg | 11 + configs/releng/syslinux/archiso_sys.cfg | 2 +- 14 files changed, 330 insertions(+), 3 deletions(-) create mode 100644 configs/releng/airootfs/etc/systemd/system/livecd-alsa-unmuter.service create mode 100644 configs/releng/airootfs/etc/systemd/system/livecd-talk.service create mode 120000 configs/releng/airootfs/etc/systemd/system/multi-user.target.wants/livecd-talk.service create mode 120000 configs/releng/airootfs/etc/systemd/system/sound.target.wants/livecd-alsa-unmuter.service create mode 100755 configs/releng/airootfs/usr/local/bin/livecd-sound create mode 100644 configs/releng/airootfs/usr/local/share/livecd-sound/asound.conf.in create mode 100644 configs/releng/efiboot/loader/entries/archiso-x86_64-speech-linux.conf (limited to 'Makefile') diff --git a/Makefile b/Makefile index 2890026..1f94998 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,8 @@ lint: $(wildcard configs/*/build.sh) \ $(wildcard configs/*/profiledef.sh) \ configs/releng/airootfs/root/.automated_script.sh \ - configs/releng/airootfs/usr/local/bin/choose-mirror + configs/releng/airootfs/usr/local/bin/choose-mirror \ + configs/releng/airootfs/usr/local/bin/livecd-sound shellcheck -s dash $(HOOKS_FILES) $(SCRIPT_FILES) install: install-program install-examples install-doc diff --git a/configs/releng/airootfs/etc/systemd/system/livecd-alsa-unmuter.service b/configs/releng/airootfs/etc/systemd/system/livecd-alsa-unmuter.service new file mode 100644 index 0000000..8c5317d --- /dev/null +++ b/configs/releng/airootfs/etc/systemd/system/livecd-alsa-unmuter.service @@ -0,0 +1,16 @@ +# +# SPDX-License-Identifier: GPL-3.0-or-later + +[Unit] +Description=Unmute All Sound Card Controls For Use With The Live Arch Environment +# This needs to run after the audio device becomes available. +Wants=systemd-udev-settle.service +After=systemd-udev-settle.service sound.target +ConditionKernelCommandLine=accessibility=on + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/livecd-sound -u + +[Install] +WantedBy=sound.target diff --git a/configs/releng/airootfs/etc/systemd/system/livecd-talk.service b/configs/releng/airootfs/etc/systemd/system/livecd-talk.service new file mode 100644 index 0000000..d959ab3 --- /dev/null +++ b/configs/releng/airootfs/etc/systemd/system/livecd-talk.service @@ -0,0 +1,23 @@ +# +# SPDX-License-Identifier: GPL-3.0-or-later + +[Unit] +Description=Screen reader service +After=livecd-alsa-unmuter.service +Before=getty@tty1.service +ConditionKernelCommandLine=accessibility=on + +[Service] +Type=oneshot +TTYPath=/dev/tty13 +ExecStartPre=/usr/bin/chvt 13 +ExecStart=/usr/local/bin/livecd-sound -p +ExecStartPost=/usr/bin/chvt 1 +ExecStartPost=systemctl start espeakup.service +StandardInput=tty +TTYVHangup=yes +TTYVTDisallocate=yes +RemainAfterExit=true + +[Install] +WantedBy=multi-user.target diff --git a/configs/releng/airootfs/etc/systemd/system/multi-user.target.wants/livecd-talk.service b/configs/releng/airootfs/etc/systemd/system/multi-user.target.wants/livecd-talk.service new file mode 120000 index 0000000..b917481 --- /dev/null +++ b/configs/releng/airootfs/etc/systemd/system/multi-user.target.wants/livecd-talk.service @@ -0,0 +1 @@ +/etc/systemd/system/livecd-talk.service \ No newline at end of file diff --git a/configs/releng/airootfs/etc/systemd/system/sound.target.wants/livecd-alsa-unmuter.service b/configs/releng/airootfs/etc/systemd/system/sound.target.wants/livecd-alsa-unmuter.service new file mode 120000 index 0000000..98c0fc8 --- /dev/null +++ b/configs/releng/airootfs/etc/systemd/system/sound.target.wants/livecd-alsa-unmuter.service @@ -0,0 +1 @@ +../livecd-alsa-unmuter.service \ No newline at end of file diff --git a/configs/releng/airootfs/root/.zlogin b/configs/releng/airootfs/root/.zlogin index f598e43..0fb119d 100644 --- a/configs/releng/airootfs/root/.zlogin +++ b/configs/releng/airootfs/root/.zlogin @@ -1 +1,6 @@ +# fix for screen readers +if grep -Fq 'accessibility=' /proc/cmdline &> /dev/null; then + setopt SINGLE_LINE_ZLE +fi + ~/.automated_script.sh diff --git a/configs/releng/airootfs/usr/local/bin/livecd-sound b/configs/releng/airootfs/usr/local/bin/livecd-sound new file mode 100755 index 0000000..87d6f30 --- /dev/null +++ b/configs/releng/airootfs/usr/local/bin/livecd-sound @@ -0,0 +1,252 @@ +#!/usr/bin/env bash +# +# SPDX-License-Identifier: GPL-3.0-or-later + +usage() { + cat <<- _EOF_ + live cd sound helper script. + Usage: livecdsound [OPTION] + OPTIONS + -u, --unmute unmute all sound cards + -p, --pick select a card for speetch output + -h, --help Show this usage message + +_EOF_ +} + +bugout () { + printf "/usr/local/bin/livecdsound: programming error" + stat_fail +} + +echo_card_indices() +{ + if [ -f /proc/asound/cards ] ; then + sed -n -e's/^[[:space:]]*\([0-7]\)[[:space:]].*/\1/p' /proc/asound/cards + fi +} + +# The following functions try to set many controls. +# No card has all the controls and so some of the attempts are bound to fail. +# Because of this, the functions can't return useful status values. + +# $1 +# $2 +# $3 +unmute_and_set_level(){ + { [ "$3" ] &&[ "$2" ] && [ "$1" ] ; } || bugout + systemd-cat -t "livecdsound" printf "Setting: %s on card: %s to %s\n" "$2" "$1" "$3" + systemd-cat -t "livecdsound" amixer -c "$1" set "$2" "$3" unmute + return 0 +} + +# $1 +# $2 +mute_and_zero_level() +{ + { [ "$1" ] && [ "$2" ] ; } || bugout + systemd-cat -t "livecdsound" printf "Muting control: %s on card: %s\n" "$2" "$1" + systemd-cat -t "livecdsound" amixer -c "$1" set "$2" "0%" mute + return 0 +} + +# $1 +# $2 +# $3 "on" | "off" +switch_control() +{ + { [ "$3" ] && [ "$1" ] ; } || bugout + systemd-cat -t "livecdsound" printf "Switching control: %s on card: %s to %s\n" "$2" "$1" "$3" + systemd-cat -t "livecdsound" amixer -c "$1" set "$2" "$3" + return 0 +} + +# $1 +sanify_levels_on_card() +{ + unmute_and_set_level "$1" "Front" "80%" + unmute_and_set_level "$1" "Master" "80%" + unmute_and_set_level "$1" "Master Mono" "80%" + unmute_and_set_level "$1" "Master Digital" "80%" # E.g., cs4237B + unmute_and_set_level "$1" "Playback" "80%" + unmute_and_set_level "$1" "Headphone" "100%" + unmute_and_set_level "$1" "PCM" "80%" + unmute_and_set_level "$1" "PCM,1" "80%" # E.g., ess1969 + unmute_and_set_level "$1" "DAC" "80%" # E.g., envy24, cs46xx + unmute_and_set_level "$1" "DAC,0" "80%" # E.g., envy24 + unmute_and_set_level "$1" "DAC,1" "80%" # E.g., envy24 + unmute_and_set_level "$1" "Synth" "80%" + unmute_and_set_level "$1" "CD" "80%" + unmute_and_set_level "$1" "PC Speaker" "100%" + + mute_and_zero_level "$1" "Mic" + mute_and_zero_level "$1" "IEC958" # Ubuntu #19648 + + # Intel P4P800-MX + switch_control "$1" "Master Playback Switch" on + switch_control "$1" "Master Surround" on + + # Trident/YMFPCI/emu10k1: + unmute_and_set_level "$1" "Wave" "80%" + unmute_and_set_level "$1" "Music" "80%" + unmute_and_set_level "$1" "AC97" "80%" + + # DRC: + unmute_and_set_level "$1" "Dynamic Range Compression" "80%" + + # Required for HDA Intel (hda-intel): + unmute_and_set_level "$1" "Front" "80%" + + # Required for SB Live 7.1/24-bit (ca0106): + unmute_and_set_level "$1" "Analog Front" "80%" + + # Required at least for Via 823x hardware on DFI K8M800-MLVF Motherboard + switch_control "$1" "IEC958 Capture Monitor" off + + # Required for hardware allowing toggles for AC97 through IEC958, + # valid values are 0, 1, 2, 3. Needs to be set to 0 for PCM1. + unmute_and_set_level "$1" "IEC958 Playback AC97-SPSA" "0" + + # Required for newer Via hardware + unmute_and_set_level "$1" "VIA DXS,0" "80%" + unmute_and_set_level "$1" "VIA DXS,1" "80%" + unmute_and_set_level "$1" "VIA DXS,2" "80%" + unmute_and_set_level "$1" "VIA DXS,3" "80%" + + # Required on some notebooks with ICH4: + switch_control "$1" "Headphone Jack Sense" off + switch_control "$1" "Line Jack Sense" off + + # Some machines need one or more of these to be on; + # others need one or more of these to be off: + + switch_control "$1" "Audigy Analog/Digital Output Jack" on + switch_control "$1" "SB Live Analog/Digital Output Jack" on + + # D1984 -- Thinkpad T61/X61 + switch_control "$1" "Speaker" on + switch_control "$1" "Headphone" on + + # HDA-Intel w/ "Digital" capture mixer (See Ubuntu #193823) + unmute_and_set_level "$1" "Digital" "80%" + + return 0 +} + +# $1 | "all" +sanify_levels() +{ + local ttsdml_returnstatus=0 + local card + case "$1" in + all) + for card in $(echo_card_indices) ; do + sanify_levels_on_card "$card" || ttsdml_returnstatus=1 + done + ;; + *) + sanify_levels_on_card "$1" || ttsdml_returnstatus=1 + ;; + esac + return $ttsdml_returnstatus +} + +# List all cards that *should* be usable for PCM audio. In my experience, +# the console speaker (handled by the pcsp driver) isn't a suitable playback +# device, so we'll exclude it. +list_non_pcsp_cards() +{ + for card in $(echo_card_indices); do + local cardfile="/proc/asound/card${card}/id" + if [ -r "$cardfile" ] && [ -f "$cardfile" ] && \ + [ "$(cat "$cardfile")" != pcsp ]; then + echo "$card" + fi + done +} + +# Properly initialize the sound card so that we have audio at boot. +unmute_all_cards() +{ + sanify_levels all +} + +nwords() { + echo $# +} + +is_numeric() { + local str=$1 + expr match "$str" '[[:digit:]]\+$' > /dev/null 2>&1 +} + +set_default_card() { + local card=$1 + sed -e "s/%card%/$card/g" < /usr/local/share/livecd-sound/asound.conf.in \ + > /etc/asound.conf +} + +play_on_card() { + local card=$1 file=$2 + aplay -q "-Dplughw:$card,0" "$file" +} + +# If there are multiple usable sound cards, prompt the user to choose one, +# using auditory feedback. +pick_a_card() +{ + set -f + usable_cards="$(list_non_pcsp_cards)" + num_usable_cards=$(nwords $usable_cards) + + if [ "$num_usable_cards" -eq 1 ]; then + systemd-cat -t "livecdsound" printf "Only one sound card is detected\n" + exit 0 + fi + systemd-cat -t "livecdsound" printf "multiple sound cards detected\n" + for card in $usable_cards; do + if ! is_numeric "$card"; then + continue + fi + play_on_card "$card" /usr/share/livecd-sounds/pick-a-card.wav& + done + wait + sleep 1 + for card in $usable_cards; do + if ! is_numeric "$card"; then + continue + fi + play_on_card "$card" /usr/share/livecd-sounds/beep.wav + if read -r -t 10; then + systemd-cat -t "livecdsound" printf "Selecting %s sound card as default\n" "$card" + set_default_card "$card" + break + fi +done +} + +if [[ $# -eq 0 ]]; then + echo "error: No argument passed." + exit 1 +fi +while [[ "${1}" != "" ]]; do + case ${1} in + -h|--help) + usage + exit + ;; + -u|--unmute) + systemd-cat -t "livecdsound" printf "Unmuting all cards" + unmute_all_cards + ;; + -p|--pick) + pick_a_card + ;; + *) + echo "error: Unsupported argument" + usage + exit 1 + ;; + esac + shift +done diff --git a/configs/releng/airootfs/usr/local/share/livecd-sound/asound.conf.in b/configs/releng/airootfs/usr/local/share/livecd-sound/asound.conf.in new file mode 100644 index 0000000..3f9c7aa --- /dev/null +++ b/configs/releng/airootfs/usr/local/share/livecd-sound/asound.conf.in @@ -0,0 +1,3 @@ +Defaults node +defaults.ctl.card %card%; +defaults.pcm.card %card%; diff --git a/configs/releng/efiboot/loader/entries/archiso-x86_64-speech-linux.conf b/configs/releng/efiboot/loader/entries/archiso-x86_64-speech-linux.conf new file mode 100644 index 0000000..a9525ee --- /dev/null +++ b/configs/releng/efiboot/loader/entries/archiso-x86_64-speech-linux.conf @@ -0,0 +1,9 @@ +# +# SPDX-License-Identifier: GPL-3.0-or-later + +title Arch Linux install medium (x86_64, UEFI) with speach +linux /%INSTALL_DIR%/boot/x86_64/vmlinuz-linux +initrd /%INSTALL_DIR%/boot/intel-ucode.img +initrd /%INSTALL_DIR%/boot/amd-ucode.img +initrd /%INSTALL_DIR%/boot/x86_64/initramfs-linux.img +options archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% accessibility=on diff --git a/configs/releng/efiboot/loader/loader.conf b/configs/releng/efiboot/loader/loader.conf index 1ea5ce5..e4ef640 100644 --- a/configs/releng/efiboot/loader/loader.conf +++ b/configs/releng/efiboot/loader/loader.conf @@ -1,5 +1,5 @@ # # SPDX-License-Identifier: GPL-3.0-or-later -timeout 3 +timeout 30 default archiso-x86_64-linux.conf diff --git a/configs/releng/packages.x86_64 b/configs/releng/packages.x86_64 index c481c45..2160eb6 100644 --- a/configs/releng/packages.x86_64 +++ b/configs/releng/packages.x86_64 @@ -1,10 +1,12 @@ # # SPDX-License-Identifier: GPL-3.0-or-later +alsa-utils amd-ucode arch-install-scripts b43-fwcutter base bind-tools +brltty broadcom-wl btrfs-progs clonezilla @@ -19,6 +21,7 @@ dnsmasq dosfstools edk2-shell efibootmgr +espeakup ethtool exfatprogs f2fs-tools @@ -40,6 +43,7 @@ lftp linux linux-atm linux-firmware +livecd-sounds lsscsi lvm2 lynx diff --git a/configs/releng/syslinux/archiso_head.cfg b/configs/releng/syslinux/archiso_head.cfg index 2dc18ed..be08525 100644 --- a/configs/releng/syslinux/archiso_head.cfg +++ b/configs/releng/syslinux/archiso_head.cfg @@ -28,3 +28,4 @@ MENU COLOR msg07 37;40 #90ffffff #a0000000 std MENU COLOR tabmsg 31;40 #30ffffff #00000000 std MENU CLEAR +MENU IMMEDIATE diff --git a/configs/releng/syslinux/archiso_sys-linux.cfg b/configs/releng/syslinux/archiso_sys-linux.cfg index 6d0186b..d5fd776 100644 --- a/configs/releng/syslinux/archiso_sys-linux.cfg +++ b/configs/releng/syslinux/archiso_sys-linux.cfg @@ -10,3 +10,14 @@ MENU LABEL Arch Linux install medium (x86_64, BIOS) LINUX boot/x86_64/vmlinuz-linux INITRD boot/intel-ucode.img,boot/amd-ucode.img,boot/x86_64/initramfs-linux.img APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% + +# Accessibility boot option +LABEL arch64speech +TEXT HELP +Boot the Arch Linux install medium on BIOS with speakup screen reader. +It allows you to install Arch Linux or perform system maintenance with speech feedback. +ENDTEXT +MENU LABEL Arch Linux install medium (x86_64, BIOS) with ^speech +LINUX boot/x86_64/vmlinuz-linux +INITRD boot/intel-ucode.img,boot/amd-ucode.img,boot/x86_64/initramfs-linux.img +APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% accessibility=on diff --git a/configs/releng/syslinux/archiso_sys.cfg b/configs/releng/syslinux/archiso_sys.cfg index 8a61d49..ac06ef6 100644 --- a/configs/releng/syslinux/archiso_sys.cfg +++ b/configs/releng/syslinux/archiso_sys.cfg @@ -4,7 +4,7 @@ INCLUDE boot/syslinux/archiso_head.cfg DEFAULT arch64 -TIMEOUT 30 +TIMEOUT 300 INCLUDE boot/syslinux/archiso_sys-linux.cfg -- cgit v1.2.3-54-g00ecf From 0ae5cd961eaa1b214b964aa2076d35f9271f83cb Mon Sep 17 00:00:00 2001 From: Michael Vorburger Date: Sat, 23 Jan 2021 18:32:42 +0100 Subject: lint ALL (future) scripts/*.sh, not just run_archiso.sh --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 1f94998..854a2ef 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ check: lint lint: shellcheck -s bash archiso/mkarchiso \ - scripts/run_archiso.sh \ + $(wildcard scripts/*.sh) \ $(INSTALL_FILES) \ $(wildcard configs/*/build.sh) \ $(wildcard configs/*/profiledef.sh) \ -- cgit v1.2.3-54-g00ecf From 2a24429404f06c5ca20fe70a8d11656fac9c3b7d Mon Sep 17 00:00:00 2001 From: David Runge Date: Sun, 31 Jan 2021 16:27:41 +0100 Subject: Add continuous integration scripts to linting Makefile: Add scripts below .gitlab/ci/ to the lint target of the Makefile. --- Makefile | 1 + 1 file changed, 1 insertion(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 854a2ef..1d82597 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,7 @@ check: lint lint: shellcheck -s bash archiso/mkarchiso \ $(wildcard scripts/*.sh) \ + $(wildcard .gitlab/ci/*.sh) \ $(INSTALL_FILES) \ $(wildcard configs/*/build.sh) \ $(wildcard configs/*/profiledef.sh) \ -- cgit v1.2.3-54-g00ecf From 874166ec7b308d430a34fe21d95b84aa7912722c Mon Sep 17 00:00:00 2001 From: David Runge Date: Sat, 31 Jul 2021 17:27:17 +0200 Subject: Makefile: Remove mkinitcpio-archiso specific targets Makefile: Remove all code specific to mkinitcpio-archiso. Allow overriding PREFIX (defaults to /usr/local). Gather scripts to check more generically. Add abstractions for installation directories. --- Makefile | 53 +++++++++++++++++------------------------------------ 1 file changed, 17 insertions(+), 36 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 1d82597..c4ceb2f 100644 --- a/Makefile +++ b/Makefile @@ -1,52 +1,33 @@ # # SPDX-License-Identifier: GPL-3.0-or-later -INSTALL_FILES=$(wildcard archiso/initcpio/install/*) -HOOKS_FILES=$(wildcard archiso/initcpio/hooks/*) -SCRIPT_FILES=$(wildcard archiso/initcpio/script/*) - -INSTALL_DIR=$(DESTDIR)/usr/lib/initcpio/install -HOOKS_DIR=$(DESTDIR)/usr/lib/initcpio/hooks -SCRIPT_DIR=$(DESTDIR)/usr/lib/initcpio +PREFIX ?= /usr/local +BIN_DIR=$(DESTDIR)$(PREFIX)/bin +DOC_DIR=$(DESTDIR)$(PREFIX)/share/doc/archiso +PROFILE_DIR=$(DESTDIR)$(PREFIX)/share/archiso DOC_FILES=$(wildcard docs/*) $(wildcard *.rst) - -DOC_DIR=$(DESTDIR)/usr/share/doc/archiso - +SCRIPT_FILES=$(wildcard archiso/*) $(wildcard scripts/*.sh) $(wildcard .gitlab/ci/*.sh) \ + $(wildcard configs/*/profiledef.sh) $(wildcard configs/*/airootfs/usr/local/bin/*) all: -check: lint - -lint: - shellcheck -s bash archiso/mkarchiso \ - $(wildcard scripts/*.sh) \ - $(wildcard .gitlab/ci/*.sh) \ - $(INSTALL_FILES) \ - $(wildcard configs/*/build.sh) \ - $(wildcard configs/*/profiledef.sh) \ - configs/releng/airootfs/root/.automated_script.sh \ - configs/releng/airootfs/usr/local/bin/choose-mirror \ - configs/releng/airootfs/usr/local/bin/livecd-sound - shellcheck -s dash $(HOOKS_FILES) $(SCRIPT_FILES) +check: shellcheck -install: install-program install-examples install-doc +shellcheck: + shellcheck -s bash $(SCRIPT_FILES) -install-program: - install -vDm 755 archiso/mkarchiso -t "$(DESTDIR)/usr/bin/" - install -vDm 755 scripts/run_archiso.sh "$(DESTDIR)/usr/bin/run_archiso" +install: install-scripts install-profiles install-doc -install-initcpio: - install -d $(SCRIPT_DIR) $(HOOKS_DIR) $(INSTALL_DIR) - install -m 755 -t $(SCRIPT_DIR) $(SCRIPT_FILES) - install -m 644 -t $(HOOKS_DIR) $(HOOKS_FILES) - install -m 644 -t $(INSTALL_DIR) $(INSTALL_FILES) +install-scripts: + install -vDm 755 archiso/mkarchiso -t "$(BIN_DIR)/" + install -vDm 755 scripts/run_archiso.sh "$(BIN_DIR)/run_archiso" -install-examples: - install -d -m 755 $(DESTDIR)/usr/share/archiso/ - cp -a --no-preserve=ownership configs $(DESTDIR)/usr/share/archiso/ +install-profiles: + install -d -m 755 $(PROFILE_DIR) + cp -a --no-preserve=ownership configs $(PROFILE_DIR)/ install-doc: install -vDm 644 $(DOC_FILES) -t $(DOC_DIR) -.PHONY: check install install-program install-initcpio install-examples install-doc lint +.PHONY: check install install-doc install-profiles install-scripts shellcheck -- cgit v1.2.3-54-g00ecf