Compare commits

...

10 Commits

Author SHA1 Message Date
423896750a buildiso: show which calamares mode is configured
All checks were successful
Artools shellcheck / lint (push) Successful in 20s
2024-02-01 20:32:55 +01:00
ad09046044 buildiso: adopt new calamares services-artix paths
All checks were successful
Artools shellcheck / lint (push) Successful in 24s
2024-02-01 20:00:59 +01:00
c335cab68c buildiso: don't install firmware license, doesn't exist any longer
All checks were successful
Artools shellcheck / lint (push) Successful in 26s
2024-01-16 12:27:20 +01:00
e744e80c57 iso (#100)
All checks were successful
Artools shellcheck / lint (push) Successful in 26s
Reviewed-on: #100
Co-authored-by: Artoo <artoo@artixlinux.org>
Co-committed-by: Artoo <artoo@artixlinux.org>
2024-01-02 20:19:03 +01:00
06bcd79858 iso-gpg (#99)
All checks were successful
Artools shellcheck / lint (push) Successful in 25s
Reviewed-on: #99
Co-authored-by: Artoo <artoo@artixlinux.org>
Co-committed-by: Artoo <artoo@artixlinux.org>
2023-12-29 19:06:16 +01:00
dbb63dcd5e buildiso: remove obsolete cal conf
All checks were successful
Artools shellcheck / lint (push) Successful in 26s
2023-12-28 04:31:39 +01:00
4e510b2f1e buildiso: support services-artix cal module
All checks were successful
Artools shellcheck / lint (push) Successful in 28s
2023-12-28 04:27:26 +01:00
f06ac2c369 buildiso: sed the netinstall.conf for init data url
All checks were successful
Artools shellcheck / lint (push) Successful in 1m11s
2023-12-24 00:50:55 +01:00
736bac6dd7 buildiso: check for netstrap & netinstall conf files
All checks were successful
Artools shellcheck / lint (push) Successful in 25s
2023-12-21 21:50:45 +01:00
1fd3b796c5 buildiso: support netstrap & netinstall calamares modules
All checks were successful
Artools shellcheck / lint (pull_request) Successful in 29s
Artools shellcheck / lint (push) Successful in 25s
2023-12-21 16:11:56 +01:00
10 changed files with 392 additions and 91 deletions

View File

@@ -14,9 +14,9 @@
# default arch to build
# ARCH=$(uname -m)
# default pacman.conf repos to include
# possible values: {world,galaxy}{-gremlins,-goblins}
# REPO="world"
# default pacman.conf to include
# possible values: {stable,gremlins,goblins}
# STABILITY="stable"
# default iso storage directory
# ISO_POOL="${WORKSPACE_DIR}/iso"

View File

@@ -0,0 +1,115 @@
#
# /etc/pacman.conf
#
# See the pacman.conf(5) manpage for option and repository directives
#
# GENERAL OPTIONS
#
[options]
# The following paths are commented out with their default values listed.
# If you wish to use different paths, uncomment and update the paths.
#RootDir = /
#DBPath = /var/lib/pacman/
#CacheDir = /var/cache/pacman/pkg/
#LogFile = /var/log/pacman.log
#GPGDir = /etc/pacman.d/gnupg/
#HookDir = /etc/pacman.d/hooks/
HoldPkg = pacman glibc
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
#CleanMethod = KeepInstalled
Architecture = auto
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
#IgnorePkg =
#IgnoreGroup =
#NoUpgrade =
#NoExtract =
# Misc options
#UseSyslog
Color
#NoProgressBar
CheckSpace
VerbosePkgLists
ParallelDownloads = 10
# By default, pacman accepts packages signed by keys that its local keyring
# trusts (see pacman-key and its man page), as well as unsigned packages.
SigLevel = Required DatabaseOptional
LocalFileSigLevel = Optional
#RemoteFileSigLevel = Required
# NOTE: You must run `pacman-key --init` before first using pacman; the local
# keyring can then be populated with the keys of all official Artix Linux
# packagers with `pacman-key --populate artix`.
#
# REPOSITORIES
# - can be defined here or included from another file
# - pacman will search repositories in the order defined here
# - local/custom mirrors can be added here or in separate files
# - repositories listed first will take precedence when packages
# have identical names, regardless of version number
# - URLs will have $repo replaced by the name of the current repo
# - URLs will have $arch replaced by the name of the architecture
#
# Repository entries are of the format:
# [repo-name]
# Server = ServerName
# Include = IncludePath
#
# The header [repo-name] is crucial - it must be present and
# uncommented to enable the repo.
#
# The gremlins repositories are disabled by default. To enable, uncomment the
# repo name header and Include lines. You can add preferred servers immediately
# after the header, and they will be used before the default mirrors.
[system-goblins]
Include = /etc/pacman.d/mirrorlist
[system-gremlins]
Include = /etc/pacman.d/mirrorlist
[system]
Include = /etc/pacman.d/mirrorlist
[world-goblins]
Include = /etc/pacman.d/mirrorlist
[world-gremlins]
Include = /etc/pacman.d/mirrorlist
[world]
Include = /etc/pacman.d/mirrorlist
[galaxy-goblins]
Include = /etc/pacman.d/mirrorlist
[galaxy-gremlins]
Include = /etc/pacman.d/mirrorlist
[galaxy]
Include = /etc/pacman.d/mirrorlist
# If you want to run 32 bit applications on your x86_64 system,
# enable the lib32 repositories as required here.
# [lib32-goblins]
# Include = /etc/pacman.d/mirrorlist
#
# [lib32-gremlins]
# Include = /etc/pacman.d/mirrorlist
#
# [lib32]
# Include = /etc/pacman.d/mirrorlist
# An example of a custom package repository. See the pacman manpage for
# tips on creating your own repositories.
#[custom]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs

View File

@@ -0,0 +1,103 @@
#
# /etc/pacman.conf
#
# See the pacman.conf(5) manpage for option and repository directives
#
# GENERAL OPTIONS
#
[options]
# The following paths are commented out with their default values listed.
# If you wish to use different paths, uncomment and update the paths.
#RootDir = /
#DBPath = /var/lib/pacman/
#CacheDir = /var/cache/pacman/pkg/
#LogFile = /var/log/pacman.log
#GPGDir = /etc/pacman.d/gnupg/
#HookDir = /etc/pacman.d/hooks/
HoldPkg = pacman glibc
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
#CleanMethod = KeepInstalled
Architecture = auto
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
#IgnorePkg =
#IgnoreGroup =
#NoUpgrade =
#NoExtract =
# Misc options
#UseSyslog
Color
#NoProgressBar
CheckSpace
VerbosePkgLists
ParallelDownloads = 10
# By default, pacman accepts packages signed by keys that its local keyring
# trusts (see pacman-key and its man page), as well as unsigned packages.
SigLevel = Required DatabaseOptional
LocalFileSigLevel = Optional
#RemoteFileSigLevel = Required
# NOTE: You must run `pacman-key --init` before first using pacman; the local
# keyring can then be populated with the keys of all official Artix Linux
# packagers with `pacman-key --populate artix`.
#
# REPOSITORIES
# - can be defined here or included from another file
# - pacman will search repositories in the order defined here
# - local/custom mirrors can be added here or in separate files
# - repositories listed first will take precedence when packages
# have identical names, regardless of version number
# - URLs will have $repo replaced by the name of the current repo
# - URLs will have $arch replaced by the name of the architecture
#
# Repository entries are of the format:
# [repo-name]
# Server = ServerName
# Include = IncludePath
#
# The header [repo-name] is crucial - it must be present and
# uncommented to enable the repo.
#
# The gremlins repositories are disabled by default. To enable, uncomment the
# repo name header and Include lines. You can add preferred servers immediately
# after the header, and they will be used before the default mirrors.
[system-gremlins]
Include = /etc/pacman.d/mirrorlist
[system]
Include = /etc/pacman.d/mirrorlist
[world-gremlins]
Include = /etc/pacman.d/mirrorlist
[world]
Include = /etc/pacman.d/mirrorlist
[galaxy-gremlins]
Include = /etc/pacman.d/mirrorlist
[galaxy]
Include = /etc/pacman.d/mirrorlist
# If you want to run 32 bit applications on your x86_64 system,
# enable the lib32 repositories as required here.
# [lib32-gremlins]
# Include = /etc/pacman.d/mirrorlist
#
# [lib32]
# Include = /etc/pacman.d/mirrorlist
# An example of a custom package repository. See the pacman manpage for
# tips on creating your own repositories.
#[custom]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs

View File

@@ -0,0 +1,103 @@
#
# /etc/pacman.conf
#
# See the pacman.conf(5) manpage for option and repository directives
#
# GENERAL OPTIONS
#
[options]
# The following paths are commented out with their default values listed.
# If you wish to use different paths, uncomment and update the paths.
#RootDir = /
#DBPath = /var/lib/pacman/
#CacheDir = /var/cache/pacman/pkg/
#LogFile = /var/log/pacman.log
#GPGDir = /etc/pacman.d/gnupg/
#HookDir = /etc/pacman.d/hooks/
HoldPkg = pacman glibc
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
#CleanMethod = KeepInstalled
Architecture = auto
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
#IgnorePkg =
#IgnoreGroup =
#NoUpgrade =
#NoExtract =
# Misc options
#UseSyslog
Color
#NoProgressBar
CheckSpace
VerbosePkgLists
ParallelDownloads = 10
# By default, pacman accepts packages signed by keys that its local keyring
# trusts (see pacman-key and its man page), as well as unsigned packages.
SigLevel = Required DatabaseOptional
LocalFileSigLevel = Optional
#RemoteFileSigLevel = Required
# NOTE: You must run `pacman-key --init` before first using pacman; the local
# keyring can then be populated with the keys of all official Artix Linux
# packagers with `pacman-key --populate artix`.
#
# REPOSITORIES
# - can be defined here or included from another file
# - pacman will search repositories in the order defined here
# - local/custom mirrors can be added here or in separate files
# - repositories listed first will take precedence when packages
# have identical names, regardless of version number
# - URLs will have $repo replaced by the name of the current repo
# - URLs will have $arch replaced by the name of the architecture
#
# Repository entries are of the format:
# [repo-name]
# Server = ServerName
# Include = IncludePath
#
# The header [repo-name] is crucial - it must be present and
# uncommented to enable the repo.
#
# The gremlins repositories are disabled by default. To enable, uncomment the
# repo name header and Include lines. You can add preferred servers immediately
# after the header, and they will be used before the default mirrors.
# [system-gremlins]
# Include = /etc/pacman.d/mirrorlist
[system]
Include = /etc/pacman.d/mirrorlist
# [world-gremlins]
# Include = /etc/pacman.d/mirrorlist
[world]
Include = /etc/pacman.d/mirrorlist
# [galaxy-gremlins]
# Include = /etc/pacman.d/mirrorlist
[galaxy]
Include = /etc/pacman.d/mirrorlist
# If you want to run 32 bit applications on your x86_64 system,
# enable the lib32 repositories as required here.
# [lib32-gremlins]
# Include = /etc/pacman.d/mirrorlist
#
# [lib32]
# Include = /etc/pacman.d/mirrorlist
# An example of a custom package repository. See the pacman manpage for
# tips on creating your own repositories.
#[custom]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs

View File

@@ -92,7 +92,11 @@ make_rootfs() {
prepare_dir "${rootfs}"
basestrap "${basestrap_args[@]}" "${rootfs}" "${packages[@]}"
local args=()
if "${copy_pacconf}"; then
args+=(-P)
fi
basestrap "${basestrap_args[@]}" "${args[@]}" "${rootfs}" "${packages[@]}"
copy_overlay "${root_overlay}" "${rootfs}"
@@ -186,8 +190,8 @@ gen_iso_fn(){
local vars=("artix") name
vars+=("${profile}")
vars+=("${INITSYS}")
case "${repo}" in
*-gremlins|*-goblins) vars+=("${repo#*-}") ;;
case "${STABILITY}" in
gremlins|goblins) vars+=("${STABILITY}") ;;
esac
vars+=("${ISO_VERSION}")
vars+=("${arch}")
@@ -197,12 +201,22 @@ gen_iso_fn(){
printf "%s\n" "$name"
}
export_gpg_publickey() {
key_export="${WORKSPACE_DIR}"/pubkey.gpg
gpg --batch --no-armor --output "${key_export}" --export "${GPG_KEY}"
}
prepare_build(){
load_profile
local pac_conf
pacman_conf="${DATADIR}/pacman.conf.d/${repo}-${arch}.conf"
if [[ -f "${USER_CONF_DIR}/pacman.conf.d/${repo}-${arch}.conf" ]]; then
pacman_conf="${USER_CONF_DIR}/pacman.conf.d/${repo}-${arch}.conf"
pac_conf=iso-${arch}.conf
if [[ "${STABILITY}" != 'stable' ]]; then
pac_conf=iso-${STABILITY}-${arch}.conf
fi
pacman_conf="${DATADIR}/pacman.conf.d/${pac_conf}"
if [[ -f "${USER_CONF_DIR}/pacman.conf.d/${pac_conf}" ]]; then
pacman_conf="${USER_CONF_DIR}/pacman.conf.d/${pac_conf}"
fi
iso_file=$(gen_iso_fn).iso
@@ -323,11 +337,11 @@ persist=false
use_dracut=false
squash_only=false
boot_only=false
copy_pacconf=false
basestrap_args=(-GMc)
cmd=${0##*/}
repo=${REPO}
owner=${SUDO_USER:-$USER}
profile='base'
chroots_iso="${CHROOTS_DIR}/buildiso"
@@ -338,8 +352,8 @@ usage() {
printf ' -p <profile> Profile [default: %s]\n' "${profile}"
printf ' -r <dir> Chroots directory\n'
printf ' [default: %s]\n' "${chroots_iso}"
printf ' -R <repo> Build repo\n'
printf ' [default: %s]\n' "${repo}"
printf ' -R <stability> Build stability\n'
printf ' [default: %s]\n' "${STABILITY}"
printf ' -a <arch> Build arch\n'
printf ' [default: %s]\n' "${arch}"
printf ' -t <dir> Target directory\n'
@@ -356,6 +370,7 @@ usage() {
printf ' -z Generate iso only\n'
printf ' Requires pre built images (-x)\n'
printf ' -d Use dracut instead of mkinitcpio for iso initramfs\n'
printf ' -w Copy the pacman.conf used to the rootfs\n'
printf ' -q Query settings and pretend build\n'
printf ' -h This help\n'
printf '\n'
@@ -365,13 +380,13 @@ usage() {
orig_args=("$@")
opts='p:r:R:t:i:g:a:czsbxmdqh'
opts='p:r:R:t:i:g:a:czsbxwmdqh'
while getopts "${opts}" arg; do
case "${arg}" in
p) profile="$OPTARG" ;;
a) arch="$OPTARG" ;;
R) repo="$OPTARG" ;;
R) STABILITY="$OPTARG" ;;
r) chroots_iso="$OPTARG" ;;
t) ISO_POOL="$OPTARG" ;;
i) INITSYS="$OPTARG" ;;
@@ -383,6 +398,7 @@ while getopts "${opts}" arg; do
b) boot_only=true ;;
m) persist=true ;;
d) use_dracut=true ;;
w) copy_pacconf=true ;;
q) pretend=true ;;
h|?) usage 0 ;;
esac

View File

@@ -5,59 +5,31 @@
#{{{ calamares
yaml_array() {
local array
local array yaml
for entry in "$@"; do
array="${array:-}${array:+,} ${entry}"
yaml="{name: ${entry}, action: enable, alias: add, target: default}"
array="${array:-}${array:+,} ${yaml}"
done
printf "%s\n" "[${array}]"
}
write_services_conf() {
local key1="$1" key2="$2" val1="$3" val2="$4"
local conf="$5"/services-"${INITSYS}".conf
local svc
svc=$(yaml_array "${SERVICES[@]}")
yq -n '"---"' > "$conf"
key1="$key1" key2="$key2" val1="$val1" val2="$val2" svc="$svc" \
yq -P 'with(
.;
eval(strenv(key1)) = env(val1) |
eval(strenv(key2)) = env(val2) |
.services = env(svc))' \
-i "$conf"
if [[ ${INITSYS} == 's6' ]]; then
yq -P '.defaultBundle = "default"' -i "$conf"
fi
}
write_services_openrc_conf(){
write_services_conf '.initdDir' '.runlevelsDir' '/etc/init.d' '/etc/runlevels' "$1"
}
write_services_runit_conf(){
write_services_conf '.svDir' '.runsvDir' '/etc/runit/sv' '/etc/runit/runsvdir' "$1"
}
write_services_s6_conf(){
write_services_conf '.svDir' '.dbDir' '/etc/s6/sv' '/etc/s6/rc/compiled' "$1"
}
write_services_dinit_conf(){
write_services_conf '.initdDir' '.runsvDir' '/etc/dinit.d' '/etc/dinit.d/boot.d' "$1"
}
configure_calamares(){
local mods="$1/etc/calamares/modules"
if [[ -d "$mods" ]];then
msg2 "Configuring: Calamares"
write_services_"${INITSYS}"_conf "$mods"
sed -e "s|services-openrc|services-${INITSYS}|" \
-i "$1"/etc/calamares/settings.conf
fi
for config in online offline; do
local mods="$1/etc/calamares-$config/modules"
if [[ -d "$mods" ]];then
msg2 "Configuring: Calamares %s" "$config"
if [[ -f "$mods"/services-artix.conf ]]; then
local svc init
init="${INITSYS}" svc=$(yaml_array "${SERVICES[@]}") \
yq -P 'with(.;
.manager = env(init) |
.services = env(svc) )' \
-i "$mods"/services-artix.conf
fi
fi
done
}
#}}}

View File

@@ -13,7 +13,6 @@ prepare_boot_extras(){
done
cp "$src"/boot/memtest86+/memtest.bin "$dest"/memtest
cp "$src"/usr/share/licenses/common/GPL2/license.txt "$dest"/memtest.COPYING
}
#}}}

View File

@@ -4,29 +4,6 @@
#{{{ initcpio
make_checksum(){
local file="$1"
msg2 "Creating md5sum ..."
cd "${iso_root}${live_dir}"
md5sum "$file" > "$file".md5
cd "${OLDPWD}"
}
make_sig () {
local file="$1"
msg2 "Creating signature file..."
chown "${owner}:$(id --group "${owner}")" "${iso_root}${live_dir}"
su "${owner}" -c "gpg --detach-sign --output $file.sig --default-key ${GPG_KEY} $file"
chown "root:root" "${iso_root}${live_dir}"
}
export_gpg_publickey() {
key_export=${WORKSPACE_DIR}/pubkey.gpg
if [[ ! -e "${key_export}" ]]; then
gpg --batch --output "${key_export}" --export "${GPG_KEY}"
fi
}
prepare_initramfs_mkinitcpio() {
local mnt="$1" mkinitcpio_conf k
@@ -34,8 +11,8 @@ prepare_initramfs_mkinitcpio() {
[[ "${profile}" == 'base' ]] && mkinitcpio_conf=mkinitcpio-pxe.conf
k=$(<"$mnt"/usr/src/linux/version)
if [[ -n "${GPG_KEY}" ]]; then
exec {ARTIX_GNUPG_FD}<>"${key_export}"
if [[ -v key_export ]]; then
exec {ARTIX_GNUPG_FD}<"${key_export}"
export ARTIX_GNUPG_FD
fi
@@ -43,13 +20,11 @@ prepare_initramfs_mkinitcpio() {
-c /etc/"$mkinitcpio_conf" \
-g /boot/initramfs.img
if [[ -n "${GPG_KEY}" ]]; then
if [[ -v key_export ]]; then
exec {ARTIX_GNUPG_FD}<&-
unset ARTIX_GNUPG_FD
fi
if [[ -f "${key_export}" ]]; then
rm "${key_export}"
fi
rm -rf -- "${key_export}"
cp "$mnt"/boot/initramfs.img "${iso_root}"/boot/initramfs-"${arch}".img
prepare_boot_extras "$mnt"
}

View File

@@ -4,6 +4,24 @@
#{{{ squash
make_checksum(){
local file="$1"
msg2 "Creating md5sum ..."
cd "${iso_root}${live_dir}"
md5sum "$file" > "$file".md5
cd "${OLDPWD}"
}
make_sig () {
local file="$1"
msg2 "Creating signature file..."
chown "${owner}:$(id --group "${owner}")" "${iso_root}${live_dir}"
su "${owner}" -c "gpg --batch --no-armor --no-include-key-block --output $file.sig --detach-sign \
--default-key ${GPG_KEY} ${gpg_options[@]} $file"
chown "root:root" "${iso_root}${live_dir}"
}
make_ext_img(){
local src="$1"
local size=32G

View File

@@ -34,7 +34,7 @@ load_iso_config(){
ARCH=${ARCH:-"$(uname -m)"}
REPO=${REPO:-'world'}
STABILITY=${STABILITY:-'stable'}
ISO_POOL=${ISO_POOL:-"${WORKSPACE_DIR}/iso"}