Compare commits

...

21 Commits

Author SHA1 Message Date
b6ef4d1895 buildtree: add -y arg to exclude staging from compare ops 2018-07-02 01:56:55 +02:00
3fd33eca4a mkchrootpkg: rm workarounds in chroot 2018-06-30 00:37:51 +02:00
eceed82a61 Remove cow file early for non-persistent systems 2018-06-29 21:42:12 +02:00
7337c341ba buildtree: configure git repo with makepkg's GPGKEY 2018-06-29 20:08:02 +02:00
51658f4838 buildtree: make signing commits mandatory 2018-06-29 16:50:19 +02:00
9dcef56350 chroot-run: bind mount /etc/hosts again 2018-06-27 22:51:59 +02:00
ba2647b4b0 rm pcmcia from initcpio 2018-06-27 22:51:15 +02:00
e10571eac0 util-iso-grub: create unicode fontinstead of copying 2018-06-21 23:52:31 +02:00
045ed9e895 Merge branch 'master' of github.com:artix-linux/artools into devel 2018-06-19 21:34:46 +02:00
60e77a878c readd locale backup 2018-06-19 21:34:23 +02:00
69d3897abb makefile: bump chroot version 2018-06-19 20:35:37 +02:00
90060a3851 mkchroot: fix dbus-uuidgen call 2018-06-19 20:12:32 +02:00
1bc756ec15 rm old code 2018-06-19 14:47:58 +02:00
26daf3aaa0 basestrap: improve resolv.conf mounting 2018-06-19 13:10:01 +02:00
c772bf8ea1 simplify chroot traps & mounting 2018-06-19 10:15:29 +02:00
caccd55fc1 util-chroot: fix locale 2018-06-19 09:47:44 +02:00
a2b31b72a0 fstabgen: add support for prefix matching 2018-06-18 21:54:41 +02:00
1beb5131ce disable crypto_speck module on linux import 2018-06-13 14:47:28 +02:00
udeved
ef794a0b85 mkchrootpkg: whitelist return code 14 from makepkg 2018-05-31 18:07:31 +02:00
udeved
aa12fc42bd buildtree: quote version vars 2018-05-29 17:29:07 +02:00
udeved
50f90ab53c mkchrootpkg: arch patches 2018-05-29 13:30:32 +02:00
15 changed files with 186 additions and 175 deletions

View File

@@ -1,6 +1,6 @@
VERSION=0.8
CHROOT_VERSION=0.7
CHROOT_VERSION=0.8
TOOLS = artools
ifdef PREFIX

View File

@@ -86,8 +86,8 @@ else
${pretend} && display_settings && exit 1
chroot_api_efi_mount "${chrootdir}" || die "failed to setup API filesystems in chroot %s" "${chrootdir}"
chroot_mount /etc/resolv.conf "${chrootdir}/etc/resolv.conf" --bind
chroot_api_mount "${chrootdir}" || die "failed to setup API filesystems in chroot %s" "${chrootdir}"
chroot_add_resolv_conf "${chrootdir}"
fi
SHELL=/bin/sh unshare --fork --pid chroot "${chrootdir}" ${run_args[*]}

View File

@@ -20,6 +20,26 @@ import ${LIBDIR}/util.sh
import ${LIBDIR}/util-mount.sh
import ${LIBDIR}/util-chroot.sh
copy_mirrorlist(){
cp -a /etc/pacman.d/mirrorlist "$1/etc/pacman.d/"
}
copy_keyring(){
if [[ -d /etc/pacman.d/gnupg ]] && [[ ! -d $1/etc/pacman.d/gnupg ]]; then
cp -a /etc/pacman.d/gnupg "$1/etc/pacman.d/"
fi
}
create_min_fs(){
msg "Creating install root at %s" "$1"
mkdir -m 0755 -p $1/var/{cache/pacman/pkg,lib/pacman,log} $1/{dev,etc}
mkdir -m 1777 -p $1/{tmp,run}
mkdir -m 0555 -p $1/{sys,proc}
# if [[ ! -f $1/etc/machine-id ]];then
# touch $1/etc/machine-id
# fi
}
newroot=/mnt
hostcache=false

View File

@@ -40,6 +40,12 @@ pull_tree_artix(){
if [[ -d ${tree} ]];then
cd ${tree}
git config --bool pull.rebase true
git config commit.gpgsign true
if [[ -n "${GPGKEY}" ]];then
git config user.signingkey "${GPGKEY}"
else
warning "No GPGKEY configured in makepkg.conf!"
fi
msg "Checking (%s)" "${tree}"
pull_tree
cd ..
@@ -55,30 +61,30 @@ show_version_table(){
for tree in packages packages-galaxy;do
local git=$(find ${tree_dir_artix}/$tree/ -mindepth 1 -maxdepth 1 -type d)
for pkg_path in ${git[@]}; do
local artixrepo=$(find_repo "$pkg_path" "${unstable}")
local artixrepo=$(find_repo "$pkg_path" "${unstable}" "${staging}")
if [[ -d $pkg_path/repos/$artixrepo ]];then
source $pkg_path/repos/$artixrepo/PKGBUILD 2>/dev/null
local pkg=${pkg_path##*/}
local artixver=$(get_full_version $pkg)
local src=$(get_import_path "$tree" "$pkg")
local archrepo=$(find_repo "$src/$pkg" "${unstable}")
local archrepo=$(find_repo "$src/$pkg" "${unstable}" "${staging}")
if [[ -d $src/$pkg/repos/$archrepo ]];then
source $src/$pkg/repos/$archrepo/PKGBUILD 2>/dev/null
local archver=$(get_full_version $pkg)
fi
if ${artix};then
if [ $(vercmp $artixver $archver) -eq 0 ] || [ $(vercmp $artixver $archver) -gt 0 ];then
if [ $(vercmp "$artixver" "$archver") -eq 0 ] || [ $(vercmp "$artixver" "$archver") -gt 0 ];then
local ar=$(arch_to_artix_repo "$artixrepo")
case $ar in
*goblins)
if [[ $archrepo == $artixrepo ]];then
if [[ "$archrepo" == "$artixrepo" ]];then
msg_row "%-20s %-20s %-25s %-30s %-30s" "${archrepo%-*}" "${ar}" "$pkg" "$archver" "$artixver"
else
msg_row_notify "%-20s %-20s %-25s %-30s %-30s" "${archrepo%-*}" "${ar}" "$pkg" "$archver" "$artixver"
fi
;;
*gremlins)
if [[ $archrepo == $artixrepo ]];then
if [[ "$archrepo" == "$artixrepo" ]];then
msg_row "%-20s %-20s %-25s %-30s %-30s" "${archrepo%-*}" "${ar}" "$pkg" "$archver" "$artixver"
else
msg_row_notify "%-20s %-20s %-25s %-30s %-30s" "${archrepo%-*}" "${ar}" "$pkg" "$archver" "$artixver"
@@ -87,11 +93,11 @@ show_version_table(){
esac
fi
else
if [ $(vercmp $artixver $archver) -lt 0 ];then
if [ $(vercmp "$artixver" "$archver") -lt 0 ];then
local ar=$(arch_to_artix_repo "$artixrepo")
${upgrades} && msg_row_upgrade "%-20s %-20s %-25s %-30s %-30s" "${archrepo%-*}" "${ar}" "$pkg" "$archver" "$artixver"
fi
if [ $(vercmp $artixver $archver) -gt 0 ];then
if [ $(vercmp "$artixver" "$archver") -gt 0 ];then
local ar=$(arch_to_artix_repo "$artixrepo")
if [[ -n $archver ]] && [[ -n $archrepo ]];then
${downgrades} && msg_row_downgrade "%-20s %-20s %-25s %-30s %-30s" "${archrepo%-*}" "${ar}" "$pkg" "$archver" "$artixver"
@@ -195,6 +201,8 @@ display_settings(){
msg2 "upgrades: %s" "${upgrades}"
msg2 "downgrades: %s" "${downgrades}"
msg2 "artix: %s" "${artix}"
msg2 "staging: %s" "${staging}"
msg2 "unstable: %s" "${unstable}"
msg2 "import: %s" "${import}"
msg2 "view: %s" "${view}"
msg2 "trunk: %s" "${trunk}"
@@ -215,6 +223,7 @@ sync=false
sync_arch=true
compare=false
unstable=false
staging=true
upgrades=false
downgrades=false
artix=false
@@ -231,10 +240,11 @@ usage() {
echo " -s Clone or pull repos"
echo " -z Don't clone or pull arch repos"
echo ' -c Compare packages'
echo ' -x Include unstable kde and gnome'
echo ' -u Show upgrade packages'
echo ' -d Show downgrade packages'
echo ' -a Show testing and staging packages'
echo ' -a Show testing packages'
echo " -y Don't inlcude staging packages"
echo ' -x Include unstable kde and gnome'
echo ' -i Import a package from arch repos'
echo ' -t Import from arch trunk'
echo ' -v View package depends'
@@ -247,7 +257,7 @@ usage() {
orig_argv=("$0" "$@")
opts='p:csudaiztxvqh'
opts='p:csudayiztxvqh'
while getopts "${opts}" arg; do
case "${arg}" in
@@ -258,6 +268,7 @@ while getopts "${opts}" arg; do
u) upgrades=true ;;
d) downgrades=true ;;
a) artix=true ;;
y) staging=false ;;
i) import=true ;;
t) trunk=true ;;
v) view=true ;;

View File

@@ -93,9 +93,9 @@ copy_hostconf () {
}
chroot_extra_mount() {
chroot_mount "/etc/resolv.conf" "$1/etc/resolv.conf" -B
chroot_add_resolv_conf "$1"
chroot_mount "/etc/hosts" "$1/etc/hosts" -B
chroot_mount_conditional "[[ -e $1/etc/machine-id ]]" "/etc/machine-id" "$1/etc/machine-id" -B
# chroot_mount_conditional "[[ -e $1/etc/machine-id ]]" "/etc/machine-id" "$1/etc/machine-id" -B
chroot_mount "${cache_dirs[0]}" "$1${cache_dirs[0]}" -B
for cache_dir in ${cache_dirs[@]:1}; do

View File

@@ -93,6 +93,7 @@ usage() {
usage: ${0##*/} [options] root
Options:
-f FILTER Restrict output to mountpoints matching the prefix FILTER
-L Use labels for source identifiers (shortcut for -t LABEL)
-p Exclude pseudofs mounts (default behavior)
-P Include printing mounts
@@ -112,10 +113,11 @@ if [[ -z $1 || $1 = @(-h|--help) ]]; then
exit $(( $# ? 0 : 1 ))
fi
while getopts ':LPpt:U' flag; do
while getopts ':f:LPpt:U' flag; do
case $flag in
L) bytag=LABEL ;;
U) bytag=UUID ;;
f) prefixfilter=$OPTARG ;;
P) pseudofs=1 ;;
p) pseudofs=0 ;;
t) bytag=${OPTARG^^} ;;
@@ -139,6 +141,8 @@ while read -r src target fstype opts fsroot; do
continue
fi
[[ $target = "$prefixfilter"* ]] || continue
# default 5th and 6th columns
dump=0 pass=2

View File

@@ -22,9 +22,6 @@ import ${LIBDIR}/util-chroot.sh
working_dir=''
files=()
build_locales=false
keep_mirrors=false
keep_flag=''
nosetarch=false
usage() {
@@ -73,9 +70,6 @@ else
cache_dirs=(${cache_dir})
fi
basestrap_args=(-Gc ${pacman_conf:+-C "$pacman_conf"})
[[ -n ${mirror} ]] && basestrap_args+=(-M)
umask 0022
#[[ -e $working_dir ]] && die "Working directory '%s' already exists" "$working_dir"
@@ -104,17 +98,21 @@ while read -r varname; do
_env+=("$varname=${!varname}")
done < <(declare -x | sed -r 's/^declare -x ([^=]*)=.*/\1/' | grep -i '_proxy$')
env -i "${_env[@]}" \
basestrap "${basestrap_args[@]}" "$working_dir" ${cache_dirs[@]/#/--cachedir=} "$@" || die 'Failed to install all packages'
basestrap -Gc ${pacman_conf:+-C "$pacman_conf"} "$working_dir" ${cache_dirs[@]/#/--cachedir=} "$@" || die 'Failed to install all packages'
echo "$chroot_version" > "$working_dir/.artools"
default_locale "set" "$working_dir"
if [[ ! -f "$working_dir/etc/locale.gen.orig" ]];then
mv "$working_dir/etc/locale.gen" "$working_dir/etc/locale.gen.orig"
fi
printf '%s.UTF-8 UTF-8\n' en_US de_DE > "$working_dir/etc/locale.gen"
echo 'LANG=en_US.UTF-8' > "$working_dir/etc/locale.conf"
dbus-uuidgen --ensure="$working_dir"/etc/machine-id
chroot_args=(${pacman_conf:+-C "$pacman_conf"} ${makepkg_conf:+-M "$makepkg_conf"} ${cache_dir:+-c "$cache_dir"})
${nosetarch} && chroot_args+=(${nosetarch:+-s})
[[ -n ${mirror} ]] && default_mirror "$working_dir" "$mirror"
exec chroot-run \
"${chroot_args[@]}" \
"$working_dir" locale-gen

View File

@@ -163,10 +163,10 @@ prepare_chroot() {
$install -d "$copydir"/{build,build/.gnupg,startdir,{pkg,srcpkg,src,log}dest}
for x in .gnupg/pubring.{kbx,gpg}; do
[[ -r $USER_HOME/$x ]] || continue
$install -m 644 "$USER_HOME/$x" "$copydir/build/$x"
done
# for x in .gnupg/pubring.{kbx,gpg}; do
# [[ -r $USER_HOME/$x ]] || continue
# $install -m 644 "$USER_HOME/$x" "$copydir/build/$x"
# done
sed -e '/^MAKEFLAGS=/d' -e '/^PACKAGER=/d' -i "$copydir/etc/makepkg.conf"
for x in BUILDDIR=/build PKGDEST=/pkgdest SRCPKGDEST=/srcpkgdest SRCDEST=/srcdest LOGDEST=/logdest \
@@ -204,17 +204,23 @@ _chrootbuild() {
ulimit -c 0
# Work around chroot-run not giving a ctty
exec </dev/console
#exec </dev/console
. /etc/profile
export LANG=en_US.UTF-8
#export LANG=en_US.UTF-8
# workaround meson locale errors
# supposedly fixed with coming python-3.7
locale-gen &> /dev/null
#locale-gen &> /dev/null
sudo --preserve-env=SOURCE_DATE_EPOCH -iu builduser bash -c 'cd /startdir; makepkg "$@"' -bash "$@"
ret=$?
case $ret in
0|14) return 0;;
*) return $ret;;
esac
}
_chrootnamcap() {
@@ -236,7 +242,7 @@ download_sources() {
local builddir
builddir="$(mktemp -d)"
# chmod 1777 "$builddir"
chown "$makepkg_user:$makepkg_user" "$builddir"
chown "$makepkg_user:" "$builddir"
# Ensure sources are downloaded
sudo -u "$makepkg_user" --preserve-env=GNUPGHOME \

View File

@@ -1,5 +1,5 @@
MODULES=(loop dm-snapshot)
HOOKS=(base udev artix_shutdown artix artix_loop_mnt artix_pxe_common artix_pxe_http artix_pxe_nbd artix_pxe_nfs artix_kms modconf block pcmcia filesystems keyboard keymap)
HOOKS=(base udev artix_shutdown artix artix_loop_mnt artix_pxe_common artix_pxe_http artix_pxe_nbd artix_pxe_nfs artix_kms modconf block filesystems keyboard keymap)
COMPRESSION="xz"

View File

@@ -32,6 +32,10 @@ _mnt_dmsnapshot() {
dmsetup create ${dm_snap_name} --table "0 ${ro_dev_size} snapshot ${ro_dev} ${rw_dev} ${cow_persistent} ${cow_chunksize}"
if [[ "${cow_persistent}" != "P" ]]; then
rm -f "/run/artix/cowspace/${cow_directory}/${img_name}.cow"
fi
_mnt_dev "/dev/mapper/${dm_snap_name}" "${mnt}" "-w" "defaults"
echo $(readlink -f /dev/mapper/${dm_snap_name}) >> /run/artix/used_block_devices
}

View File

@@ -8,26 +8,6 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
copy_mirrorlist(){
cp -a /etc/pacman.d/mirrorlist "$1/etc/pacman.d/"
}
copy_keyring(){
if [[ -d /etc/pacman.d/gnupg ]] && [[ ! -d $1/etc/pacman.d/gnupg ]]; then
cp -a /etc/pacman.d/gnupg "$1/etc/pacman.d/"
fi
}
create_min_fs(){
msg "Creating install root at %s" "$1"
mkdir -m 0755 -p $1/var/{cache/pacman/pkg,lib/pacman,log} $1/{dev,etc}
mkdir -m 1777 -p $1/{tmp,run}
mkdir -m 0555 -p $1/{sys,proc}
if [[ ! -f $1/etc/machine-id ]];then
touch $1/etc/machine-id
fi
}
is_btrfs() {
[[ -e "$1" && "$(stat -f -c %T "$1")" == btrfs ]]
}
@@ -47,30 +27,6 @@ subvolume_delete_recursive() {
return 0
}
default_locale(){
local action="$1" mnt="$2"
if [[ $action == "set" ]];then
if [[ ! -f "$mnt/etc/locale.gen.bak" ]];then
info "Setting locale ..."
mv "$mnt/etc/locale.gen" "$mnt/etc/locale.gen.bak"
printf '%s.UTF-8 UTF-8\n' en_US de_DE > "$mnt/etc/locale.gen"
echo 'LANG=en_US.UTF-8.UTF-8' > "$mnt/etc/locale.conf"
fi
elif [[ $action == "reset" ]];then
if [[ -f "$mnt/etc/locale.gen.bak" ]];then
info "Resetting locale ..."
mv "$mnt/etc/locale.gen.bak" "$mnt/etc/locale.gen"
rm "$mnt/etc/locale.conf"
fi
fi
}
default_mirror(){
local mnt="$1" mirror="$2"'/$repo/os/$arch'
[[ -f $mnt/etc/pacman.d/mirrorlist ]] && mv "$mnt"/etc/pacman.d/mirrorlist "$mnt"/etc/pacman.d/mirrorlist.bak
echo "Server = $mirror" > $mnt/etc/pacman.d/mirrorlist
}
# $1: chroot
kill_chroot_process(){
local prefix="$1" flink pid name

View File

@@ -53,7 +53,7 @@ configure_grub(){
prepare_grub(){
local platform=i386-pc img='core.img' grub=$3/boot/grub efi=$3/efi/boot \
lib=$1/usr/lib/grub prefix=/boot/grub theme=$2/usr/share/grub data=$1/usr/share/grub
lib=$1/usr/lib/grub prefix=/boot/grub theme=$2/usr/share/grub
prepare_dir ${grub}/${platform}
@@ -81,9 +81,11 @@ prepare_grub(){
prepare_dir ${grub}/themes
cp -r ${theme}/themes/artix ${grub}/themes/
cp ${data}/unicode.pf2 ${grub}
cp -r ${theme}/{locales,tz} ${grub}
msg2 "Creating %s ..." "unicode.pf2"
grub-mkfont -o ${grub}/unicode.pf2 /usr/share/fonts/misc/unifont.bdf
local size=4M mnt="${mnt_dir}/efiboot" efi_img="$3/efi.img"
msg2 "Creating fat image of %s ..." "${size}"
truncate -s ${size} "${efi_img}"

View File

@@ -213,7 +213,10 @@ clean_up_image(){
local path mnt="$1"
msg2 "Cleaning [%s]" "${mnt##*/}"
default_locale "reset" "$mnt"
if [[ -f "$mnt/etc/locale.gen.orig" ]];then
mv "$mnt/etc/locale.gen.orig" "$mnt/etc/locale.gen"
rm "$mnt/etc/locale.conf"
fi
path=$mnt/boot
if [[ -d "$path" ]]; then
find "$path" -name 'initramfs*.img' -delete &> /dev/null

View File

@@ -45,44 +45,100 @@ chroot_part_mount() {
}
select_os(){
local os_list=( $(detect) ) count=${#os_list[@]}
local os_list=( $(detect) ) count=${#os_list[@]}
if [[ ${count} > 1 ]];then
msg "Detected systems:"
local i=0
for os in ${os_list[@]};do
msg "Detected systems:"
local i=0
for os in ${os_list[@]};do
local last=${os##*:}
case $last in
'efi') count=$((count-1)) ;;
*) info "$i) $(get_os_name $os)"; i=$((i+1)) ;;
esac
done
i=0
done
i=0
msg "Select system to mount [0-%s] : " "$((count-1))"
read select
else
read select
else
select=0
fi
local os_str=${os_list[$select]} type
type=$os_str
root=${os_str%%:*}
type=${type##*:}
if [[ "${type##*:}" == 'linux' ]];then
if [[ "${type##*:}" == 'linux' ]];then
msg "Mounting (%s) [%s]" "$(get_os_name $os_str)" "$root"
chroot_mount_partitions "$1" "$root"
else
die "You can't mount %s!" "$select"
fi
mount_os "$1" "$root"
else
die "You can't mount %s!" "$select"
fi
}
chroot_mount_partitions(){
trap_setup(){
[[ $(trap -p EXIT) ]] && die 'Error! Attempting to overwrite existing EXIT trap'
trap "$1" EXIT
}
chroot_mount() {
info "mount: [%s]" "$2"
mount "$@" && CHROOT_ACTIVE_MOUNTS=("$2" "${CHROOT_ACTIVE_MOUNTS[@]}")
}
chroot_add_resolv_conf() {
local chrootdir=$1 resolv_conf=$1/etc/resolv.conf
[[ -e /etc/resolv.conf ]] || return 0
# Handle resolv.conf as a symlink to somewhere else.
if [[ -L $chrootdir/etc/resolv.conf ]]; then
# readlink(1) should always give us *something* since we know at this point
# it's a symlink. For simplicity, ignore the case of nested symlinks.
resolv_conf=$(readlink "$chrootdir/etc/resolv.conf")
if [[ $resolv_conf = /* ]]; then
resolv_conf=$chrootdir$resolv_conf
else
resolv_conf=$chrootdir/etc/$resolv_conf
fi
# ensure file exists to bind mount over
if [[ ! -f $resolv_conf ]]; then
install -Dm644 /dev/null "$resolv_conf" || return 1
fi
elif [[ ! -e $chrootdir/etc/resolv.conf ]]; then
# The chroot might not have a resolv.conf.
return 0
fi
chroot_mount /etc/resolv.conf "$resolv_conf" --bind
}
chroot_mount_conditional() {
local cond=$1; shift
if eval "$cond"; then
chroot_mount "$@"
fi
}
chroot_setup(){
chroot_mount_conditional "! mountpoint -q '$1'" "$1" "$1" --bind &&
chroot_mount proc "$1/proc" -t proc -o nosuid,noexec,nodev &&
chroot_mount sys "$1/sys" -t sysfs -o nosuid,noexec,nodev,ro &&
ignore_error chroot_mount_conditional "[[ -d '$1/sys/firmware/efi/efivars' ]]" \
efivarfs "$1/sys/firmware/efi/efivars" -t efivarfs -o nosuid,noexec,nodev &&
chroot_mount udev "$1/dev" -t devtmpfs -o mode=0755,nosuid &&
chroot_mount devpts "$1/dev/pts" -t devpts -o mode=0620,gid=5,nosuid,noexec &&
chroot_mount shm "$1/dev/shm" -t tmpfs -o mode=1777,nosuid,nodev &&
chroot_mount run "$1/run" -t tmpfs -o nosuid,nodev,mode=0755 &&
chroot_mount tmp "$1/tmp" -t tmpfs -o mode=1777,strictatime,nodev,nosuid
}
mount_os(){
CHROOT_ACTIVE_PART_MOUNTS=()
CHROOT_ACTIVE_MOUNTS=()
[[ $(trap -p EXIT) ]] && die 'Error! Attempting to overwrite existing EXIT trap'
trap 'trap_handler' EXIT
trap_setup chroot_part_umount
chroot_part_mount $2 $1
chroot_part_mount "$2" "$1"
local mounts=$(parse_fstab "$1")
@@ -105,82 +161,26 @@ chroot_mount_partitions(){
;;
esac
chroot_mount_conditional "! mountpoint -q '$1'" "$1" "$1" --bind &&
chroot_mount proc "$1/proc" -t proc -o nosuid,noexec,nodev &&
chroot_mount sys "$1/sys" -t sysfs -o nosuid,noexec,nodev,ro &&
ignore_error chroot_mount_conditional "[[ -d '$1/sys/firmware/efi/efivars' ]]" \
efivarfs "$1/sys/firmware/efi/efivars" -t efivarfs -o nosuid,noexec,nodev &&
chroot_mount udev "$1/dev" -t devtmpfs -o mode=0755,nosuid &&
chroot_mount devpts "$1/dev/pts" -t devpts -o mode=0620,gid=5,nosuid,noexec &&
chroot_mount shm "$1/dev/shm" -t tmpfs -o mode=1777,nosuid,nodev &&
chroot_mount run "$1/run" -t tmpfs -o nosuid,nodev,mode=0755 &&
chroot_mount tmp "$1/tmp" -t tmpfs -o mode=1777,strictatime,nodev,nosuid
chroot_mount /etc/resolv.conf "$1/etc/resolv.conf" --bind
}
chroot_mount() {
#info "mount: [%s]" "$2"
mount "$@" && CHROOT_ACTIVE_MOUNTS=("$2" "${CHROOT_ACTIVE_MOUNTS[@]}")
}
chroot_mount_conditional() {
local cond=$1; shift
if eval "$cond"; then
chroot_mount "$@"
fi
}
chroot_api_efi_mount() {
CHROOT_ACTIVE_MOUNTS=()
[[ $(trap -p EXIT) ]] && die 'Error! Attempting to overwrite existing EXIT trap'
trap 'chroot_api_efi_umount' EXIT
chroot_mount_conditional "! mountpoint -q '$1'" "$1" "$1" --bind &&
chroot_mount proc "$1/proc" -t proc -o nosuid,noexec,nodev &&
chroot_mount sys "$1/sys" -t sysfs -o nosuid,noexec,nodev,ro &&
ignore_error chroot_mount_conditional "[[ -d '$1/sys/firmware/efi/efivars' ]]" \
efivarfs "$1/sys/firmware/efi/efivars" -t efivarfs -o nosuid,noexec,nodev &&
chroot_mount udev "$1/dev" -t devtmpfs -o mode=0755,nosuid &&
chroot_mount devpts "$1/dev/pts" -t devpts -o mode=0620,gid=5,nosuid,noexec &&
chroot_mount shm "$1/dev/shm" -t tmpfs -o mode=1777,nosuid,nodev &&
chroot_mount run "$1/run" -t tmpfs -o nosuid,nodev,mode=0755 &&
chroot_mount tmp "$1/tmp" -t tmpfs -o mode=1777,strictatime,nodev,nosuid
chroot_setup "$1"
chroot_add_resolv_conf "$1"
}
chroot_api_mount() {
CHROOT_ACTIVE_MOUNTS=()
[[ $(trap -p EXIT) ]] && die 'Error! Attempting to overwrite existing EXIT trap'
trap 'chroot_api_umount' EXIT
chroot_mount_conditional "! mountpoint -q '$1'" "$1" "$1" --bind &&
chroot_mount proc "$1/proc" -t proc -o nosuid,noexec,nodev &&
chroot_mount sys "$1/sys" -t sysfs -o nosuid,noexec,nodev,ro &&
chroot_mount udev "$1/dev" -t devtmpfs -o mode=0755,nosuid &&
chroot_mount devpts "$1/dev/pts" -t devpts -o mode=0620,gid=5,nosuid,noexec &&
chroot_mount shm "$1/dev/shm" -t tmpfs -o mode=1777,nosuid,nodev &&
chroot_mount run "$1/run" -t tmpfs -o nosuid,nodev,mode=0755 &&
chroot_mount tmp "$1/tmp" -t tmpfs -o mode=1777,strictatime,nodev,nosuid
trap_setup chroot_api_umount
chroot_setup "$1"
}
chroot_part_umount() {
info "umount: [%s]" "${CHROOT_ACTIVE_MOUNTS[@]}"
umount "${CHROOT_ACTIVE_MOUNTS[@]}"
info "umount: [%s]" "${CHROOT_ACTIVE_PART_MOUNTS[@]}"
umount "${CHROOT_ACTIVE_PART_MOUNTS[@]}"
unset CHROOT_ACTIVE_PART_MOUNTS
unset CHROOT_ACTIVE_PART_MOUNTS CHROOT_ACTIVE_MOUNTS
}
chroot_api_umount() {
#info "umount: [%s]" "${CHROOT_ACTIVE_MOUNTS[@]}"
info "umount: [%s]" "${CHROOT_ACTIVE_MOUNTS[@]}"
umount "${CHROOT_ACTIVE_MOUNTS[@]}"
unset CHROOT_ACTIVE_MOUNTS
}
chroot_api_efi_umount() {
#info "umount: [%s]" "${CHROOT_ACTIVE_MOUNTS[@]}"
umount "${CHROOT_ACTIVE_MOUNTS[@]}"
unset CHROOT_ACTIVE_MOUNTS
}
trap_handler(){
chroot_api_umount
chroot_part_umount
}

View File

@@ -47,6 +47,7 @@ patch_pkg(){
sed -e 's|-ARCH|-ARTIX|g' -i $pkg/trunk/PKGBUILD
sed -e 's|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION="-ARTIX"|' \
-e 's|CONFIG_DEFAULT_HOSTNAME=.*|CONFIG_DEFAULT_HOSTNAME="artixlinux"|' \
-e 's|CONFIG_CRYPTO_SPECK=.*|CONFIG_CRYPTO_SPECK=n|' \
-i $pkg/trunk/config
cd $pkg/trunk
updpkgsums
@@ -124,7 +125,7 @@ is_valid_repo(){
}
find_repo(){
local pkg="$1" incl="$2" repo=
local pkg="$1" unst="$2" stag="$3" repo=
if [[ -f $pkg/repos/core-x86_64/PKGBUILD ]];then
repo=core-x86_64
@@ -144,10 +145,12 @@ find_repo(){
repo=testing-any
fi
if [[ -f $pkg/repos/staging-x86_64/PKGBUILD ]];then
repo=staging-x86_64
elif [[ -f $pkg/repos/staging-any/PKGBUILD ]];then
repo=staging-any
if $stag;then
if [[ -f $pkg/repos/staging-x86_64/PKGBUILD ]];then
repo=staging-x86_64
elif [[ -f $pkg/repos/staging-any/PKGBUILD ]];then
repo=staging-any
fi
fi
if [[ -f $pkg/repos/community-x86_64/PKGBUILD ]];then
@@ -162,10 +165,12 @@ find_repo(){
repo=community-testing-any
fi
if [[ -f $pkg/repos/community-staging-x86_64/PKGBUILD ]];then
repo=community-staging-x86_64
elif [[ -f $pkg/repos/community-staging-any/PKGBUILD ]];then
repo=community-staging-any
if $stag;then
if [[ -f $pkg/repos/community-staging-x86_64/PKGBUILD ]];then
repo=community-staging-x86_64
elif [[ -f $pkg/repos/community-staging-any/PKGBUILD ]];then
repo=community-staging-any
fi
fi
if [[ -f $pkg/repos/multilib-x86_64/PKGBUILD ]];then
@@ -176,11 +181,13 @@ find_repo(){
repo=multilib-testing-x86_64
fi
if [[ -f $pkg/repos/multilib-staging-x86_64/PKGBUILD ]];then
repo=multilib-staging-x86_64
if $stag;then
if [[ -f $pkg/repos/multilib-staging-x86_64/PKGBUILD ]];then
repo=multilib-staging-x86_64
fi
fi
if $incl;then
if $unst;then
if [[ -f $pkg/repos/gnome-unstable-x86_64/PKGBUILD ]];then
repo=gnome-unstable-x86_64
elif [[ -f $pkg/repos/gnome-unstable-any/PKGBUILD ]];then