Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
450ac445e4 | |||
56b350ffd0 | |||
a6c4513867 | |||
c50715f258 | |||
77296c4527 | |||
3f419cc41e | |||
60d7ac62a5 | |||
8cc8b66e7f | |||
0ae8c16801 | |||
bb674109ed |
@@ -21,6 +21,8 @@ load_config "${USERCONFDIR}/artools/artools.conf" || load_config "${SYSCONFDIR}/
|
|||||||
|
|
||||||
create_first=false
|
create_first=false
|
||||||
rebuild=false
|
rebuild=false
|
||||||
|
no_check=false
|
||||||
|
is_checkpkg=false
|
||||||
|
|
||||||
mkchrootpkg_args=(-c -n)
|
mkchrootpkg_args=(-c -n)
|
||||||
|
|
||||||
@@ -33,6 +35,8 @@ usage() {
|
|||||||
echo " -r <dir> Create chroots in this directory"
|
echo " -r <dir> Create chroots in this directory"
|
||||||
echo ' -c Recreate the chroot before building'
|
echo ' -c Recreate the chroot before building'
|
||||||
echo ' -m Major rebuild'
|
echo ' -m Major rebuild'
|
||||||
|
echo ' -N Disable check() function'
|
||||||
|
echo ' -C Run checkpkg after built'
|
||||||
echo ' -h This help'
|
echo ' -h This help'
|
||||||
echo ''
|
echo ''
|
||||||
echo "Default mkchrootpkg_args args: ${mkchrootpkg_args[*]}"
|
echo "Default mkchrootpkg_args args: ${mkchrootpkg_args[*]}"
|
||||||
@@ -42,13 +46,15 @@ usage() {
|
|||||||
|
|
||||||
orig_argv=("$0" "$@")
|
orig_argv=("$0" "$@")
|
||||||
|
|
||||||
opts='hcmr:'
|
opts='hcCNmr:'
|
||||||
|
|
||||||
while getopts "${opts}" arg; do
|
while getopts "${opts}" arg; do
|
||||||
case "${arg}" in
|
case "${arg}" in
|
||||||
r) CHROOTS_PKG="$OPTARG" ;;
|
r) CHROOTS_PKG="$OPTARG" ;;
|
||||||
c) create_first=true ;;
|
c) create_first=true ;;
|
||||||
m) rebuild=true ;;
|
m) rebuild=true ;;
|
||||||
|
C) is_checkpkg=true; mkchrootpkg_args+=(-C) ;;
|
||||||
|
N) no_check=true; mkchrootpkg_args+=(-N) ;;
|
||||||
h|?) usage 0 ;;
|
h|?) usage 0 ;;
|
||||||
*) echo "invalid argument '%s'" "${arg}"; usage 1 ;;
|
*) echo "invalid argument '%s'" "${arg}"; usage 1 ;;
|
||||||
esac
|
esac
|
||||||
|
@@ -17,16 +17,22 @@
|
|||||||
|
|
||||||
shopt -s extglob
|
shopt -s extglob
|
||||||
|
|
||||||
|
# Source makepkg.conf; fail if it is not found
|
||||||
if [[ -r '/etc/makepkg.conf' ]]; then
|
if [[ -r '/etc/makepkg.conf' ]]; then
|
||||||
source '/etc/makepkg.conf'
|
# shellcheck source=makepkg-x86_64.conf
|
||||||
|
source '/etc/makepkg.conf'
|
||||||
else
|
else
|
||||||
die '/etc/makepkg.conf not found!'
|
die '/etc/makepkg.conf not found!'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
load_user_info
|
# Source user-specific makepkg.conf overrides
|
||||||
|
if [[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf" ]]; then
|
||||||
load_vars "${USERCONFDIR}/pacman/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf"
|
# shellcheck source=/dev/null
|
||||||
load_vars /etc/makepkg.conf
|
source "${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf"
|
||||||
|
elif [[ -r "$HOME/.makepkg.conf" ]]; then
|
||||||
|
# shellcheck source=/dev/null
|
||||||
|
source "$HOME/.makepkg.conf"
|
||||||
|
fi
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
cat <<- _EOF_
|
cat <<- _EOF_
|
||||||
@@ -60,17 +66,17 @@ while :; do
|
|||||||
case $1 in
|
case $1 in
|
||||||
-r|--rmdir)
|
-r|--rmdir)
|
||||||
RMDIR=1
|
RMDIR=1
|
||||||
;;
|
;;
|
||||||
-w|--warn)
|
-w|--warn)
|
||||||
WARN=1
|
WARN=1
|
||||||
;;
|
;;
|
||||||
-h|--help)
|
-h|--help)
|
||||||
usage
|
usage
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
--)
|
--)
|
||||||
shift; break
|
shift; break
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
@@ -79,8 +85,9 @@ if [[ ! -f PKGBUILD ]]; then
|
|||||||
die 'This must be run in the directory of a built package.'
|
die 'This must be run in the directory of a built package.'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# shellcheck source=PKGBUILD.proto
|
||||||
. ./PKGBUILD
|
. ./PKGBUILD
|
||||||
if [[ $arch == 'any' ]]; then
|
if [[ ${arch[0]} == 'any' ]]; then
|
||||||
CARCH='any'
|
CARCH='any'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -91,7 +98,7 @@ TEMPDIR=$(mktemp -d --tmpdir checkpkg-script.XXXX)
|
|||||||
for _pkgname in "${pkgname[@]}"; do
|
for _pkgname in "${pkgname[@]}"; do
|
||||||
comparepkg=$_pkgname
|
comparepkg=$_pkgname
|
||||||
pkgurl=
|
pkgurl=
|
||||||
target_pkgver=$(get_full_version)
|
target_pkgver=$(get_full_version "$_pkgname")
|
||||||
if ! pkgfile=$(find_cached_package "$_pkgname" "$target_pkgver" "$CARCH"); then
|
if ! pkgfile=$(find_cached_package "$_pkgname" "$target_pkgver" "$CARCH"); then
|
||||||
die 'tarball not found for package: %s' "${_pkgname}-$target_pkgver"
|
die 'tarball not found for package: %s' "${_pkgname}-$target_pkgver"
|
||||||
fi
|
fi
|
||||||
@@ -142,7 +149,7 @@ for _pkgname in "${pkgname[@]}"; do
|
|||||||
(( WARN )) && warning "$message" || msg "$message"
|
(( WARN )) && warning "$message" || msg "$message"
|
||||||
echo "$diff_output"
|
echo "$diff_output"
|
||||||
else
|
else
|
||||||
msg "No soname differences for %s" "$_pkgname."
|
msg "No soname differences for %s." "$_pkgname"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@@ -65,7 +65,6 @@ update_repo2(){
|
|||||||
if ${add_pkg};then
|
if ${add_pkg};then
|
||||||
local action='add'
|
local action='add'
|
||||||
packages+=("$name")
|
packages+=("$name")
|
||||||
# checkpkg "${pkgfile}" || return 2
|
|
||||||
if ${sign_pkg};then
|
if ${sign_pkg};then
|
||||||
[[ -e ${pkgfile}.sig ]] && rm ${pkgfile}.sig
|
[[ -e ${pkgfile}.sig ]] && rm ${pkgfile}.sig
|
||||||
signfile ${pkgfile}
|
signfile ${pkgfile}
|
||||||
@@ -109,7 +108,6 @@ update_repo(){
|
|||||||
if ${add_pkg};then
|
if ${add_pkg};then
|
||||||
local action='add'
|
local action='add'
|
||||||
packages+=("$pkg")
|
packages+=("$pkg")
|
||||||
# checkpkg "${pkgfile}" || return 2
|
|
||||||
if ${sign_pkg};then
|
if ${sign_pkg};then
|
||||||
[[ -e ${pkgfile}.sig ]] && rm ${pkgfile}.sig
|
[[ -e ${pkgfile}.sig ]] && rm ${pkgfile}.sig
|
||||||
signfile ${pkgfile}
|
signfile ${pkgfile}
|
||||||
|
@@ -33,6 +33,7 @@ REPO_DB_PREFIX=
|
|||||||
REPO_DB_SUFFIX=
|
REPO_DB_SUFFIX=
|
||||||
LOCKFILE=
|
LOCKFILE=
|
||||||
CLEAN_LOCK=0
|
CLEAN_LOCK=0
|
||||||
|
PREVENT_DOWNGRADE=0
|
||||||
|
|
||||||
. @libdir@/artools/util-base.sh
|
. @libdir@/artools/util-base.sh
|
||||||
|
|
||||||
@@ -52,6 +53,7 @@ Multiple packages to add can be specified on the command line.\n"
|
|||||||
printf -- "\n"
|
printf -- "\n"
|
||||||
printf -- "Options:\n"
|
printf -- "Options:\n"
|
||||||
printf -- " -n, --new only add packages that are not already in the database\n"
|
printf -- " -n, --new only add packages that are not already in the database\n"
|
||||||
|
printf -- "$(gettext " -p, --prevent-downgrade do not add package to database if a newer version is already present\n")"
|
||||||
elif [[ $cmd == "links-remove" ]] ; then
|
elif [[ $cmd == "links-remove" ]] ; then
|
||||||
printf -- "Usage: links-remove [options] <path-to-db> <packagename> ...\n"
|
printf -- "Usage: links-remove [options] <path-to-db> <packagename> ...\n"
|
||||||
printf -- "\n"
|
printf -- "\n"
|
||||||
@@ -199,6 +201,18 @@ db_write_entry() {
|
|||||||
if (( ONLYADDNEW )); then
|
if (( ONLYADDNEW )); then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
pkgentry=$(find_pkgentry "$pkgname")
|
||||||
|
if [[ -n $pkgentry ]]; then
|
||||||
|
|
||||||
|
local version=$(sed -n '/^%VERSION%$/ {n;p;q}' "$pkgentry/desc")
|
||||||
|
if (( $(vercmp "$version" "$pkgver") > 0 )); then
|
||||||
|
warning "$(gettext "A newer version for '%s' is already present in database")" "$pkgname"
|
||||||
|
if (( PREVENT_DOWNGRADE )); then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# remove an existing entry if it exists, ignore failures
|
# remove an existing entry if it exists, ignore failures
|
||||||
@@ -459,6 +473,7 @@ while (( $# )); do
|
|||||||
-s|--sign) SIGN=1 ;;
|
-s|--sign) SIGN=1 ;;
|
||||||
-k|--key) KEY=1 ; shift; GPGKEY=$1 ;;
|
-k|--key) KEY=1 ; shift; GPGKEY=$1 ;;
|
||||||
-v|--verify) VERIFY=1 ;;
|
-v|--verify) VERIFY=1 ;;
|
||||||
|
-p|--prevent-downgrade) PREVENT_DOWNGRADE=1 ;;
|
||||||
*) args+=("$1") ;;
|
*) args+=("$1") ;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
|
@@ -29,7 +29,9 @@ keepbuilddir=0
|
|||||||
update_first=0
|
update_first=0
|
||||||
clean_first=0
|
clean_first=0
|
||||||
run_namcap=0
|
run_namcap=0
|
||||||
|
run_checkpkg=0
|
||||||
temp_chroot=0
|
temp_chroot=0
|
||||||
|
run_nocheck=0
|
||||||
|
|
||||||
bindmounts_ro=()
|
bindmounts_ro=()
|
||||||
bindmounts_rw=()
|
bindmounts_rw=()
|
||||||
@@ -73,6 +75,8 @@ usage() {
|
|||||||
echo ' Useful for maintaining multiple copies'
|
echo ' Useful for maintaining multiple copies'
|
||||||
echo " Default: $copy"
|
echo " Default: $copy"
|
||||||
echo '-n Run namcap on the package'
|
echo '-n Run namcap on the package'
|
||||||
|
echo '-C Run checkpkg on the package'
|
||||||
|
echo '-N Disable check() function'
|
||||||
echo '-T Build in a temporary directory'
|
echo '-T Build in a temporary directory'
|
||||||
echo '-U Run makepkg as a specified user'
|
echo '-U Run makepkg as a specified user'
|
||||||
exit 1
|
exit 1
|
||||||
@@ -80,37 +84,31 @@ usage() {
|
|||||||
|
|
||||||
# {{{ functions
|
# {{{ functions
|
||||||
|
|
||||||
# Usage: sync_chroot $rootdir $copydir [$copy]
|
# Usage: sync_chroot $chrootdir $copydir [$copy]
|
||||||
sync_chroot() {
|
sync_chroot() {
|
||||||
local rootdir=$1
|
local chrootdir=$1
|
||||||
local copydir=$2
|
local copydir=$2
|
||||||
local copy=${3:-$2}
|
local copy=${3:-$2}
|
||||||
|
|
||||||
if [[ "$rootdir" -ef "$copydir" ]]; then
|
if [[ "$chrootdir/root" -ef "$copydir" ]]; then
|
||||||
error 'Cannot sync copy with itself: %s' "$copydir"
|
error 'Cannot sync copy with itself: %s' "$copydir"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get a read lock on the root chroot to make
|
# Get a read lock on the root chroot to make
|
||||||
# sure we don't clone a half-updated chroot
|
# sure we don't clone a half-updated chroot
|
||||||
slock 8 "$rootdir.lock" \
|
slock 8 "$chrootdir/root.lock" \
|
||||||
"Locking clean chroot [%s]" "$rootdir"
|
"Locking clean chroot [%s]" "$chrootdir/root"
|
||||||
|
|
||||||
stat_busy "Synchronizing chroot copy [%s] -> [%s]" "$rootdir" "$copy"
|
stat_busy "Synchronizing chroot copy [%s] -> [%s]" "$chrootdir/root" "$copy"
|
||||||
if is_subvolume "$rootdir" && is_same_fs "$rootdir" "$(dirname -- "$copydir")" && ! mountpoint -q "$copydir"; then
|
if is_btrfs "$chrootdir" && ! mountpoint -q "$copydir"; then
|
||||||
if is_subvolume "$copydir"; then
|
subvolume_delete_recursive "$copydir" ||
|
||||||
subvolume_delete_recursive "$copydir" ||
|
die "Unable to delete subvolume %s" "$copydir"
|
||||||
die "Unable to delete subvolume %s" "$copydir"
|
btrfs subvolume snapshot "$chrootdir/root" "$copydir" >/dev/null ||
|
||||||
else
|
|
||||||
# avoid change of filesystem in case of an umount failure
|
|
||||||
rm --recursive --force --one-file-system "$copydir" ||
|
|
||||||
die "Unable to delete %s" "$copydir"
|
|
||||||
fi
|
|
||||||
btrfs subvolume snapshot "$rootdir" "$copydir" >/dev/null ||
|
|
||||||
die "Unable to create subvolume %s" "$copydir"
|
die "Unable to create subvolume %s" "$copydir"
|
||||||
else
|
else
|
||||||
mkdir -p "$copydir"
|
mkdir -p "$copydir"
|
||||||
rsync -a --delete -q -W -x "$rootdir/" "$copydir"
|
rsync -a --delete -q -W -x "$chrootdir/root/" "$copydir"
|
||||||
fi
|
fi
|
||||||
stat_done
|
stat_done
|
||||||
|
|
||||||
@@ -249,9 +247,6 @@ download_sources() {
|
|||||||
env SRCDEST="$SRCDEST" BUILDDIR="$WORKDIR" \
|
env SRCDEST="$SRCDEST" BUILDDIR="$WORKDIR" \
|
||||||
makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o "${verifysource_args[@]}" ||
|
makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o "${verifysource_args[@]}" ||
|
||||||
die "Could not download sources."
|
die "Could not download sources."
|
||||||
|
|
||||||
# Clean up garbage from verifysource
|
|
||||||
# rm -rf "$builddir"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
move_products() {
|
move_products() {
|
||||||
@@ -287,7 +282,7 @@ move_products() {
|
|||||||
|
|
||||||
orig_argv=("$0" "$@")
|
orig_argv=("$0" "$@")
|
||||||
|
|
||||||
opts='hcur:I:l:nTD:d:U:'
|
opts='hcur:I:l:nNCTD:d:U:'
|
||||||
|
|
||||||
while getopts "${opts}" arg; do
|
while getopts "${opts}" arg; do
|
||||||
case "$arg" in
|
case "$arg" in
|
||||||
@@ -299,6 +294,8 @@ while getopts "${opts}" arg; do
|
|||||||
I) install_pkgs+=("$OPTARG") ;;
|
I) install_pkgs+=("$OPTARG") ;;
|
||||||
l) copy="$OPTARG" ;;
|
l) copy="$OPTARG" ;;
|
||||||
n) run_namcap=1; makepkg_args+=(--install) ;;
|
n) run_namcap=1; makepkg_args+=(--install) ;;
|
||||||
|
N) run_nocheck=1; makepkg_args+=(--nocheck) ;;
|
||||||
|
C) run_checkpkg=1 ;;
|
||||||
T) temp_chroot=1; copy+="-$$" ;;
|
T) temp_chroot=1; copy+="-$$" ;;
|
||||||
U) makepkg_user="$OPTARG" ;;
|
U) makepkg_user="$OPTARG" ;;
|
||||||
h|*) usage ;;
|
h|*) usage ;;
|
||||||
@@ -352,7 +349,7 @@ load_vars /etc/makepkg.conf
|
|||||||
lock 9 "$copydir.lock" "Locking chroot copy [%s]" "$copy"
|
lock 9 "$copydir.lock" "Locking chroot copy [%s]" "$copy"
|
||||||
|
|
||||||
if [[ ! -d $copydir ]] || (( clean_first )); then
|
if [[ ! -d $copydir ]] || (( clean_first )); then
|
||||||
sync_chroot "$chrootdir/root" "$copydir" "$copy"
|
sync_chroot "$chrootdir" "$copydir" "$copy"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
bindmounts_rw+=("${PWD}:/startdir" "${SRCDEST}:/srcdest")
|
bindmounts_rw+=("${PWD}:/startdir" "${SRCDEST}:/srcdest")
|
||||||
@@ -385,6 +382,11 @@ if chroot-run \
|
|||||||
"$copydir" \
|
"$copydir" \
|
||||||
/chrootbuild "${makepkg_args[@]}"
|
/chrootbuild "${makepkg_args[@]}"
|
||||||
then
|
then
|
||||||
|
pkgnames=()
|
||||||
|
for pkgfile in "$copydir"/pkgdest/*; do
|
||||||
|
pkgfile=${pkgfile##*/};
|
||||||
|
pkgnames+=("${pkgfile%-*-*-*}");
|
||||||
|
done
|
||||||
move_products
|
move_products
|
||||||
else
|
else
|
||||||
(( ret += 1 ))
|
(( ret += 1 ))
|
||||||
@@ -399,6 +401,15 @@ if (( ret != 0 )); then
|
|||||||
die "Build failed, check %s/build" "$copydir"
|
die "Build failed, check %s/build" "$copydir"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
if (( run_checkpkg )); then
|
||||||
|
msg "Running checkpkg"
|
||||||
|
msg2 "Downloading current versions"
|
||||||
|
if pacman --noconfirm -Swdd --logfile /dev/null "${pkgnames[@]}"; then
|
||||||
|
msg2 "Checking packages"
|
||||||
|
sudo -u "$makepkg_user" checkpkg --rmdir --warn
|
||||||
|
else
|
||||||
|
warning "Skipped checkpkg due to missing packages"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
true
|
true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@@ -12,29 +12,36 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
add_svc_rc(){
|
add_svc_openrc(){
|
||||||
local mnt="$1" name="$2" rlvl="$3"
|
local mnt="$1" names="$2" rlvl="${3:-default}"
|
||||||
if [[ -f $mnt/etc/init.d/$name ]];then
|
for svc in $names; do
|
||||||
msg2 "Setting %s ..." "$name"
|
if [[ -f $mnt/etc/init.d/$svc ]];then
|
||||||
chroot $mnt rc-update add $name $rlvl &>/dev/null
|
msg2 "Setting %s ..." "$svc"
|
||||||
fi
|
[[ $svc == "xdm" ]] && set_xdm "$mnt"
|
||||||
|
chroot $mnt rc-update add $svc $rlvl &>/dev/null
|
||||||
|
fi
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
add_svc_runit(){
|
add_svc_runit(){
|
||||||
local mnt="$1" name="$2"
|
local mnt="$1" names="$2" rlvl="${3:-default}"
|
||||||
if [[ -d $mnt/etc/runit/sv/$name ]]; then
|
for svc in $names; do
|
||||||
msg2 "Setting %s ..." "$name"
|
if [[ -d $mnt/etc/runit/sv/$svc ]]; then
|
||||||
chroot $mnt ln -s /etc/runit/sv/$name /etc/runit/runsvdir/default &>/dev/null
|
msg2 "Setting %s ..." "$svc"
|
||||||
fi
|
chroot $mnt ln -s /etc/runit/sv/$svc /etc/runit/runsvdir/$rlvl &>/dev/null
|
||||||
|
fi
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
add_svc_s6(){
|
add_svc_s6(){
|
||||||
local mnt="$1" name="$2"
|
local mnt="$1" names="$2" valid="" rlvl="${3:-default}"
|
||||||
if [[ -d $mnt/etc/s6/sv/$name ]]; then
|
for svc in $names; do
|
||||||
msg2 "Setting %s ..." "$name"
|
if [[ -d $mnt/etc/s6/sv/$svc ]]; then
|
||||||
# chroot $mnt s6-rc-bundle $name default &>/dev/null
|
msg2 "Setting %s ..." "$svc"
|
||||||
# chroot $mnt s6-rc -u change default &>/dev/null
|
valid=${valid:-}${valid:+' '}${svc}
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
|
chroot $mnt s6-rc-bundle -c /etc/s6/rc/compiled add $rlvl $valid
|
||||||
}
|
}
|
||||||
|
|
||||||
set_xdm(){
|
set_xdm(){
|
||||||
@@ -60,44 +67,14 @@ configure_logind(){
|
|||||||
|
|
||||||
configure_services(){
|
configure_services(){
|
||||||
local mnt="$1"
|
local mnt="$1"
|
||||||
info "Configuring [%s]" "${INITSYS}"
|
info "Configuring [%s] services" "${INITSYS}"
|
||||||
case ${INITSYS} in
|
add_svc_${INITSYS} "$mnt" "${SERVICES[*]} ${SERVICES_LIVE[*]}"
|
||||||
'openrc')
|
info "Done configuring [%s] services" "${INITSYS}"
|
||||||
for svc in ${SERVICES[@]}; do
|
|
||||||
[[ $svc == "xdm" ]] && set_xdm "$mnt"
|
|
||||||
add_svc_rc "$mnt" "$svc" "default"
|
|
||||||
done
|
|
||||||
for svc in ${SERVICES_LIVE[@]}; do
|
|
||||||
add_svc_rc "$mnt" "$svc" "default"
|
|
||||||
done
|
|
||||||
;;
|
|
||||||
'runit')
|
|
||||||
for svc in ${SERVICES[@]}; do
|
|
||||||
add_svc_runit "$mnt" "$svc"
|
|
||||||
done
|
|
||||||
for svc in ${SERVICES_LIVE[@]}; do
|
|
||||||
add_svc_runit "$mnt" "$svc"
|
|
||||||
done
|
|
||||||
;;
|
|
||||||
's6')
|
|
||||||
for svc in ${SERVICES[@]}; do
|
|
||||||
add_svc_s6 "$mnt" "$svc"
|
|
||||||
done
|
|
||||||
for svc in ${SERVICES_LIVE[@]}; do
|
|
||||||
add_svc_s6 "$mnt" "$svc"
|
|
||||||
done
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
info "Done configuring [%s]" "${INITSYS}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
configure_system(){
|
configure_system(){
|
||||||
local mnt="$1"
|
local mnt="$1"
|
||||||
case ${INITSYS} in
|
configure_logind "$mnt" "elogind"
|
||||||
'openrc' | 'runit'|'s6')
|
|
||||||
configure_logind "$mnt" "elogind"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
echo ${HOST_NAME} > $mnt/etc/hostname
|
echo ${HOST_NAME} > $mnt/etc/hostname
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,52 +102,33 @@ write_users_conf(){
|
|||||||
printf '%s' "${yaml}"
|
printf '%s' "${yaml}"
|
||||||
}
|
}
|
||||||
|
|
||||||
write_servicescfg_conf(){
|
write_services_conf(){
|
||||||
|
local key1="$1" val1="$2" key2="$3" val2="$4"
|
||||||
local yaml=$(write_yaml_header)
|
local yaml=$(write_yaml_header)
|
||||||
yaml+=$(write_empty_line)
|
yaml+=$(write_empty_line)
|
||||||
case "${INITSYS}" in
|
yaml+=$(write_yaml_map 0 "$key1" "$val1")
|
||||||
'runit')
|
yaml+=$(write_yaml_map 0 "$key2" "$val2")
|
||||||
yaml+=$(write_yaml_map 0 'svDir' '/etc/runit/sv')
|
yaml+=$(write_yaml_map 0 'services')
|
||||||
yaml+=$(write_yaml_map 0 'runsvDir' '/etc/runit/runsvdir')
|
for svc in ${SERVICES[@]};do
|
||||||
yaml+=$(write_yaml_map 0 'services')
|
yaml+=$(write_yaml_seq 2 "$svc")
|
||||||
yaml+=$(write_yaml_map 2 'enabled')
|
done
|
||||||
for svc in ${SERVICES[@]};do
|
|
||||||
yaml+=$(write_yaml_seq_map 4 'name' "$svc")
|
|
||||||
yaml+=$(write_yaml_map 6 'runlevel' 'default')
|
|
||||||
done
|
|
||||||
;;
|
|
||||||
'openrc')
|
|
||||||
yaml+=$(write_yaml_map 0 'initdDir' '/etc/init.d')
|
|
||||||
yaml+=$(write_yaml_map 0 'runlevelsDir' '/etc/runlevels')
|
|
||||||
yaml+=$(write_yaml_map 0 'services')
|
|
||||||
for svc in ${SERVICES[@]};do
|
|
||||||
yaml+=$(write_yaml_seq_map 2 'name' "$svc")
|
|
||||||
yaml+=$(write_yaml_map 4 'runlevel' 'default')
|
|
||||||
done
|
|
||||||
;;
|
|
||||||
's6')
|
|
||||||
yaml+=$(write_yaml_map 0 'svDir' '/etc/s6/sv')
|
|
||||||
yaml+=$(write_yaml_map 0 'rcDir' '/etc/s6-rc')
|
|
||||||
yaml+=$(write_yaml_map 0 'services')
|
|
||||||
for svc in ${SERVICES[@]};do
|
|
||||||
yaml+=$(write_yaml_seq_map 2 'name' "$svc")
|
|
||||||
yaml+=$(write_yaml_map 4 'bundle' 'default')
|
|
||||||
done
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
yaml+=$(write_empty_line)
|
yaml+=$(write_empty_line)
|
||||||
printf '%s' "${yaml}"
|
printf '%s' "${yaml}"
|
||||||
}
|
}
|
||||||
|
|
||||||
write_unpackfs_conf(){
|
write_services_openrc_conf(){
|
||||||
local yaml=$(write_yaml_header)
|
local mods="$1"
|
||||||
yaml+=$(write_empty_line)
|
write_services_conf 'initdDir' '/etc/init.d' 'runlevelsDir' '/etc/runlevels' > "$mods"/services-openrc.conf
|
||||||
yaml+=$(write_yaml_map 0 'unpack')
|
}
|
||||||
yaml+=$(write_yaml_seq_map 2 'source' "/run/artix/bootmnt/artix/x86_64/rootfs.sfs")
|
|
||||||
yaml+=$(write_yaml_map 4 'sourcefs' 'squashfs')
|
write_services_runit_conf(){
|
||||||
yaml+=$(write_yaml_map 4 'destination' '""')
|
local mods="$1"
|
||||||
yaml+=$(write_empty_line)
|
write_services_conf 'svDir' '/etc/runit/sv' 'runsvDir' '/etc/runit/runsvdir' > "$mods"/services-runit.conf
|
||||||
printf '%s' "${yaml}"
|
}
|
||||||
|
|
||||||
|
write_services_s6_conf(){
|
||||||
|
local mods="$1"
|
||||||
|
write_services_conf 'svDir' '/etc/s6/sv' 'dbDir' '/etc/s6/rc/compiled' > "$mods"/services-s6.conf
|
||||||
}
|
}
|
||||||
|
|
||||||
configure_calamares(){
|
configure_calamares(){
|
||||||
@@ -178,9 +136,7 @@ configure_calamares(){
|
|||||||
if [[ -d "$mods" ]];then
|
if [[ -d "$mods" ]];then
|
||||||
msg2 "Configuring Calamares"
|
msg2 "Configuring Calamares"
|
||||||
write_users_conf > "$mods"/users.conf
|
write_users_conf > "$mods"/users.conf
|
||||||
write_servicescfg_conf > "$mods"/services-"${INITSYS}".conf
|
write_services_"${INITSYS}"_conf "$mods"
|
||||||
write_unpackfs_conf > "$mods"/unpackfs.conf
|
|
||||||
sed -e "s|openrc|${INITSYS}|" -i "$mods"/postcfg.conf
|
|
||||||
sed -e "s|services-openrc|services-${INITSYS}|" -i "$1"/etc/calamares/settings.conf
|
sed -e "s|services-openrc|services-${INITSYS}|" -i "$1"/etc/calamares/settings.conf
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -193,6 +149,7 @@ configure_image(){
|
|||||||
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"
|
||||||
|
msg2 "Writing live.conf"
|
||||||
write_live_session_conf > "$fs/etc/artools/live.conf"
|
write_live_session_conf > "$fs/etc/artools/live.conf"
|
||||||
msg "Done configuring [%s]" "${fs##*/}"
|
msg "Done configuring [%s]" "${fs##*/}"
|
||||||
}
|
}
|
||||||
|
@@ -69,7 +69,6 @@ load_profile(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
write_live_session_conf(){
|
write_live_session_conf(){
|
||||||
msg2 "Writing live.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}")
|
||||||
|
Reference in New Issue
Block a user