Compare commits

...

6 Commits
0.10.4 ... 0.11

Author SHA1 Message Date
c2fd4636a3 version 0.11 (#5) 2018-12-16 01:34:30 +01:00
a82b704c2b pkg2yaml: use file names 2018-12-14 23:11:31 +01:00
1aa6a644b0 util-pkg: readd lost func 2018-12-14 23:11:06 +01:00
ff3ea53482 Nakefile: fix pkg2yaml path 2018-12-14 18:48:26 +01:00
d0e3c4e421 add pkg2yaml; some cosmetics in buildiso & buildrtree 2018-12-14 18:45:55 +01:00
1659689e71 buildtree: mkrepo for non arch packages (#4) 2018-12-12 16:05:00 +01:00
16 changed files with 288 additions and 336 deletions

View File

@@ -1,6 +1,6 @@
VERSION=0.10 VERSION=0.11
CHROOT_VERSION=0.8 CHROOT_VERSION=0.9
TOOLS = artools TOOLS = artools
PREFIX ?= /usr/local PREFIX ?= /usr/local
@@ -40,7 +40,8 @@ BIN_PKG = \
bin/buildpkg \ bin/buildpkg \
bin/buildtree \ bin/buildtree \
bin/deploypkg \ bin/deploypkg \
bin/commitpkg bin/commitpkg \
bin/pkg2yaml
LIBS_PKG = \ LIBS_PKG = \
$(wildcard lib/util-pkg*.sh) $(wildcard lib/util-pkg*.sh)
@@ -63,11 +64,35 @@ COMMITPKG_SYMS = \
multilib-testingpkg \ multilib-testingpkg \
multilib-stagingpkg multilib-stagingpkg
BUILDPKG_SYMS = \
buildpkg-system \
buildpkg-world \
buildpkg-gremlins \
buildpkg-goblins \
buildpkg-galaxy \
buildpkg-galaxy-gremlins \
buildpkg-galaxy-goblins \
buildpkg-lib32 \
buildpkg-lib32-gremlins \
buildpkg-lib32-goblins
DEPLOYPKG_SYMS = \
deploypkg-system \
deploypkg-world \
deploypkg-gremlins \
deploypkg-goblins \
deploypkg-galaxy \
deploypkg-galaxy-gremlins \
deploypkg-galaxy-goblins \
deploypkg-lib32 \
deploypkg-lib32-gremlins \
deploypkg-lib32-goblins
BIN_ISO = \ BIN_ISO = \
bin/buildiso \ bin/buildiso \
bin/deployiso bin/deployiso
BIN_ISO_SYMS = \ BUILDISO_SYMS = \
buildiso-gremlins \ buildiso-gremlins \
buildiso-goblins buildiso-goblins
@@ -125,6 +150,8 @@ install_pkg:
$(LN) find-libdeps $(DESTDIR)$(BINDIR)/find-libprovides $(LN) find-libdeps $(DESTDIR)$(BINDIR)/find-libprovides
for l in $(COMMITPKG_SYMS); do $(LN) commitpkg $(DESTDIR)$(BINDIR)/$$l; done for l in $(COMMITPKG_SYMS); do $(LN) commitpkg $(DESTDIR)$(BINDIR)/$$l; done
for l in $(BUILDPKG_SYMS); do $(LN) buildpkg $(DESTDIR)$(BINDIR)/$$l; done
for l in $(DEPLOYPKG_SYMS); do $(LN) deploypkg $(DESTDIR)$(BINDIR)/$$l; done
install $(DIRMODE) $(DESTDIR)$(LIBDIR)/$(TOOLS) install $(DIRMODE) $(DESTDIR)$(LIBDIR)/$(TOOLS)
install $(FILEMODE) $(LIBS_PKG) $(DESTDIR)$(LIBDIR)/$(TOOLS) install $(FILEMODE) $(LIBS_PKG) $(DESTDIR)$(LIBDIR)/$(TOOLS)
@@ -141,7 +168,7 @@ install_iso: install_cpio
install $(DIRMODE) $(DESTDIR)$(BINDIR) install $(DIRMODE) $(DESTDIR)$(BINDIR)
install $(MODE) $(BIN_ISO) $(DESTDIR)$(BINDIR) install $(MODE) $(BIN_ISO) $(DESTDIR)$(BINDIR)
for l in $(BIN_ISO_SYMS); do $(LN) buildiso $(DESTDIR)$(BINDIR)/$$l; done for l in $(BUILDISO_SYMS); do $(LN) buildiso $(DESTDIR)$(BINDIR)/$$l; done
install $(DIRMODE) $(DESTDIR)$(LIBDIR)/$(TOOLS) install $(DIRMODE) $(DESTDIR)$(LIBDIR)/$(TOOLS)
install $(FILEMODE) $(LIBS_ISO) $(DESTDIR)$(LIBDIR)/$(TOOLS) install $(FILEMODE) $(LIBS_ISO) $(DESTDIR)$(LIBDIR)/$(TOOLS)

View File

@@ -50,29 +50,15 @@ select_os(){
fi fi
} }
display_settings(){
show_version
show_config
msg "ARGS:"
msg2 "automount: %s" "${automount}"
msg2 "run_args: %s" "${run_args[*]}"
msg "PATHS:"
msg2 "chrootdir: %s" "${chrootdir}"
}
load_user_info load_user_info
load_config "${AT_USERCONFDIR}/artools.conf" || load_config "${SYSCONFDIR}/artools.conf" load_config "${AT_USERCONFDIR}/artools.conf" || load_config "${SYSCONFDIR}/artools.conf"
automount=false automount=false
pretend=false
usage() { usage() {
echo "usage: ${0##*/} -a [or] ${0##*/} chroot-dir [command]" echo "usage: ${0##*/} -a [or] ${0##*/} chroot-dir [command]"
echo ' -a Automount detected linux system' echo ' -a Automount detected linux system'
echo ' -q Query settings and pretend'
echo ' -h Print this help message' echo ' -h Print this help message'
echo '' echo ''
echo " If 'command' is unspecified, ${0##*/} will launch /bin/sh." echo " If 'command' is unspecified, ${0##*/} will launch /bin/sh."
@@ -86,12 +72,11 @@ usage() {
orig_argv=("$0" "$@") orig_argv=("$0" "$@")
opts=':haq' opts=':ha'
while getopts ${opts} arg; do while getopts ${opts} arg; do
case "${arg}" in case "${arg}" in
a) automount=true ;; a) automount=true ;;
q) pretend=true ;;
h|?) usage 0 ;; h|?) usage 0 ;;
*) echo "invalid argument ${arg}"; usage 1 ;; *) echo "invalid argument ${arg}"; usage 1 ;;
esac esac
@@ -104,8 +89,6 @@ if ${automount};then
chrootdir=/mnt chrootdir=/mnt
run_args=/bin/bash run_args=/bin/bash
${pretend} && display_settings && exit 1
select_os "${chrootdir}" select_os "${chrootdir}"
else else
chrootdir=$1 chrootdir=$1
@@ -114,8 +97,6 @@ else
[[ -d ${chrootdir} ]] || die "Can't create chroot on non-directory %s" "${chrootdir}" [[ -d ${chrootdir} ]] || die "Can't create chroot on non-directory %s" "${chrootdir}"
${pretend} && display_settings && exit 1
chroot_api_mount "${chrootdir}" || die "failed to setup API filesystems in chroot %s" "${chrootdir}" chroot_api_mount "${chrootdir}" || die "failed to setup API filesystems in chroot %s" "${chrootdir}"
chroot_add_resolv_conf "${chrootdir}" chroot_add_resolv_conf "${chrootdir}"
fi fi

View File

@@ -35,9 +35,6 @@ create_min_fs(){
mkdir -m 0755 -p $1/var/{cache/pacman/pkg,lib/pacman,log} $1/{dev,etc} mkdir -m 0755 -p $1/var/{cache/pacman/pkg,lib/pacman,log} $1/{dev,etc}
mkdir -m 1777 -p $1/{tmp,run} mkdir -m 1777 -p $1/{tmp,run}
mkdir -m 0555 -p $1/{sys,proc} mkdir -m 0555 -p $1/{sys,proc}
# if [[ ! -f $1/etc/machine-id ]];then
# touch $1/etc/machine-id
# fi
} }
newroot=/mnt newroot=/mnt

View File

@@ -49,34 +49,11 @@ prepare_build(){
prepare_dir "${iso_root}" prepare_dir "${iso_root}"
} }
show_profile(){
msg2 "iso_file: %s" "${iso_file}"
if ${verbose};then
msg2 "AUTOLOGIN: %s" "${AUTOLOGIN}"
msg2 "HOST_NAME: %s" "${HOST_NAME}"
msg2 "USER_NAME: %s" "${USER_NAME}"
msg2 "PASSWORD: %s" "${PASSWORD}"
msg2 "ADDGROUPS: %s" "${ADDGROUPS}"
msg2 "SERVICES_LIVE: %s" "${SERVICES_LIVE[*]}"
msg2 "SERVICES: %s" "${SERVICES[*]}"
fi
}
display_settings(){ display_settings(){
show_version
show_config
msg "OPTIONS:" msg "OPTIONS:"
msg2 "PROFILE: %s" "${PROFILE}" msg2 "PROFILE: %s" "${PROFILE}"
msg2 "INITSYS: %s" "${INITSYS}" msg2 "INITSYS: %s" "${INITSYS}"
[[ -n ${GPG_KEY} ]] && msg2 "GPG_KEY: %s" "${GPG_KEY}" [[ -n ${GPG_KEY} ]] && msg2 "GPG_KEY: %s" "${GPG_KEY}"
msg2 "REPOSITORY: %s" "${REPOSITORY}"
msg "ARGS:"
msg2 "clean_first: %s" "${clean_first}"
msg2 "images_only: %s" "${images_only}"
msg2 "iso_only: %s" "${iso_only}"
msg2 "persist: %s" "${persist}"
msg "ISO SETTINGS:" msg "ISO SETTINGS:"
msg2 "ISO_VERSION: %s" "${ISO_VERSION}" msg2 "ISO_VERSION: %s" "${ISO_VERSION}"
@@ -104,13 +81,13 @@ build(){
fi fi
if ${iso_only}; then if ${iso_only}; then
[[ ! -d ${work_dir} ]] && die "Create images: buildiso -p %s -x" "${PROFILE}" [[ ! -d ${work_dir} ]] && die "Create images: %s -p %s -x" "${cmd}" "${PROFILE}"
compress_images compress_images
exit 1 exit 1
fi fi
if ${images_only}; then if ${images_only}; then
prepare_images prepare_images
warning "Continue compress: buildiso -p %s -zc ..." "${PROFILE}" warning "Continue compress: %s -p %s -zc ..." "${cmd}" "${PROFILE}"
exit 1 exit 1
else else
prepare_images prepare_images
@@ -128,7 +105,7 @@ clean_first=true
pretend=false pretend=false
images_only=false images_only=false
iso_only=false iso_only=false
verbose=false log=false
persist=false persist=false
mkchroot_args=() mkchroot_args=()
@@ -137,7 +114,7 @@ cmd=${0##*/}
REPOSITORY=${cmd##*-} REPOSITORY=${cmd##*-}
usage() { usage() {
echo "Usage: ${0##*/} [options]" echo "Usage: ${cmd} [options]"
echo " -p <profile> Profile [default: ${PROFILE}]" echo " -p <profile> Profile [default: ${PROFILE}]"
echo ' -r <dir> Chroots directory' echo ' -r <dir> Chroots directory'
echo " [default: ${CHROOTS_ISO}]" echo " [default: ${CHROOTS_ISO}]"
@@ -152,7 +129,7 @@ usage() {
echo ' -x Build images only' echo ' -x Build images only'
echo ' -z Generate iso only' echo ' -z Generate iso only'
echo ' Requires pre built images (-x)' echo ' Requires pre built images (-x)'
echo ' -v Verbose output to log file, show profile detail (-q)' echo ' -l Log to file'
echo ' -q Query settings and pretend build' echo ' -q Query settings and pretend build'
echo ' -h This help' echo ' -h This help'
echo '' echo ''
@@ -162,7 +139,7 @@ usage() {
orig_argv=("$0" "$@") orig_argv=("$0" "$@")
opts='p:r:t:i:g:czxmvqh' opts='p:r:t:i:g:czxmlqh'
while getopts "${opts}" arg; do while getopts "${opts}" arg; do
case "${arg}" in case "${arg}" in
@@ -175,7 +152,7 @@ while getopts "${opts}" arg; do
x) images_only=true ;; x) images_only=true ;;
z) iso_only=true ;; z) iso_only=true ;;
m) persist=true ;; m) persist=true ;;
v) verbose=true ;; l) log=true ;;
q) pretend=true ;; q) pretend=true ;;
h|?) usage 0 ;; h|?) usage 0 ;;
*) echo "invalid argument '${arg}'"; usage 1 ;; *) echo "invalid argument '${arg}'"; usage 1 ;;

View File

@@ -11,122 +11,66 @@
VERSION=@version@ VERSION=@version@
shopt -s nullglob [[ -r @libdir@/util-msg.sh ]] && source @libdir@/util-msg.sh
import @libdir@/util.sh
LIBDIR='@libdir@' import @libdir@/util-chroot.sh
DATADIR='@datadir@'
SYSCONFDIR='@sysconfdir@'
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
import ${LIBDIR}/util.sh
import ${LIBDIR}/util-chroot.sh
show_pkg(){
source PKGBUILD
for n in ${pkgname[@]}; do
msg2 "%s" "$n"
done
}
display_settings(){
show_version
show_config
msg "OPTIONS:"
msg2 "CHROOTS_PKG: %s" "${CHROOTS_PKG}"
msg2 "REPOSITORY: %s" "${REPOSITORY}"
msg "ARGS:"
msg2 "create_first: %s" "${create_first}"
msg2 "makepkg_args: %s" "${makepkg_args[*]}"
msg2 "mkchrootpkg_args: %s" "${mkchrootpkg_args[*]}"
msg "BUILD:"
show_pkg
}
load_user_info load_user_info
load_config "${AT_USERCONFDIR}/artools.conf" || load_config "${SYSCONFDIR}/artools.conf" load_config "${AT_USERCONFDIR}/artools.conf" || load_config "@sysconfdir@/artools.conf"
create_first=false create_first=false
pretend=false
mkchroot_args=()
mkchrootpkg_args=(-c -n) mkchrootpkg_args=(-c -n)
REPOSITORY='default' cmd=${0##*/}
repo=${cmd#*-}
prepare_build(){
local pac_file= mp_file='makepkg.conf'
base_devel=('base-devel') base_devel=('base-devel')
case ${REPOSITORY} in case ${repo} in
'system'|'world'|'galaxy') REPOSITORY='default' ;; system|world|galaxy) repo='default' ;;
lib32*) base_devel+=('multilib-devel') ;; lib32*) base_devel+=('multilib-devel') ;;
galaxy-gremlins|galaxy-goblins) REPOSITORY=${REPOSITORY#*-} ;; galaxy-gremlins|galaxy-goblins) repo=${repo#*-} ;;
esac esac
local pac_file="pacman-${REPOSITORY}.conf"
local pacman_conf="${DATADIR}/$pac_file" pacman_conf="/usr/share/artools/pacman-${repo}.conf"
[[ -f $AT_USERCONFDIR/$pac_file ]] && pacman_conf="$AT_USERCONFDIR/$pac_file" [[ -f $AT_USERCONFDIR/pacman-${repo}.conf ]] && pacman_conf="$AT_USERCONFDIR/pacman-${repo}.conf"
work_dir="${CHROOTS_PKG}/${REPOSITORY}-${ARCH}" makepkg_conf="/usr/share/artools/makepkg.conf"
[[ -f $AT_USERCONFDIR/makepkg.conf ]] && makepkg_conf="$AT_USERCONFDIR/makepkg.conf"
local makepkg_conf="${DATADIR}/$mp_file"
[[ -f $AT_USERCONFDIR/$mp_file ]] && makepkg_conf="$AT_USERCONFDIR/$mp_file"
mkchroot_args+=(-C "${pacman_conf}" -M "${makepkg_conf}" "${work_dir}/root")
mkchrootpkg_args+=(-r "${work_dir}" "${makepkg_args[@]}")
}
build(){
local timer_start=$(get_timer)
exec mkchrootpkg "${mkchrootpkg_args[@]}"
show_elapsed_time "${FUNCNAME}" "${timer_start}"
}
usage() { usage() {
echo "Usage: ${0##*/} [options] -- [makepkg_args]" echo "Usage: ${0##*/} [options] -- [mkchrootpkg_args]"
echo " -r <dir> Repository [default: ${REPOSITORY}]" echo " -r <dir> Create chroots in this directory"
echo ' -c Create root chroot' echo ' -c Recreate the chroot before building'
echo ' -q Query settings and pretend build'
echo ' -h This help' echo ' -h This help'
echo '' echo ''
echo "Default makepkg_args args: ${makepkg_args[*]}" echo "Default mkchrootpkg_args args: ${mkchrootpkg_args[*]}"
echo '' echo ''
exit $1 exit $1
} }
orig_argv=("$0" "$@") orig_argv=("$0" "$@")
opts='r:cqh' opts='hc:r'
while getopts "${opts}" arg; do while getopts "${opts}" arg; do
case "${arg}" in case "${arg}" in
r) REPOSITORY="$OPTARG" ;; r) CHROOTS_PKG="$OPTARG" ;;
c) create_first=true ;; c) create_first=true ;;
q) pretend=true ;;
h|?) usage 0 ;; h|?) usage 0 ;;
*) echo "invalid argument '%s'" "${arg}"; usage 1 ;; *) echo "invalid argument '%s'" "${arg}"; usage 1 ;;
esac esac
done done
makepkg_args+=("${@:$OPTIND}") check_root SOURCE_DATE_EPOCH
check_root mkchrootpkg_args+=("${@:$OPTIND}")
prepare_build if ${create_first} || [[ ! -d "${CHROOTS_PKG}/${repo}-${ARCH}" ]];then
msg "Creating chroot for [%s] (%s)..." "${repo}" "${ARCH}"
${pretend} && display_settings && exit for copy in "${CHROOTS_PKG}/${repo}-${ARCH}"/*; do
if ${create_first} || [[ ! -d ${work_dir}/root ]];then
msg "Creating chroot for [%s] (%s)..." "${REPOSITORY}" "${ARCH}"
for copy in "${work_dir}"/*; do
[[ -d $copy ]] || continue [[ -d $copy ]] || continue
msg2 "Deleting chroot copy '%s'..." "$(basename "${copy}")" msg2 "Deleting chroot copy '%s'..." "$(basename "${copy}")"
@@ -137,14 +81,30 @@ if ${create_first} || [[ ! -d ${work_dir}/root ]];then
done done
lock_close 9 lock_close 9
rm -rf --one-file-system "${work_dir}" rm -rf --one-file-system "${CHROOTS_PKG}/${repo}-${ARCH}"
mkdir -p "${work_dir}" mkdir -p "${CHROOTS_PKG}/${repo}-${ARCH}"
setarch "${ARCH}" mkchroot \ setarch "${ARCH}" mkchroot \
"${mkchroot_args[@]}" "${base_devel[@]}" || abort -C "${pacman_conf}" \
-M "${makepkg_conf}" \
"${CHROOTS_PKG}/${repo}-${ARCH}/root" \
"${base_devel[@]}" || abort
else else
lock 9 "${work_dir}/root.lock" "Locking clean chroot" lock 9 "${CHROOTS_PKG}/${repo}-${ARCH}/root.lock" "Locking clean chroot"
chroot-run "${mkchroot_args[@]}" \ chroot-run \
-C "${pacman_conf}" \
-M "${makepkg_conf}" \
"${CHROOTS_PKG}/${repo}-${ARCH}/root" \
pacman -Syu --noconfirm || abort pacman -Syu --noconfirm || abort
fi fi
build # Always build official packages reproducibly
if [[ ! -v SOURCE_DATE_EPOCH ]]; then
export SOURCE_DATE_EPOCH=$(date +%s)
fi
timer_start=$(get_timer)
msg "Building in chroot for [%s] (%s)..." "${repo}" "${ARCH}"
exec mkchrootpkg -r "${CHROOTS_PKG}/${repo}-${ARCH}" "${mkchrootpkg_args[@]}"
show_elapsed_time "${FUNCNAME}" "${timer_start}"

View File

@@ -66,6 +66,26 @@ pull_tree_artix(){
done done
} }
mkrepo(){
local pkg="$1" team="$2"
local pkg_path=${TREE_DIR_ARTIX}/$team/$pkg
cd ${TREE_DIR_ARTIX}/$team
local org=$(get_pkg_org "$pkg")
create_repo "$pkg" "$org"
add_repo_to_team "$pkg" "$org" "$team"
subrepo_clone "$pkg" "$org"
prepare_dir "$pkg_path/trunk"
cd $pkg_path
commit_jenkins_files
}
show_version_table(){ show_version_table(){
msg_table_header "%-20s %-20s %-25s %-30s %-30s" "Arch Repo" "Artix Repo" "Package" "Arch version" "Artix version" msg_table_header "%-20s %-20s %-25s %-30s %-30s" "Arch Repo" "Artix Repo" "Package" "Arch version" "Artix version"
@@ -234,37 +254,12 @@ sync_repos(){
pull_tree_artix pull_tree_artix
} }
display_settings(){
show_version
show_config
msg "OPTIONS:"
msg2 "PACKAGE: %s" "${PACKAGE}"
msg "ARGS:"
msg2 "sync: %s" "${sync}"
msg2 "sync_arch: %s" "${sync_arch}"
msg2 "compare: %s" "${compare}"
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}"
msg "PATHS:"
msg2 "TREE_DIR_ARTIX: %s" "${TREE_DIR_ARTIX}"
msg2 "TREE_DIR_ARCH: %s" "${TREE_DIR_ARCH}"
}
load_user_info load_user_info
load_config "${AT_USERCONFDIR}/artools.conf" || load_config "${SYSCONFDIR}/artools.conf" load_config "${AT_USERCONFDIR}/artools.conf" || load_config "${SYSCONFDIR}/artools.conf"
load_vars "${PAC_USERCONFDIR}/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf" load_vars "${PAC_USERCONFDIR}/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf"
load_vars /etc/makepkg.conf load_vars /etc/makepkg.conf
pretend=false
sync=false sync=false
sync_arch=true sync_arch=true
compare=false compare=false
@@ -275,13 +270,18 @@ downgrades=false
artix=false artix=false
import=false import=false
view=false view=false
createnew=false
PACKAGE='' PACKAGE=''
tree_names=(packages community) tree_names=(packages community)
TEAM=${tree_names[0]}
usage() { usage() {
echo "Usage: ${0##*/} [options]" echo "Usage: ${0##*/} [options]"
echo ' -p <pkg> Package name' echo ' -p <pkg> Package name'
echo ' -t <team> Team name (only with -m)'
echo " [default: ${TEAM}]"
echo " -s Clone or pull repos" echo " -s Clone or pull repos"
echo " -z Don't clone or pull arch repos" echo " -z Don't clone or pull arch repos"
echo ' -c Compare packages' echo ' -c Compare packages'
@@ -291,9 +291,8 @@ usage() {
echo " -y Don't inlcude staging packages" echo " -y Don't inlcude staging packages"
echo ' -x Include unstable kde and gnome' echo ' -x Include unstable kde and gnome'
echo ' -i Import a package from arch repos' echo ' -i Import a package from arch repos'
echo " -w Don't write Jenkinsfile and agent.yaml on import" echo ' -m Make new remote subrepo and clone it'
echo ' -v View package depends' echo ' -v View package depends'
echo ' -q Query settings'
echo ' -h This help' echo ' -h This help'
echo '' echo ''
echo '' echo ''
@@ -302,11 +301,12 @@ usage() {
orig_argv=("$0" "$@") orig_argv=("$0" "$@")
opts='p:csudayizxvqh' opts='p:t:csudayimzxvh'
while getopts "${opts}" arg; do while getopts "${opts}" arg; do
case "${arg}" in case "${arg}" in
p) PACKAGE="$OPTARG" ;; p) PACKAGE="$OPTARG" ;;
t) TEAM="$OPTARG" ;;
s) sync=true ;; s) sync=true ;;
z) sync_arch=false ;; z) sync_arch=false ;;
c) compare=true ;; c) compare=true ;;
@@ -315,9 +315,9 @@ while getopts "${opts}" arg; do
a) artix=true ;; a) artix=true ;;
y) staging=false ;; y) staging=false ;;
i) import=true ;; i) import=true ;;
m) createnew=true ;;
v) view=true ;; v) view=true ;;
x) unstable=true ;; x) unstable=true ;;
q) pretend=true ;;
h|?) usage 0 ;; h|?) usage 0 ;;
*) echo "invalid argument '${arg}'"; usage 1 ;; *) echo "invalid argument '${arg}'"; usage 1 ;;
esac esac
@@ -328,8 +328,6 @@ shift $(($OPTIND - 1))
prepare_dir "${TREE_DIR_ARTIX}" prepare_dir "${TREE_DIR_ARTIX}"
prepare_dir "${TREE_DIR_ARCH}" prepare_dir "${TREE_DIR_ARCH}"
${pretend} && display_settings && exit 1
${sync} && sync_repos ${sync} && sync_repos
${view} && view_build "${PACKAGE}" ${view} && view_build "${PACKAGE}"
@@ -337,3 +335,5 @@ ${view} && view_build "${PACKAGE}"
${compare} && show_version_table ${compare} && show_version_table
${import} && from_arch "${PACKAGE}" ${import} && from_arch "${PACKAGE}"
${createnew} && mkrepo "${PACKAGE}" "${TEAM}"

View File

@@ -129,20 +129,6 @@ symlink_commit_pkg(){
fi fi
} }
display_settings(){
show_version
show_config
msg "OPTIONS:"
msg2 "REPO_SRC: %s" "${REPO_SRC}"
msg2 "REPO_DEST: %s" "${REPO_DEST}"
msg2 "PACKAGE: %s" "${PACKAGE}"
msg "ARGS:"
msg2 "remove: %s" "${remove}"
msg2 "push: %s" "${push}"
}
load_user_info load_user_info
load_config "${AT_USERCONFDIR}/artools.conf" || load_config "${SYSCONFDIR}/artools.conf" load_config "${AT_USERCONFDIR}/artools.conf" || load_config "${SYSCONFDIR}/artools.conf"
@@ -153,7 +139,6 @@ REPO_SRC='trunk'
PACKAGE='' PACKAGE=''
remove=false remove=false
push=false push=false
pretend=false
cmd=${0##*/} cmd=${0##*/}
REPO_DEST=${cmd%pkg} REPO_DEST=${cmd%pkg}
@@ -164,7 +149,6 @@ usage() {
echo ' -p <pkg> Package name' echo ' -p <pkg> Package name'
echo ' -r Delete from repo (commitpkg only)' echo ' -r Delete from repo (commitpkg only)'
echo ' -u Push' echo ' -u Push'
echo ' -q Query settings and pretend'
echo ' -h This help' echo ' -h This help'
echo '' echo ''
echo '' echo ''
@@ -173,7 +157,7 @@ usage() {
orig_argv=("$0" "$@") orig_argv=("$0" "$@")
opts='p:s:urqh' opts='p:s:urh'
while getopts "${opts}" arg; do while getopts "${opts}" arg; do
case "${arg}" in case "${arg}" in
@@ -181,7 +165,6 @@ while getopts "${opts}" arg; do
p) PACKAGE="$OPTARG" ;; p) PACKAGE="$OPTARG" ;;
r) remove=true ;; r) remove=true ;;
u) push=true ;; u) push=true ;;
q) pretend=true ;;
h|?) usage 0 ;; h|?) usage 0 ;;
*) echo "invalid argument '${arg}'"; usage 1 ;; *) echo "invalid argument '${arg}'"; usage 1 ;;
esac esac
@@ -189,8 +172,6 @@ done
shift $(($OPTIND - 1)) shift $(($OPTIND - 1))
${pretend} && display_settings && exit 1
if $(is_valid_repo "${REPO_SRC}");then if $(is_valid_repo "${REPO_SRC}");then
if [[ "${cmd}" == 'commitpkg' ]];then if [[ "${cmd}" == 'commitpkg' ]];then
commit_pkg commit_pkg

View File

@@ -33,31 +33,10 @@ sync_dir(){
show_elapsed_time "${FUNCNAME}" "${timer_start}" show_elapsed_time "${FUNCNAME}" "${timer_start}"
} }
display_settings(){
show_version
show_config
msg "OPTIONS:"
msg2 "PROFILE: %s" "${PROFILE}"
msg2 "UPLIMIT: %s kB/s" "${UPLIMIT}"
msg "ARGS:"
msg2 "update: %s" "${update}"
msg2 "verbose: %s" "${verbose}"
msg "REMOTE:"
msg2 "ACCOUNT: %s" "${ACCOUNT}"
msg "UPLOAD:"
msg2 "SRC_DIR: ${SRC_DIR}"
msg2 "DEST_DIR: ${DEST_DIR}"
}
load_user_info load_user_info
load_config "${AT_USERCONFDIR}/artools.conf" || load_config "${SYSCONFDIR}/artools.conf" load_config "${AT_USERCONFDIR}/artools.conf" || load_config "${SYSCONFDIR}/artools.conf"
pretend=false
update=false update=false
verbose=false verbose=false
@@ -68,7 +47,6 @@ usage() {
echo " -p Source folder to upload [default: ${PROFILE}]" echo " -p Source folder to upload [default: ${PROFILE}]"
echo " -l Limit bandwidth in kB/s [default:${UPLIMIT}]" echo " -l Limit bandwidth in kB/s [default:${UPLIMIT}]"
echo ' -u Update remote directory' echo ' -u Update remote directory'
echo ' -q Query settings and pretend upload'
echo ' -v Verbose output' echo ' -v Verbose output'
echo ' -h This help' echo ' -h This help'
echo '' echo ''
@@ -76,7 +54,7 @@ usage() {
exit $1 exit $1
} }
opts='p:l:uvqh' opts='p:l:uvh'
while getopts "${opts}" arg; do while getopts "${opts}" arg; do
case "${arg}" in case "${arg}" in
@@ -84,7 +62,6 @@ while getopts "${opts}" arg; do
l) UPLIMIT="$OPTARG" ;; l) UPLIMIT="$OPTARG" ;;
u) update=true; rsync_args+=(-u) ;; u) update=true; rsync_args+=(-u) ;;
v) verbose=true; rsync_args+=(-v --stats) ;; v) verbose=true; rsync_args+=(-v --stats) ;;
q) pretend=true; rsync_args+=(-n) ;;
h|?) usage 0 ;; h|?) usage 0 ;;
*) echo "invalid argument '${arg}'"; usage 1 ;; *) echo "invalid argument '${arg}'"; usage 1 ;;
esac esac
@@ -98,6 +75,4 @@ rsync_args+=(--bwlimit=${UPLIMIT})
prepare_transfer prepare_transfer
${pretend} && display_settings #&& exit 1
sync_dir sync_dir

View File

@@ -11,27 +11,26 @@
VERSION=@version@ VERSION=@version@
LIBDIR='@libdir@' [[ -r @libdir@/util-msg.sh ]] && source @libdir@/util-msg.sh
SYSCONFDIR='@sysconfdir@' import @libdir@/util.sh
import @libdir@/util-pkg.sh
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
import ${LIBDIR}/util.sh
import ${LIBDIR}/util-pkg.sh
update_repo(){ update_repo(){
local repo="$1" pkgfile ver ext=db.tar.xz local repo="$1" pkgfile ver ext=db.tar.xz
local repo_path=${REPOS_ROOT}/$repo/os/${ARCH} packages=() local repo_path=${REPOS_ROOT}/$repo/os/${ARCH} packages=()
source PKGBUILD source PKGBUILD
for name in ${pkgname[@]};do for name in ${pkgname[@]};do
[[ $arch == any ]] && CARCH=any pkgarch=$(get_pkg_arch "$name")
ver=$(get_full_version "$name") ver=$(get_full_version "$name")
if pkgfile=$(find_cached_package "$name" "$ver" "$CARCH");then if pkgfile=$(find_cached_package "$name" "$ver" "$pkgarch");then
local pkg=${pkgfile##*/} local pkg=${pkgfile##*/}
info "Found: %s" "$pkg" info "Found: %s" "$pkg"
if ${add_pkg};then if ${add_pkg};then
local action='add' local action='add'
packages+=("$pkg") packages+=("$pkg")
checkpkg "${pkgfile}" # 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}
@@ -50,55 +49,37 @@ update_repo(){
return 0 return 0
} }
display_settings(){
show_version
show_config
msg "OPTIONS:"
msg2 "REPOSITORY: %s" "${REPOSITORY}"
msg "ARGS:"
msg2 "add_pkg: %s" "${add_pkg}"
msg2 "del_pkg: %s" "${del_pkg}"
msg2 "sign_pkg: %s" "${sign_pkg}"
}
load_user_info load_user_info
load_config "${AT_USERCONFDIR}/artools.conf" || load_config "${SYSCONFDIR}/artools.conf" load_config "${AT_USERCONFDIR}/artools.conf" || load_config "@sysconfdir@/artools.conf"
load_vars "${PAC_USERCONFDIR}/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf" load_vars "${PAC_USERCONFDIR}/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf"
load_vars /etc/makepkg.conf load_vars /etc/makepkg.conf
pretend=false
add_pkg=false add_pkg=false
del_pkg=false del_pkg=false
REPOSITORY=
sign_pkg=false sign_pkg=false
cmd=${0##*/}
dest_repo=${cmd#*-}
usage() { usage() {
echo "Usage: ${0##*/} [options]" echo "Usage: ${cmd} [options]"
echo " -d Destination repository [default:${REPOSITORY}]"
echo ' -a Add package(s) to repository' echo ' -a Add package(s) to repository'
echo ' -r Remove package(s) from repository' echo ' -r Remove package(s) from repository'
echo ' -s Sign package(s)' echo ' -s Sign package(s)'
echo ' -q Query settings and pretend upload'
echo ' -h This help' echo ' -h This help'
echo '' echo ''
echo '' echo ''
exit $1 exit $1
} }
orig_argv=("$0" "$@") opts='arsh'
opts='d:arsqh'
while getopts "${opts}" arg; do while getopts "${opts}" arg; do
case "${arg}" in case "${arg}" in
d) REPOSITORY="$OPTARG" ;;
a) add_pkg=true; del_pkg=false ;; a) add_pkg=true; del_pkg=false ;;
r) del_pkg=true; add_pkg=false ;; r) del_pkg=true; add_pkg=false ;;
s) sign_pkg=true ;; s) sign_pkg=true ;;
q) pretend=true ;;
h|?) usage 0 ;; h|?) usage 0 ;;
*) echo "invalid argument '${arg}'"; usage 1 ;; *) echo "invalid argument '${arg}'"; usage 1 ;;
esac esac
@@ -108,6 +89,4 @@ shift $(($OPTIND - 1))
prepare_dir "${REPOS_ROOT}" prepare_dir "${REPOS_ROOT}"
${pretend} && display_settings && exit 1 update_repo "${dest_repo}"
update_repo "${REPOSITORY}"

View File

@@ -58,35 +58,39 @@ usage() {
exit 1 exit 1
} }
sync_chroot() { # {{{ functions
local chrootdir=$1
local copy=$2
local copydir=''
if [[ ${copy:0:1} = / ]]; then
copydir=$copy
else
copydir="$chrootdir/$copy"
fi
if [[ "$chrootdir/root" -ef "$copydir" ]]; then # Usage: sync_chroot $rootdir $copydir [$copy]
sync_chroot() {
local rootdir=$1
local copydir=$2
local copy=${3:-$2}
if [[ "$rootdir" -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 "$chrootdir/root.lock" \ slock 8 "$rootdir.lock" \
"Locking clean chroot [%s]" "$chrootdir/root" "Locking clean chroot [%s]" "$rootdir"
stat_busy "Synchronizing chroot copy [%s] -> [%s]" "$chrootdir/root" "$copydir" stat_busy "Synchronizing chroot copy [%s] -> [%s]" "$rootdir" "$copy"
if is_btrfs "$chrootdir" && ! mountpoint -q "$copydir"; then if is_subvolume "$rootdir" && is_same_fs "$rootdir" "$(dirname -- "$copydir")" && ! 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 "$chrootdir/root/" "$copydir" rsync -a --delete -q -W -x "$rootdir/" "$copydir"
fi fi
stat_done stat_done
@@ -103,7 +107,7 @@ delete_chroot() {
local copy=${1:-$2} local copy=${1:-$2}
stat_busy "Removing chroot copy [%s]" "$copy" stat_busy "Removing chroot copy [%s]" "$copy"
if is_btrfs "$chrootdir" && ! mountpoint -q "$copydir"; then if is_subvolume "$copydir" && ! mountpoint -q "$copydir"; then
subvolume_delete_recursive "$copydir" || subvolume_delete_recursive "$copydir" ||
die "Unable to delete subvolume %s" "$copydir" die "Unable to delete subvolume %s" "$copydir"
else else
@@ -128,7 +132,10 @@ install_packages() {
pkgnames=("${install_pkgs[@]##*/}") pkgnames=("${install_pkgs[@]##*/}")
cp -- "${install_pkgs[@]}" "$copydir/root/" cp -- "${install_pkgs[@]}" "$copydir/root/"
chroot-run -r "${bindmounts_ro[*]}" -w "${bindmounts_rw[*]}" "$copydir" \ chroot-run \
-r "${bindmounts_ro[@]}" \
-r "${bindmounts_rw[@]}" \
"$copydir" \
pacman -U --noconfirm -- "${pkgnames[@]/#//root/}" pacman -U --noconfirm -- "${pkgnames[@]/#//root/}"
ret=$? ret=$?
rm -- "${pkgnames[@]/#/$copydir/root/}" rm -- "${pkgnames[@]/#/$copydir/root/}"
@@ -148,8 +155,9 @@ prepare_chroot() {
[[ $keepbuilddir = true ]] || rm -rf "$copydir/build" [[ $keepbuilddir = true ]] || rm -rf "$copydir/build"
local builduser_uid="${SUDO_UID:-$UID}" local builduser_uid builduser_gid
local builduser_gid="$(id -g "$builduser_uid")" builduser_uid="${SUDO_UID:-$UID}"
builduser_gid="$(id -g "$builduser_uid")"
local install="install -o $builduser_uid -g $builduser_gid" local install="install -o $builduser_uid -g $builduser_gid"
local x local x
@@ -157,16 +165,11 @@ prepare_chroot() {
# which we might not be able to load (i.e. when building i686 packages on # which we might not be able to load (i.e. when building i686 packages on
# an x86_64 host). # an x86_64 host).
sed -e '/^builduser:/d' -i "$copydir"/etc/{passwd,shadow,group} sed -e '/^builduser:/d' -i "$copydir"/etc/{passwd,shadow,group}
printf >>"$copydir/etc/group" 'builduser:x:%d:\n' $builduser_gid printf >>"$copydir/etc/group" 'builduser:x:%d:\n' "$builduser_gid"
printf >>"$copydir/etc/passwd" 'builduser:x:%d:%d:builduser:/build:/bin/bash\n' $builduser_uid $builduser_gid printf >>"$copydir/etc/passwd" 'builduser:x:%d:%d:builduser:/build:/bin/bash\n' "$builduser_uid" "$builduser_gid"
printf >>"$copydir/etc/shadow" 'builduser:!!:%d::::::\n' "$(( $(date -u +%s) / 86400 ))" printf >>"$copydir/etc/shadow" 'builduser:!!:%d::::::\n' "$(( $(date -u +%s) / 86400 ))"
$install -d "$copydir"/{build,build/.gnupg,startdir,{pkg,srcpkg,src,log}dest} $install -d "$copydir"/{build,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
sed -e '/^MAKEFLAGS=/d' -e '/^PACKAGER=/d' -i "$copydir/etc/makepkg.conf" 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 \ for x in BUILDDIR=/build PKGDEST=/pkgdest SRCPKGDEST=/srcpkgdest SRCDEST=/srcdest LOGDEST=/logdest \
@@ -203,19 +206,22 @@ _chrootbuild() {
# No coredumps # No coredumps
ulimit -c 0 ulimit -c 0
# Work around chroot-run not giving a ctty . /etc/locale.conf
#exec </dev/console
# shellcheck source=/dev/null
. /etc/profile . /etc/profile
#export LANG=en_US.UTF-8 # Beware, there are some stupid arbitrary rules on how you can
# use "$" in arguments to commands with "sudo -i". ${foo} or
# ${1} is OK, but $foo or $1 isn't.
# https://bugzilla.sudo.ws/show_bug.cgi?id=765
sudo --preserve-env=SOURCE_DATE_EPOCH -iu builduser bash -c 'cd /startdir; makepkg "$@"' -bash "$@" sudo --preserve-env=SOURCE_DATE_EPOCH -iu builduser bash -c 'cd /startdir; makepkg "$@"' -bash "$@"
ret=$? ret=$?
case $ret in case $ret in
0|14) return 0;; 0|14)
*) return $ret;; return 0;;
*)
return $ret;;
esac esac
} }
@@ -227,17 +233,15 @@ _chrootnamcap() {
done done
} }
# Usage: download_sources $copydir $src_owner # Usage: download_sources $copydir $makepkg_user
# Globals: # Globals:
# - SRCDEST # - SRCDEST
# - USER
download_sources() { download_sources() {
local copydir=$1 local copydir=$1
local makepkg_user=$2 local makepkg_user=$2
local builddir local builddir
builddir="$(mktemp -d)" builddir="$(mktemp -d)"
# chmod 1777 "$builddir"
chown "$makepkg_user:" "$builddir" chown "$makepkg_user:" "$builddir"
# Ensure sources are downloaded # Ensure sources are downloaded
@@ -254,6 +258,7 @@ download_sources() {
# Globals: # Globals:
# - PKGDEST # - PKGDEST
# - LOGDEST # - LOGDEST
# - SRCPKGDEST
move_products() { move_products() {
local copydir=$1 local copydir=$1
local src_owner=$2 local src_owner=$2
@@ -301,8 +306,8 @@ main() {
chrootdir= chrootdir=
passeddir= passeddir=
makepkg_user= makepkg_user=
declare -ga install_pkgs declare -a install_pkgs
declare -gi ret=0 declare -i ret=0
bindmounts_ro=() bindmounts_ro=()
bindmounts_rw=() bindmounts_rw=()
@@ -314,7 +319,7 @@ main() {
local opts='hcur:I:l:nTD:d:U:' local opts='hcur:I:l:nTD:d:U:'
while getopts ${opts} arg; do while getopts "${opts}" arg; do
case "$arg" in case "$arg" in
c) clean_first=true ;; c) clean_first=true ;;
D) bindmounts_ro+=("$OPTARG") ;; D) bindmounts_ro+=("$OPTARG") ;;
@@ -364,7 +369,7 @@ main() {
umask 0022 umask 0022
load_vars "${PAC_USERCONFDIR}/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf" load_vars "${XDG_CONFIG_HOME:-$USER_HOME/.config}/pacman/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf"
load_vars /etc/makepkg.conf load_vars /etc/makepkg.conf
# Use PKGBUILD directory if these don't exist # Use PKGBUILD directory if these don't exist
@@ -377,10 +382,13 @@ main() {
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" "$copy" sync_chroot "$chrootdir/root" "$copydir" "$copy"
fi fi
$update_first && chroot-run -r "${bindmounts_ro[*]}" -w "${bindmounts_rw[*]}" "$copydir" \ $update_first && chroot-run \
-r "${bindmounts_ro[@]}" \
-w "${bindmounts_rw[@]}" \
"$copydir" \
pacman -Syu --noconfirm pacman -Syu --noconfirm
if [[ -n ${install_pkgs[*]:-} ]]; then if [[ -n ${install_pkgs[*]:-} ]]; then
@@ -395,14 +403,18 @@ main() {
exit 1 exit 1
fi fi
download_sources "$copydir" "$src_owner" download_sources "$copydir" "$makepkg_user"
prepare_chroot "$copydir" "$USER_HOME" "$keepbuilddir" "$run_namcap" prepare_chroot "$copydir" "$USER_HOME" "$keepbuilddir" "$run_namcap"
bindmounts_rw+=("${PWD}:/startdir" "${SRCDEST}:/srcdest") bindmounts_rw+=("${PWD}:/startdir" "${SRCDEST}:/srcdest")
if chroot-run -r "${bindmounts_ro[*]}" -w "${bindmounts_rw[*]}" "$copydir" \ if chroot-run \
/chrootbuild "${makepkg_args[@]}"; then -r "${bindmounts_ro[*]}" \
-w "${bindmounts_rw[*]}" \
"$copydir" \
/chrootbuild "${makepkg_args[@]}"
then
move_products "$copydir" "$src_owner" move_products "$copydir" "$src_owner"
else else
(( ret += 1 )) (( ret += 1 ))

44
bin/pkg2yaml.in Normal file
View File

@@ -0,0 +1,44 @@
#!/bin/bash
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
VERSION=@version@
VERSION=0.10.4.r2.gd0e3c4e
if [[ -f "$1"/PKGBUILD ]]; then
LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
for lib in "$LIBRARY"/*.sh; do
source "$lib"
done
. /etc/makepkg.conf
. "$1"/PKGBUILD
pkgfile=$(print_all_package_names)
fi
NL=$'\n'
Yaml="%YAML 1.2"$NL
Yaml+="---"$NL
Yaml+="pkgfile:"$NL
for f in ${pkgfile[@]};do
Yaml+=" - ${f##*/}"$NL
done
Yaml+="pkgname:"$NL
for n in ${pkgname[@]};do
Yaml+=" - ${n##*/}"$NL
done
printf '%s' "${Yaml}"

View File

@@ -12,17 +12,28 @@ is_btrfs() {
[[ -e "$1" && "$(stat -f -c %T "$1")" == btrfs ]] [[ -e "$1" && "$(stat -f -c %T "$1")" == btrfs ]]
} }
is_subvolume() {
[[ -e "$1" && "$(stat -f -c %T "$1")" == btrfs && "$(stat -c %i "$1")" == 256 ]]
}
is_same_fs() {
[[ "$(stat -c %d "$1")" == "$(stat -c %d "$1")" ]]
}
subvolume_delete_recursive() { subvolume_delete_recursive() {
local subvol local subvol
is_btrfs "$1" || return 0 is_subvolume "$1" || return 0
while IFS= read -d $'\0' -r subvol; do while IFS= read -d $'\0' -r subvol; do
if ! btrfs subvolume delete "$subvol" &>/dev/null; then if ! subvolume_delete_recursive "$subvol"; then
return 1
fi
done < <(find "$1" -mindepth 1 -xdev -depth -inum 256 -print0)
if ! btrfs subvolume delete "$1" &>/dev/null; then
error "Unable to delete subvolume %s" "$subvol" error "Unable to delete subvolume %s" "$subvol"
return 1 return 1
fi fi
done < <(find "$1" -xdev -depth -inum 256 -print0)
return 0 return 0
} }

View File

@@ -26,6 +26,17 @@ init_profile(){
[[ -d "$profdir/$prof/live-overlay" ]] && LIVE_OVERLAY="$profdir/$prof/live-overlay" [[ -d "$profdir/$prof/live-overlay" ]] && LIVE_OVERLAY="$profdir/$prof/live-overlay"
} }
show_profile(){
msg2 "iso_file: %s" "${iso_file}"
msg2 "AUTOLOGIN: %s" "${AUTOLOGIN}"
msg2 "HOST_NAME: %s" "${HOST_NAME}"
msg2 "USER_NAME: %s" "${USER_NAME}"
msg2 "PASSWORD: %s" "${PASSWORD}"
msg2 "ADDGROUPS: %s" "${ADDGROUPS}"
msg2 "SERVICES_LIVE: %s" "${SERVICES_LIVE[*]}"
msg2 "SERVICES: %s" "${SERVICES[*]}"
}
load_profile(){ load_profile(){
local prof="$1" local prof="$1"
local profdir="${DATADIR}/iso-profiles" local profdir="${DATADIR}/iso-profiles"

View File

@@ -105,7 +105,7 @@ run_safe() {
restoretrap=$(trap -p ERR) restoretrap=$(trap -p ERR)
trap 'error_function $func' ERR trap 'error_function $func' ERR
if ${verbose};then if ${log};then
run_log "$func" run_log "$func"
else else
"$func" "$func"
@@ -316,7 +316,6 @@ make_sfs() {
msg2 "Creating ext4 image of %s ..." "${size}" msg2 "Creating ext4 image of %s ..." "${size}"
truncate -s ${size} "${src}.img" truncate -s ${size} "${src}.img"
local ext4_args=() local ext4_args=()
${verbose} && ext4_args+=(-q)
ext4_args+=(-O ^has_journal,^resize_inode -E lazy_itable_init=0 -m 0) ext4_args+=(-O ^has_journal,^resize_inode -E lazy_itable_init=0 -m 0)
mkfs.ext4 ${ext4_args[@]} -F "${src}.img" &>/dev/null mkfs.ext4 ${ext4_args[@]} -F "${src}.img" &>/dev/null
tune2fs -c 0 -i 0 "${src}.img" &> /dev/null tune2fs -c 0 -i 0 "${src}.img" &> /dev/null
@@ -340,11 +339,9 @@ make_sfs() {
local highcomp="-b 256K -Xbcj x86" comp='xz' local highcomp="-b 256K -Xbcj x86" comp='xz'
mksfs_args+=(-comp ${comp} ${highcomp}) mksfs_args+=(-comp ${comp} ${highcomp})
if ${verbose};then
mksquashfs "${mksfs_args[@]}" >/dev/null
else
mksquashfs "${mksfs_args[@]}" mksquashfs "${mksfs_args[@]}"
fi
make_checksum "${dest}" "${name}" make_checksum "${dest}" "${name}"
${persist} && rm "${src}.img" ${persist} && rm "${src}.img"

View File

@@ -125,6 +125,16 @@ get_pkg_org(){
esac esac
} }
pkgver_equal() {
if [[ $1 = *-* && $2 = *-* ]]; then
# if both versions have a pkgrel, then they must be an exact match
[[ $1 = "$2" ]]
else
# otherwise, trim any pkgrel and compare the bare version.
[[ ${1%%-*} = "${2%%-*}" ]]
fi
}
find_cached_package() { find_cached_package() {
local searchdirs=("$PKGDEST" "$PWD") results=() local searchdirs=("$PKGDEST" "$PWD") results=()
local targetname=$1 targetver=$2 targetarch=$3 local targetname=$1 targetver=$2 targetarch=$3

View File

@@ -155,23 +155,13 @@ load_user_info(){
prepare_dir "${AT_USERCONFDIR}" prepare_dir "${AT_USERCONFDIR}"
} }
show_version(){ # orig_argv=("$0" "$@")
msg "ARTOOLS"
msg2 "VERSION: %s" "${VERSION}"
}
show_config(){
if [[ -f ${AT_USERCONFDIR}/artools.conf ]]; then
msg2 "config: %s" "~/.config/artools/artools.conf"
else
msg2 "config: %s" "${ARTOOLS_CONF}"
fi
}
check_root() { check_root() {
local keepenv=$1
(( EUID == 0 )) && return (( EUID == 0 )) && return
if type -P sudo >/dev/null; then if type -P sudo >/dev/null; then
exec sudo -- "${orig_argv[@]}" exec sudo --preserve-env=$keepenv -- "${orig_argv[@]}"
else else
exec su root -c "$(printf ' %q' "${orig_argv[@]}")" exec su root -c "$(printf ' %q' "${orig_argv[@]}")"
fi fi