Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
c2fd4636a3 | |||
a82b704c2b | |||
1aa6a644b0 | |||
ff3ea53482 | |||
d0e3c4e421 | |||
1659689e71 |
37
Makefile
37
Makefile
@@ -1,6 +1,6 @@
|
||||
VERSION=0.10
|
||||
VERSION=0.11
|
||||
|
||||
CHROOT_VERSION=0.8
|
||||
CHROOT_VERSION=0.9
|
||||
|
||||
TOOLS = artools
|
||||
PREFIX ?= /usr/local
|
||||
@@ -40,7 +40,8 @@ BIN_PKG = \
|
||||
bin/buildpkg \
|
||||
bin/buildtree \
|
||||
bin/deploypkg \
|
||||
bin/commitpkg
|
||||
bin/commitpkg \
|
||||
bin/pkg2yaml
|
||||
|
||||
LIBS_PKG = \
|
||||
$(wildcard lib/util-pkg*.sh)
|
||||
@@ -63,11 +64,35 @@ COMMITPKG_SYMS = \
|
||||
multilib-testingpkg \
|
||||
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/buildiso \
|
||||
bin/deployiso
|
||||
|
||||
BIN_ISO_SYMS = \
|
||||
BUILDISO_SYMS = \
|
||||
buildiso-gremlins \
|
||||
buildiso-goblins
|
||||
|
||||
@@ -125,6 +150,8 @@ install_pkg:
|
||||
$(LN) find-libdeps $(DESTDIR)$(BINDIR)/find-libprovides
|
||||
|
||||
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 $(FILEMODE) $(LIBS_PKG) $(DESTDIR)$(LIBDIR)/$(TOOLS)
|
||||
@@ -141,7 +168,7 @@ install_iso: install_cpio
|
||||
install $(DIRMODE) $(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 $(FILEMODE) $(LIBS_ISO) $(DESTDIR)$(LIBDIR)/$(TOOLS)
|
||||
|
@@ -50,29 +50,15 @@ select_os(){
|
||||
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_config "${AT_USERCONFDIR}/artools.conf" || load_config "${SYSCONFDIR}/artools.conf"
|
||||
|
||||
automount=false
|
||||
pretend=false
|
||||
|
||||
usage() {
|
||||
echo "usage: ${0##*/} -a [or] ${0##*/} chroot-dir [command]"
|
||||
echo ' -a Automount detected linux system'
|
||||
echo ' -q Query settings and pretend'
|
||||
echo ' -h Print this help message'
|
||||
echo ''
|
||||
echo " If 'command' is unspecified, ${0##*/} will launch /bin/sh."
|
||||
@@ -86,12 +72,11 @@ usage() {
|
||||
|
||||
orig_argv=("$0" "$@")
|
||||
|
||||
opts=':haq'
|
||||
opts=':ha'
|
||||
|
||||
while getopts ${opts} arg; do
|
||||
case "${arg}" in
|
||||
a) automount=true ;;
|
||||
q) pretend=true ;;
|
||||
h|?) usage 0 ;;
|
||||
*) echo "invalid argument ${arg}"; usage 1 ;;
|
||||
esac
|
||||
@@ -104,8 +89,6 @@ if ${automount};then
|
||||
chrootdir=/mnt
|
||||
run_args=/bin/bash
|
||||
|
||||
${pretend} && display_settings && exit 1
|
||||
|
||||
select_os "${chrootdir}"
|
||||
else
|
||||
chrootdir=$1
|
||||
@@ -114,8 +97,6 @@ else
|
||||
|
||||
[[ -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_add_resolv_conf "${chrootdir}"
|
||||
fi
|
||||
|
@@ -35,9 +35,6 @@ create_min_fs(){
|
||||
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
|
||||
|
@@ -49,34 +49,11 @@ prepare_build(){
|
||||
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(){
|
||||
show_version
|
||||
show_config
|
||||
|
||||
msg "OPTIONS:"
|
||||
msg2 "PROFILE: %s" "${PROFILE}"
|
||||
msg2 "INITSYS: %s" "${INITSYS}"
|
||||
[[ -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:"
|
||||
msg2 "ISO_VERSION: %s" "${ISO_VERSION}"
|
||||
@@ -104,13 +81,13 @@ build(){
|
||||
fi
|
||||
|
||||
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
|
||||
exit 1
|
||||
fi
|
||||
if ${images_only}; then
|
||||
prepare_images
|
||||
warning "Continue compress: buildiso -p %s -zc ..." "${PROFILE}"
|
||||
warning "Continue compress: %s -p %s -zc ..." "${cmd}" "${PROFILE}"
|
||||
exit 1
|
||||
else
|
||||
prepare_images
|
||||
@@ -128,7 +105,7 @@ clean_first=true
|
||||
pretend=false
|
||||
images_only=false
|
||||
iso_only=false
|
||||
verbose=false
|
||||
log=false
|
||||
persist=false
|
||||
|
||||
mkchroot_args=()
|
||||
@@ -137,7 +114,7 @@ cmd=${0##*/}
|
||||
REPOSITORY=${cmd##*-}
|
||||
|
||||
usage() {
|
||||
echo "Usage: ${0##*/} [options]"
|
||||
echo "Usage: ${cmd} [options]"
|
||||
echo " -p <profile> Profile [default: ${PROFILE}]"
|
||||
echo ' -r <dir> Chroots directory'
|
||||
echo " [default: ${CHROOTS_ISO}]"
|
||||
@@ -152,7 +129,7 @@ usage() {
|
||||
echo ' -x Build images only'
|
||||
echo ' -z Generate iso only'
|
||||
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 ' -h This help'
|
||||
echo ''
|
||||
@@ -162,7 +139,7 @@ usage() {
|
||||
|
||||
orig_argv=("$0" "$@")
|
||||
|
||||
opts='p:r:t:i:g:czxmvqh'
|
||||
opts='p:r:t:i:g:czxmlqh'
|
||||
|
||||
while getopts "${opts}" arg; do
|
||||
case "${arg}" in
|
||||
@@ -175,7 +152,7 @@ while getopts "${opts}" arg; do
|
||||
x) images_only=true ;;
|
||||
z) iso_only=true ;;
|
||||
m) persist=true ;;
|
||||
v) verbose=true ;;
|
||||
l) log=true ;;
|
||||
q) pretend=true ;;
|
||||
h|?) usage 0 ;;
|
||||
*) echo "invalid argument '${arg}'"; usage 1 ;;
|
||||
|
138
bin/buildpkg.in
138
bin/buildpkg.in
@@ -11,122 +11,66 @@
|
||||
|
||||
VERSION=@version@
|
||||
|
||||
shopt -s nullglob
|
||||
|
||||
LIBDIR='@libdir@'
|
||||
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
|
||||
}
|
||||
[[ -r @libdir@/util-msg.sh ]] && source @libdir@/util-msg.sh
|
||||
import @libdir@/util.sh
|
||||
import @libdir@/util-chroot.sh
|
||||
|
||||
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
|
||||
pretend=false
|
||||
|
||||
mkchroot_args=()
|
||||
mkchrootpkg_args=(-c -n)
|
||||
|
||||
REPOSITORY='default'
|
||||
cmd=${0##*/}
|
||||
repo=${cmd#*-}
|
||||
base_devel=('base-devel')
|
||||
|
||||
prepare_build(){
|
||||
local pac_file= mp_file='makepkg.conf'
|
||||
case ${repo} in
|
||||
system|world|galaxy) repo='default' ;;
|
||||
lib32*) base_devel+=('multilib-devel') ;;
|
||||
galaxy-gremlins|galaxy-goblins) repo=${repo#*-} ;;
|
||||
esac
|
||||
|
||||
base_devel=('base-devel')
|
||||
pacman_conf="/usr/share/artools/pacman-${repo}.conf"
|
||||
[[ -f $AT_USERCONFDIR/pacman-${repo}.conf ]] && pacman_conf="$AT_USERCONFDIR/pacman-${repo}.conf"
|
||||
|
||||
case ${REPOSITORY} in
|
||||
'system'|'world'|'galaxy') REPOSITORY='default' ;;
|
||||
lib32*) base_devel+=('multilib-devel') ;;
|
||||
galaxy-gremlins|galaxy-goblins) REPOSITORY=${REPOSITORY#*-} ;;
|
||||
esac
|
||||
local pac_file="pacman-${REPOSITORY}.conf"
|
||||
|
||||
local pacman_conf="${DATADIR}/$pac_file"
|
||||
[[ -f $AT_USERCONFDIR/$pac_file ]] && pacman_conf="$AT_USERCONFDIR/$pac_file"
|
||||
|
||||
work_dir="${CHROOTS_PKG}/${REPOSITORY}-${ARCH}"
|
||||
|
||||
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}"
|
||||
}
|
||||
makepkg_conf="/usr/share/artools/makepkg.conf"
|
||||
[[ -f $AT_USERCONFDIR/makepkg.conf ]] && makepkg_conf="$AT_USERCONFDIR/makepkg.conf"
|
||||
|
||||
usage() {
|
||||
echo "Usage: ${0##*/} [options] -- [makepkg_args]"
|
||||
echo " -r <dir> Repository [default: ${REPOSITORY}]"
|
||||
echo ' -c Create root chroot'
|
||||
echo ' -q Query settings and pretend build'
|
||||
echo "Usage: ${0##*/} [options] -- [mkchrootpkg_args]"
|
||||
echo " -r <dir> Create chroots in this directory"
|
||||
echo ' -c Recreate the chroot before building'
|
||||
echo ' -h This help'
|
||||
echo ''
|
||||
echo "Default makepkg_args args: ${makepkg_args[*]}"
|
||||
echo "Default mkchrootpkg_args args: ${mkchrootpkg_args[*]}"
|
||||
echo ''
|
||||
exit $1
|
||||
}
|
||||
|
||||
orig_argv=("$0" "$@")
|
||||
|
||||
opts='r:cqh'
|
||||
opts='hc:r'
|
||||
|
||||
while getopts "${opts}" arg; do
|
||||
case "${arg}" in
|
||||
r) REPOSITORY="$OPTARG" ;;
|
||||
r) CHROOTS_PKG="$OPTARG" ;;
|
||||
c) create_first=true ;;
|
||||
q) pretend=true ;;
|
||||
h|?) usage 0 ;;
|
||||
*) echo "invalid argument '%s'" "${arg}"; usage 1 ;;
|
||||
esac
|
||||
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
|
||||
|
||||
if ${create_first} || [[ ! -d ${work_dir}/root ]];then
|
||||
msg "Creating chroot for [%s] (%s)..." "${REPOSITORY}" "${ARCH}"
|
||||
|
||||
for copy in "${work_dir}"/*; do
|
||||
for copy in "${CHROOTS_PKG}/${repo}-${ARCH}"/*; do
|
||||
[[ -d $copy ]] || continue
|
||||
msg2 "Deleting chroot copy '%s'..." "$(basename "${copy}")"
|
||||
|
||||
@@ -137,14 +81,30 @@ if ${create_first} || [[ ! -d ${work_dir}/root ]];then
|
||||
done
|
||||
lock_close 9
|
||||
|
||||
rm -rf --one-file-system "${work_dir}"
|
||||
mkdir -p "${work_dir}"
|
||||
rm -rf --one-file-system "${CHROOTS_PKG}/${repo}-${ARCH}"
|
||||
mkdir -p "${CHROOTS_PKG}/${repo}-${ARCH}"
|
||||
setarch "${ARCH}" mkchroot \
|
||||
"${mkchroot_args[@]}" "${base_devel[@]}" || abort
|
||||
-C "${pacman_conf}" \
|
||||
-M "${makepkg_conf}" \
|
||||
"${CHROOTS_PKG}/${repo}-${ARCH}/root" \
|
||||
"${base_devel[@]}" || abort
|
||||
else
|
||||
lock 9 "${work_dir}/root.lock" "Locking clean chroot"
|
||||
chroot-run "${mkchroot_args[@]}" \
|
||||
lock 9 "${CHROOTS_PKG}/${repo}-${ARCH}/root.lock" "Locking clean chroot"
|
||||
chroot-run \
|
||||
-C "${pacman_conf}" \
|
||||
-M "${makepkg_conf}" \
|
||||
"${CHROOTS_PKG}/${repo}-${ARCH}/root" \
|
||||
pacman -Syu --noconfirm || abort
|
||||
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}"
|
||||
|
@@ -66,6 +66,26 @@ pull_tree_artix(){
|
||||
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(){
|
||||
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
|
||||
}
|
||||
|
||||
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_config "${AT_USERCONFDIR}/artools.conf" || load_config "${SYSCONFDIR}/artools.conf"
|
||||
load_vars "${PAC_USERCONFDIR}/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf"
|
||||
load_vars /etc/makepkg.conf
|
||||
|
||||
pretend=false
|
||||
sync=false
|
||||
sync_arch=true
|
||||
compare=false
|
||||
@@ -275,13 +270,18 @@ downgrades=false
|
||||
artix=false
|
||||
import=false
|
||||
view=false
|
||||
createnew=false
|
||||
|
||||
PACKAGE=''
|
||||
|
||||
tree_names=(packages community)
|
||||
TEAM=${tree_names[0]}
|
||||
|
||||
usage() {
|
||||
echo "Usage: ${0##*/} [options]"
|
||||
echo ' -p <pkg> Package name'
|
||||
echo ' -t <team> Team name (only with -m)'
|
||||
echo " [default: ${TEAM}]"
|
||||
echo " -s Clone or pull repos"
|
||||
echo " -z Don't clone or pull arch repos"
|
||||
echo ' -c Compare packages'
|
||||
@@ -291,9 +291,8 @@ usage() {
|
||||
echo " -y Don't inlcude staging packages"
|
||||
echo ' -x Include unstable kde and gnome'
|
||||
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 ' -q Query settings'
|
||||
echo ' -h This help'
|
||||
echo ''
|
||||
echo ''
|
||||
@@ -302,11 +301,12 @@ usage() {
|
||||
|
||||
orig_argv=("$0" "$@")
|
||||
|
||||
opts='p:csudayizxvqh'
|
||||
opts='p:t:csudayimzxvh'
|
||||
|
||||
while getopts "${opts}" arg; do
|
||||
case "${arg}" in
|
||||
p) PACKAGE="$OPTARG" ;;
|
||||
t) TEAM="$OPTARG" ;;
|
||||
s) sync=true ;;
|
||||
z) sync_arch=false ;;
|
||||
c) compare=true ;;
|
||||
@@ -315,9 +315,9 @@ while getopts "${opts}" arg; do
|
||||
a) artix=true ;;
|
||||
y) staging=false ;;
|
||||
i) import=true ;;
|
||||
m) createnew=true ;;
|
||||
v) view=true ;;
|
||||
x) unstable=true ;;
|
||||
q) pretend=true ;;
|
||||
h|?) usage 0 ;;
|
||||
*) echo "invalid argument '${arg}'"; usage 1 ;;
|
||||
esac
|
||||
@@ -328,8 +328,6 @@ shift $(($OPTIND - 1))
|
||||
prepare_dir "${TREE_DIR_ARTIX}"
|
||||
prepare_dir "${TREE_DIR_ARCH}"
|
||||
|
||||
${pretend} && display_settings && exit 1
|
||||
|
||||
${sync} && sync_repos
|
||||
|
||||
${view} && view_build "${PACKAGE}"
|
||||
@@ -337,3 +335,5 @@ ${view} && view_build "${PACKAGE}"
|
||||
${compare} && show_version_table
|
||||
|
||||
${import} && from_arch "${PACKAGE}"
|
||||
|
||||
${createnew} && mkrepo "${PACKAGE}" "${TEAM}"
|
||||
|
@@ -129,20 +129,6 @@ symlink_commit_pkg(){
|
||||
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_config "${AT_USERCONFDIR}/artools.conf" || load_config "${SYSCONFDIR}/artools.conf"
|
||||
@@ -153,7 +139,6 @@ REPO_SRC='trunk'
|
||||
PACKAGE=''
|
||||
remove=false
|
||||
push=false
|
||||
pretend=false
|
||||
|
||||
cmd=${0##*/}
|
||||
REPO_DEST=${cmd%pkg}
|
||||
@@ -164,7 +149,6 @@ usage() {
|
||||
echo ' -p <pkg> Package name'
|
||||
echo ' -r Delete from repo (commitpkg only)'
|
||||
echo ' -u Push'
|
||||
echo ' -q Query settings and pretend'
|
||||
echo ' -h This help'
|
||||
echo ''
|
||||
echo ''
|
||||
@@ -173,7 +157,7 @@ usage() {
|
||||
|
||||
orig_argv=("$0" "$@")
|
||||
|
||||
opts='p:s:urqh'
|
||||
opts='p:s:urh'
|
||||
|
||||
while getopts "${opts}" arg; do
|
||||
case "${arg}" in
|
||||
@@ -181,7 +165,6 @@ while getopts "${opts}" arg; do
|
||||
p) PACKAGE="$OPTARG" ;;
|
||||
r) remove=true ;;
|
||||
u) push=true ;;
|
||||
q) pretend=true ;;
|
||||
h|?) usage 0 ;;
|
||||
*) echo "invalid argument '${arg}'"; usage 1 ;;
|
||||
esac
|
||||
@@ -189,8 +172,6 @@ done
|
||||
|
||||
shift $(($OPTIND - 1))
|
||||
|
||||
${pretend} && display_settings && exit 1
|
||||
|
||||
if $(is_valid_repo "${REPO_SRC}");then
|
||||
if [[ "${cmd}" == 'commitpkg' ]];then
|
||||
commit_pkg
|
||||
|
@@ -33,31 +33,10 @@ sync_dir(){
|
||||
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_config "${AT_USERCONFDIR}/artools.conf" || load_config "${SYSCONFDIR}/artools.conf"
|
||||
|
||||
pretend=false
|
||||
update=false
|
||||
verbose=false
|
||||
|
||||
@@ -68,7 +47,6 @@ usage() {
|
||||
echo " -p Source folder to upload [default: ${PROFILE}]"
|
||||
echo " -l Limit bandwidth in kB/s [default:${UPLIMIT}]"
|
||||
echo ' -u Update remote directory'
|
||||
echo ' -q Query settings and pretend upload'
|
||||
echo ' -v Verbose output'
|
||||
echo ' -h This help'
|
||||
echo ''
|
||||
@@ -76,7 +54,7 @@ usage() {
|
||||
exit $1
|
||||
}
|
||||
|
||||
opts='p:l:uvqh'
|
||||
opts='p:l:uvh'
|
||||
|
||||
while getopts "${opts}" arg; do
|
||||
case "${arg}" in
|
||||
@@ -84,7 +62,6 @@ while getopts "${opts}" arg; do
|
||||
l) UPLIMIT="$OPTARG" ;;
|
||||
u) update=true; rsync_args+=(-u) ;;
|
||||
v) verbose=true; rsync_args+=(-v --stats) ;;
|
||||
q) pretend=true; rsync_args+=(-n) ;;
|
||||
h|?) usage 0 ;;
|
||||
*) echo "invalid argument '${arg}'"; usage 1 ;;
|
||||
esac
|
||||
@@ -98,6 +75,4 @@ rsync_args+=(--bwlimit=${UPLIMIT})
|
||||
|
||||
prepare_transfer
|
||||
|
||||
${pretend} && display_settings #&& exit 1
|
||||
|
||||
sync_dir
|
||||
|
@@ -11,27 +11,26 @@
|
||||
|
||||
VERSION=@version@
|
||||
|
||||
LIBDIR='@libdir@'
|
||||
SYSCONFDIR='@sysconfdir@'
|
||||
|
||||
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
||||
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(){
|
||||
local repo="$1" pkgfile ver ext=db.tar.xz
|
||||
local repo_path=${REPOS_ROOT}/$repo/os/${ARCH} packages=()
|
||||
|
||||
source PKGBUILD
|
||||
|
||||
for name in ${pkgname[@]};do
|
||||
[[ $arch == any ]] && CARCH=any
|
||||
pkgarch=$(get_pkg_arch "$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##*/}
|
||||
info "Found: %s" "$pkg"
|
||||
if ${add_pkg};then
|
||||
local action='add'
|
||||
packages+=("$pkg")
|
||||
checkpkg "${pkgfile}"
|
||||
# checkpkg "${pkgfile}" || return 2
|
||||
if ${sign_pkg};then
|
||||
[[ -e ${pkgfile}.sig ]] && rm ${pkgfile}.sig
|
||||
signfile ${pkgfile}
|
||||
@@ -50,55 +49,37 @@ update_repo(){
|
||||
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_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 /etc/makepkg.conf
|
||||
|
||||
pretend=false
|
||||
add_pkg=false
|
||||
del_pkg=false
|
||||
REPOSITORY=
|
||||
sign_pkg=false
|
||||
|
||||
cmd=${0##*/}
|
||||
dest_repo=${cmd#*-}
|
||||
|
||||
usage() {
|
||||
echo "Usage: ${0##*/} [options]"
|
||||
echo " -d Destination repository [default:${REPOSITORY}]"
|
||||
echo "Usage: ${cmd} [options]"
|
||||
echo ' -a Add package(s) to repository'
|
||||
echo ' -r Remove package(s) from repository'
|
||||
echo ' -s Sign package(s)'
|
||||
echo ' -q Query settings and pretend upload'
|
||||
echo ' -h This help'
|
||||
echo ''
|
||||
echo ''
|
||||
exit $1
|
||||
}
|
||||
|
||||
orig_argv=("$0" "$@")
|
||||
|
||||
opts='d:arsqh'
|
||||
opts='arsh'
|
||||
|
||||
while getopts "${opts}" arg; do
|
||||
case "${arg}" in
|
||||
d) REPOSITORY="$OPTARG" ;;
|
||||
a) add_pkg=true; del_pkg=false ;;
|
||||
r) del_pkg=true; add_pkg=false ;;
|
||||
s) sign_pkg=true ;;
|
||||
q) pretend=true ;;
|
||||
h|?) usage 0 ;;
|
||||
*) echo "invalid argument '${arg}'"; usage 1 ;;
|
||||
esac
|
||||
@@ -108,6 +89,4 @@ shift $(($OPTIND - 1))
|
||||
|
||||
prepare_dir "${REPOS_ROOT}"
|
||||
|
||||
${pretend} && display_settings && exit 1
|
||||
|
||||
update_repo "${REPOSITORY}"
|
||||
update_repo "${dest_repo}"
|
||||
|
@@ -58,35 +58,39 @@ usage() {
|
||||
exit 1
|
||||
}
|
||||
|
||||
sync_chroot() {
|
||||
local chrootdir=$1
|
||||
local copy=$2
|
||||
local copydir=''
|
||||
if [[ ${copy:0:1} = / ]]; then
|
||||
copydir=$copy
|
||||
else
|
||||
copydir="$chrootdir/$copy"
|
||||
fi
|
||||
# {{{ functions
|
||||
|
||||
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"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Get a read lock on the root chroot to make
|
||||
# sure we don't clone a half-updated chroot
|
||||
slock 8 "$chrootdir/root.lock" \
|
||||
"Locking clean chroot [%s]" "$chrootdir/root"
|
||||
slock 8 "$rootdir.lock" \
|
||||
"Locking clean chroot [%s]" "$rootdir"
|
||||
|
||||
stat_busy "Synchronizing chroot copy [%s] -> [%s]" "$chrootdir/root" "$copydir"
|
||||
if is_btrfs "$chrootdir" && ! mountpoint -q "$copydir"; then
|
||||
subvolume_delete_recursive "$copydir" ||
|
||||
die "Unable to delete subvolume %s" "$copydir"
|
||||
btrfs subvolume snapshot "$chrootdir/root" "$copydir" >/dev/null ||
|
||||
stat_busy "Synchronizing chroot copy [%s] -> [%s]" "$rootdir" "$copy"
|
||||
if is_subvolume "$rootdir" && is_same_fs "$rootdir" "$(dirname -- "$copydir")" && ! mountpoint -q "$copydir"; then
|
||||
if is_subvolume "$copydir"; then
|
||||
subvolume_delete_recursive "$copydir" ||
|
||||
die "Unable to delete subvolume %s" "$copydir"
|
||||
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"
|
||||
else
|
||||
mkdir -p "$copydir"
|
||||
rsync -a --delete -q -W -x "$chrootdir/root/" "$copydir"
|
||||
rsync -a --delete -q -W -x "$rootdir/" "$copydir"
|
||||
fi
|
||||
stat_done
|
||||
|
||||
@@ -103,7 +107,7 @@ delete_chroot() {
|
||||
local copy=${1:-$2}
|
||||
|
||||
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" ||
|
||||
die "Unable to delete subvolume %s" "$copydir"
|
||||
else
|
||||
@@ -128,7 +132,10 @@ install_packages() {
|
||||
pkgnames=("${install_pkgs[@]##*/}")
|
||||
|
||||
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/}"
|
||||
ret=$?
|
||||
rm -- "${pkgnames[@]/#/$copydir/root/}"
|
||||
@@ -148,8 +155,9 @@ prepare_chroot() {
|
||||
|
||||
[[ $keepbuilddir = true ]] || rm -rf "$copydir/build"
|
||||
|
||||
local builduser_uid="${SUDO_UID:-$UID}"
|
||||
local builduser_gid="$(id -g "$builduser_uid")"
|
||||
local builduser_uid builduser_gid
|
||||
builduser_uid="${SUDO_UID:-$UID}"
|
||||
builduser_gid="$(id -g "$builduser_uid")"
|
||||
local install="install -o $builduser_uid -g $builduser_gid"
|
||||
local x
|
||||
|
||||
@@ -157,16 +165,11 @@ prepare_chroot() {
|
||||
# which we might not be able to load (i.e. when building i686 packages on
|
||||
# an x86_64 host).
|
||||
sed -e '/^builduser:/d' -i "$copydir"/etc/{passwd,shadow,group}
|
||||
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/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/shadow" 'builduser:!!:%d::::::\n' "$(( $(date -u +%s) / 86400 ))"
|
||||
|
||||
$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
|
||||
$install -d "$copydir"/{build,startdir,{pkg,srcpkg,src,log}dest}
|
||||
|
||||
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 \
|
||||
@@ -203,19 +206,22 @@ _chrootbuild() {
|
||||
# No coredumps
|
||||
ulimit -c 0
|
||||
|
||||
# Work around chroot-run not giving a ctty
|
||||
#exec </dev/console
|
||||
. /etc/locale.conf
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
. /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 "$@"
|
||||
|
||||
ret=$?
|
||||
case $ret in
|
||||
0|14) return 0;;
|
||||
*) return $ret;;
|
||||
0|14)
|
||||
return 0;;
|
||||
*)
|
||||
return $ret;;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -227,17 +233,15 @@ _chrootnamcap() {
|
||||
done
|
||||
}
|
||||
|
||||
# Usage: download_sources $copydir $src_owner
|
||||
# Usage: download_sources $copydir $makepkg_user
|
||||
# Globals:
|
||||
# - SRCDEST
|
||||
# - USER
|
||||
download_sources() {
|
||||
local copydir=$1
|
||||
local makepkg_user=$2
|
||||
|
||||
local builddir
|
||||
builddir="$(mktemp -d)"
|
||||
# chmod 1777 "$builddir"
|
||||
chown "$makepkg_user:" "$builddir"
|
||||
|
||||
# Ensure sources are downloaded
|
||||
@@ -254,6 +258,7 @@ download_sources() {
|
||||
# Globals:
|
||||
# - PKGDEST
|
||||
# - LOGDEST
|
||||
# - SRCPKGDEST
|
||||
move_products() {
|
||||
local copydir=$1
|
||||
local src_owner=$2
|
||||
@@ -301,8 +306,8 @@ main() {
|
||||
chrootdir=
|
||||
passeddir=
|
||||
makepkg_user=
|
||||
declare -ga install_pkgs
|
||||
declare -gi ret=0
|
||||
declare -a install_pkgs
|
||||
declare -i ret=0
|
||||
|
||||
bindmounts_ro=()
|
||||
bindmounts_rw=()
|
||||
@@ -314,7 +319,7 @@ main() {
|
||||
|
||||
local opts='hcur:I:l:nTD:d:U:'
|
||||
|
||||
while getopts ${opts} arg; do
|
||||
while getopts "${opts}" arg; do
|
||||
case "$arg" in
|
||||
c) clean_first=true ;;
|
||||
D) bindmounts_ro+=("$OPTARG") ;;
|
||||
@@ -364,7 +369,7 @@ main() {
|
||||
|
||||
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
|
||||
|
||||
# Use PKGBUILD directory if these don't exist
|
||||
@@ -377,11 +382,14 @@ main() {
|
||||
lock 9 "$copydir.lock" "Locking chroot copy [%s]" "$copy"
|
||||
|
||||
if [[ ! -d $copydir ]] || $clean_first; then
|
||||
sync_chroot "$chrootdir" "$copy"
|
||||
sync_chroot "$chrootdir/root" "$copydir" "$copy"
|
||||
fi
|
||||
|
||||
$update_first && chroot-run -r "${bindmounts_ro[*]}" -w "${bindmounts_rw[*]}" "$copydir" \
|
||||
pacman -Syu --noconfirm
|
||||
$update_first && chroot-run \
|
||||
-r "${bindmounts_ro[@]}" \
|
||||
-w "${bindmounts_rw[@]}" \
|
||||
"$copydir" \
|
||||
pacman -Syu --noconfirm
|
||||
|
||||
if [[ -n ${install_pkgs[*]:-} ]]; then
|
||||
install_packages "$copydir" "${install_pkgs[@]}"
|
||||
@@ -395,14 +403,18 @@ main() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
download_sources "$copydir" "$src_owner"
|
||||
download_sources "$copydir" "$makepkg_user"
|
||||
|
||||
prepare_chroot "$copydir" "$USER_HOME" "$keepbuilddir" "$run_namcap"
|
||||
|
||||
bindmounts_rw+=("${PWD}:/startdir" "${SRCDEST}:/srcdest")
|
||||
|
||||
if chroot-run -r "${bindmounts_ro[*]}" -w "${bindmounts_rw[*]}" "$copydir" \
|
||||
/chrootbuild "${makepkg_args[@]}"; then
|
||||
if chroot-run \
|
||||
-r "${bindmounts_ro[*]}" \
|
||||
-w "${bindmounts_rw[*]}" \
|
||||
"$copydir" \
|
||||
/chrootbuild "${makepkg_args[@]}"
|
||||
then
|
||||
move_products "$copydir" "$src_owner"
|
||||
else
|
||||
(( ret += 1 ))
|
||||
|
44
bin/pkg2yaml.in
Normal file
44
bin/pkg2yaml.in
Normal 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}"
|
@@ -9,20 +9,31 @@
|
||||
# GNU General Public License for more details.
|
||||
|
||||
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() {
|
||||
local subvol
|
||||
|
||||
is_btrfs "$1" || return 0
|
||||
is_subvolume "$1" || return 0
|
||||
|
||||
while IFS= read -d $'\0' -r subvol; do
|
||||
if ! btrfs subvolume delete "$subvol" &>/dev/null; then
|
||||
error "Unable to delete subvolume %s" "$subvol"
|
||||
if ! subvolume_delete_recursive "$subvol"; then
|
||||
return 1
|
||||
fi
|
||||
done < <(find "$1" -xdev -depth -inum 256 -print0)
|
||||
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"
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
@@ -26,6 +26,17 @@ init_profile(){
|
||||
[[ -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(){
|
||||
local prof="$1"
|
||||
local profdir="${DATADIR}/iso-profiles"
|
||||
|
@@ -105,7 +105,7 @@ run_safe() {
|
||||
restoretrap=$(trap -p ERR)
|
||||
trap 'error_function $func' ERR
|
||||
|
||||
if ${verbose};then
|
||||
if ${log};then
|
||||
run_log "$func"
|
||||
else
|
||||
"$func"
|
||||
@@ -316,7 +316,6 @@ make_sfs() {
|
||||
msg2 "Creating ext4 image of %s ..." "${size}"
|
||||
truncate -s ${size} "${src}.img"
|
||||
local ext4_args=()
|
||||
${verbose} && ext4_args+=(-q)
|
||||
ext4_args+=(-O ^has_journal,^resize_inode -E lazy_itable_init=0 -m 0)
|
||||
mkfs.ext4 ${ext4_args[@]} -F "${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'
|
||||
|
||||
mksfs_args+=(-comp ${comp} ${highcomp})
|
||||
if ${verbose};then
|
||||
mksquashfs "${mksfs_args[@]}" >/dev/null
|
||||
else
|
||||
mksquashfs "${mksfs_args[@]}"
|
||||
fi
|
||||
|
||||
mksquashfs "${mksfs_args[@]}"
|
||||
|
||||
make_checksum "${dest}" "${name}"
|
||||
${persist} && rm "${src}.img"
|
||||
|
||||
|
@@ -125,6 +125,16 @@ get_pkg_org(){
|
||||
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() {
|
||||
local searchdirs=("$PKGDEST" "$PWD") results=()
|
||||
local targetname=$1 targetver=$2 targetarch=$3
|
||||
|
18
lib/util.sh
18
lib/util.sh
@@ -155,23 +155,13 @@ load_user_info(){
|
||||
prepare_dir "${AT_USERCONFDIR}"
|
||||
}
|
||||
|
||||
show_version(){
|
||||
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
|
||||
}
|
||||
|
||||
# orig_argv=("$0" "$@")
|
||||
check_root() {
|
||||
local keepenv=$1
|
||||
|
||||
(( EUID == 0 )) && return
|
||||
if type -P sudo >/dev/null; then
|
||||
exec sudo -- "${orig_argv[@]}"
|
||||
exec sudo --preserve-env=$keepenv -- "${orig_argv[@]}"
|
||||
else
|
||||
exec su root -c "$(printf ' %q' "${orig_argv[@]}")"
|
||||
fi
|
||||
|
Reference in New Issue
Block a user