Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 04d3472173 | |||
| 117e0d2f55 | |||
| 4dc7aa8e65 | |||
| 2fc3044e40 | |||
| 77e6e9dfb4 |
29
Makefile
29
Makefile
@@ -1,6 +1,6 @@
|
|||||||
VERSION=0.15
|
VERSION=0.14
|
||||||
|
|
||||||
CHROOT_VERSION=0.10
|
CHROOT_VERSION=0.9
|
||||||
|
|
||||||
TOOLS = artools
|
TOOLS = artools
|
||||||
PREFIX ?= /usr
|
PREFIX ?= /usr
|
||||||
@@ -8,7 +8,6 @@ SYSCONFDIR = /etc
|
|||||||
BINDIR = $(PREFIX)/bin
|
BINDIR = $(PREFIX)/bin
|
||||||
LIBDIR = $(PREFIX)/lib
|
LIBDIR = $(PREFIX)/lib
|
||||||
DATADIR = $(PREFIX)/share
|
DATADIR = $(PREFIX)/share
|
||||||
CPIODIR = $(SYSCONFDIR)/initcpio
|
|
||||||
|
|
||||||
CONF = \
|
CONF = \
|
||||||
data/artools.conf
|
data/artools.conf
|
||||||
@@ -38,10 +37,7 @@ PKG_BIN = \
|
|||||||
bin/pkg/pkg2yaml \
|
bin/pkg/pkg2yaml \
|
||||||
bin/pkg/buildtree \
|
bin/pkg/buildtree \
|
||||||
bin/pkg/lddd \
|
bin/pkg/lddd \
|
||||||
bin/pkg/links-add \
|
bin/pkg/links-add
|
||||||
bin/pkg/checkpkg \
|
|
||||||
bin/pkg/finddeps \
|
|
||||||
bin/pkg/find-libdeps
|
|
||||||
|
|
||||||
LN_COMMITPKG = \
|
LN_COMMITPKG = \
|
||||||
extrapkg \
|
extrapkg \
|
||||||
@@ -88,6 +84,9 @@ LN_DEPLOYPKG = \
|
|||||||
PKG_LIBS = \
|
PKG_LIBS = \
|
||||||
$(wildcard lib/pkg/*)
|
$(wildcard lib/pkg/*)
|
||||||
|
|
||||||
|
PKG_LISTS = \
|
||||||
|
$(wildcard data/pkglists/*.list)
|
||||||
|
|
||||||
PKG_UTIL = lib/util-pkg.sh
|
PKG_UTIL = lib/util-pkg.sh
|
||||||
|
|
||||||
PKG_DATA = \
|
PKG_DATA = \
|
||||||
@@ -109,8 +108,8 @@ ISO_LIBS = \
|
|||||||
|
|
||||||
ISO_UTIL = lib/util-iso.sh
|
ISO_UTIL = lib/util-iso.sh
|
||||||
|
|
||||||
ISO_DATA = \
|
DRACUT = \
|
||||||
data/iso/mkinitcpio.conf
|
data/dracut.conf
|
||||||
|
|
||||||
DIRMODE = -dm0755
|
DIRMODE = -dm0755
|
||||||
FILEMODE = -m0644
|
FILEMODE = -m0644
|
||||||
@@ -167,8 +166,6 @@ install_pkg:
|
|||||||
install $(DIRMODE) $(DESTDIR)$(BINDIR)
|
install $(DIRMODE) $(DESTDIR)$(BINDIR)
|
||||||
install $(MODE) $(PKG_BIN) $(DESTDIR)$(BINDIR)
|
install $(MODE) $(PKG_BIN) $(DESTDIR)$(BINDIR)
|
||||||
|
|
||||||
$(LN) find-libdeps $(DESTDIR)$(BINDIR)/find-libprovides
|
|
||||||
|
|
||||||
$(LN) links-add $(DESTDIR)$(BINDIR)/links-remove
|
$(LN) links-add $(DESTDIR)$(BINDIR)/links-remove
|
||||||
|
|
||||||
for l in $(LN_COMMITPKG); do $(LN) commitpkg $(DESTDIR)$(BINDIR)/$$l; done
|
for l in $(LN_COMMITPKG); do $(LN) commitpkg $(DESTDIR)$(BINDIR)/$$l; done
|
||||||
@@ -185,10 +182,10 @@ install_pkg:
|
|||||||
install $(DIRMODE) $(DESTDIR)$(DATADIR)/$(TOOLS)/patches
|
install $(DIRMODE) $(DESTDIR)$(DATADIR)/$(TOOLS)/patches
|
||||||
install $(FILEMODE) $(PATCHES) $(DESTDIR)$(DATADIR)/$(TOOLS)/patches
|
install $(FILEMODE) $(PATCHES) $(DESTDIR)$(DATADIR)/$(TOOLS)/patches
|
||||||
|
|
||||||
install_cpio:
|
install $(DIRMODE) $(DESTDIR)$(DATADIR)/$(TOOLS)/pkglists
|
||||||
+make CPIODIR=$(CPIODIR) DESTDIR=$(DESTDIR) -C initcpio install
|
install $(FILEMODE) $(PKG_LISTS) $(DESTDIR)$(DATADIR)/$(TOOLS)/pkglists
|
||||||
|
|
||||||
install_iso: install_cpio
|
install_iso:
|
||||||
install $(DIRMODE) $(DESTDIR)$(BINDIR)
|
install $(DIRMODE) $(DESTDIR)$(BINDIR)
|
||||||
install $(MODE) $(ISO_BIN) $(DESTDIR)$(BINDIR)
|
install $(MODE) $(ISO_BIN) $(DESTDIR)$(BINDIR)
|
||||||
|
|
||||||
@@ -198,8 +195,8 @@ install_iso: install_cpio
|
|||||||
install $(FILEMODE) $(ISO_UTIL) $(DESTDIR)$(LIBDIR)/$(TOOLS)
|
install $(FILEMODE) $(ISO_UTIL) $(DESTDIR)$(LIBDIR)/$(TOOLS)
|
||||||
install $(FILEMODE) $(ISO_LIBS) $(DESTDIR)$(LIBDIR)/$(TOOLS)/iso
|
install $(FILEMODE) $(ISO_LIBS) $(DESTDIR)$(LIBDIR)/$(TOOLS)/iso
|
||||||
|
|
||||||
install $(DIRMODE) $(DESTDIR)$(DATADIR)/$(TOOLS)
|
install $(DIRMODE) $(DESTDIR)$(SYSCONFDIR)/dracut.cond.d
|
||||||
install $(FILEMODE) $(ISO_DATA) $(DESTDIR)$(DATADIR)/$(TOOLS)
|
install $(FILEMODE) $(DRACUT) $(DESTDIR)$(SYSCONFDIR)/dracut.cond.d/90-artix-live.conf
|
||||||
|
|
||||||
install: install_base install_pkg install_iso
|
install: install_base install_pkg install_iso
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ artools
|
|||||||
* dosfstools
|
* dosfstools
|
||||||
* libisoburn
|
* libisoburn
|
||||||
* squashfs-tools
|
* squashfs-tools
|
||||||
* mkinitcpio
|
* dracut
|
||||||
* grub
|
* grub
|
||||||
|
|
||||||
#### Configuration
|
#### Configuration
|
||||||
|
|||||||
@@ -36,16 +36,18 @@ copy_keyring(){
|
|||||||
|
|
||||||
create_min_fs(){
|
create_min_fs(){
|
||||||
msg "Creating install root at %s" "$1"
|
msg "Creating install root at %s" "$1"
|
||||||
mkdir -m 0755 -p $1/var/{cache/pacman/pkg,lib/pacman,log} $1/{dev,run,etc/pacman.d}
|
mkdir -m 0755 -p $1/var/{cache/pacman/pkg,lib/pacman,log} $1/{dev,etc}
|
||||||
mkdir -m 1777 -p $1/tmp
|
mkdir -m 1777 -p $1/{tmp,run}
|
||||||
mkdir -m 0555 -p $1/{sys,proc}
|
mkdir -m 0555 -p $1/{sys,proc}
|
||||||
}
|
}
|
||||||
|
|
||||||
newroot=/mnt
|
newroot=/mnt
|
||||||
|
|
||||||
hostcache=0
|
hostcache=false
|
||||||
copykeyring=1
|
copykeyring=true
|
||||||
copymirrorlist=1
|
copymirrorlist=true
|
||||||
|
directory=false
|
||||||
|
interactive=false
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "usage: ${0##*/} [options] root [packages...]"
|
echo "usage: ${0##*/} [options] root [packages...]"
|
||||||
@@ -70,10 +72,10 @@ opts=':C:cGiM'
|
|||||||
while getopts ${opts} arg; do
|
while getopts ${opts} arg; do
|
||||||
case "${arg}" in
|
case "${arg}" in
|
||||||
C) pacman_conf=$OPTARG ;;
|
C) pacman_conf=$OPTARG ;;
|
||||||
c) hostcache=1 ;;
|
c) hostcache=true ;;
|
||||||
i) interactive=1 ;;
|
i) interactive=true ;;
|
||||||
G) copykeyring=0 ;;
|
G) copykeyring=false ;;
|
||||||
M) copymirrorlist=0 ;;
|
M) copymirrorlist=false ;;
|
||||||
:) echo "invalid argument ${arg}:$OPTARG"; usage 1;;
|
:) echo "invalid argument ${arg}:$OPTARG"; usage 1;;
|
||||||
?) usage 0 ;;
|
?) usage 0 ;;
|
||||||
esac
|
esac
|
||||||
@@ -86,13 +88,9 @@ check_root
|
|||||||
newroot=$1; shift
|
newroot=$1; shift
|
||||||
pacman_args=("${@:-base}")
|
pacman_args=("${@:-base}")
|
||||||
|
|
||||||
if (( ! hostcache ));then
|
${hostcache} || pacman_args+=(--cachedir="$newroot/var/cache/pacman/pkg")
|
||||||
pacman_args+=(--cachedir="$newroot/var/cache/pacman/pkg")
|
|
||||||
fi
|
|
||||||
|
|
||||||
if (( ! interactive )); then
|
${interactive} || pacman_args+=(--noconfirm)
|
||||||
pacman_args+=(--noconfirm)
|
|
||||||
fi
|
|
||||||
|
|
||||||
[[ -n $pacman_conf ]] && pacman_args+=(--config="$pacman_conf")
|
[[ -n $pacman_conf ]] && pacman_args+=(--config="$pacman_conf")
|
||||||
|
|
||||||
@@ -104,16 +102,15 @@ create_min_fs "$newroot"
|
|||||||
# mount API filesystems
|
# mount API filesystems
|
||||||
chroot_api_mount "$newroot" || die "failed to setup API filesystems in new root"
|
chroot_api_mount "$newroot" || die "failed to setup API filesystems in new root"
|
||||||
|
|
||||||
if (( copykeyring ));then
|
|
||||||
copy_keyring "$newroot"
|
|
||||||
fi
|
|
||||||
|
|
||||||
msg2 'Installing packages to %s' "$newroot"
|
msg2 'Installing packages to %s' "$newroot"
|
||||||
if ! pacman -r "$newroot" -Sy "${pacman_args[@]}"; then
|
if ! pacman -r "$newroot" -Sy "${pacman_args[@]}"; then
|
||||||
die 'Failed to install packages to new root'
|
die 'Failed to install packages to new root'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if ${copykeyring};then
|
||||||
|
copy_keyring "$newroot"
|
||||||
|
fi
|
||||||
|
|
||||||
if (( copymirrorlist ));then
|
if ${copymirrorlist};then
|
||||||
copy_mirrorlist "$newroot"
|
copy_mirrorlist "$newroot"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -16,12 +16,9 @@ chroot_version=0.9
|
|||||||
|
|
||||||
. @libdir@/artools/util-base.sh
|
. @libdir@/artools/util-base.sh
|
||||||
|
|
||||||
# umask might have been changed in /etc/profile
|
|
||||||
# ensure that sane default is set again
|
|
||||||
umask 0022
|
|
||||||
|
|
||||||
working_dir=''
|
working_dir=''
|
||||||
files=()
|
files=()
|
||||||
|
nosetarch=false
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "Usage: ${0##*/} [options] working-dir [run arguments]"
|
echo "Usage: ${0##*/} [options] working-dir [run arguments]"
|
||||||
@@ -48,9 +45,9 @@ while getopts ${opts} arg; do
|
|||||||
case "${arg}" in
|
case "${arg}" in
|
||||||
C) pacman_conf="$OPTARG" ;;
|
C) pacman_conf="$OPTARG" ;;
|
||||||
M) makepkg_conf="$OPTARG" ;;
|
M) makepkg_conf="$OPTARG" ;;
|
||||||
c) cache_dirs+=("$OPTARG") ;;
|
c) cache_dir="$OPTARG" ;;
|
||||||
f) files+=("$OPTARG") ;;
|
f) files+=("$OPTARG") ;;
|
||||||
s) nosetarch=1 ;;
|
s) nosetarch=true ;;
|
||||||
r) bindmounts_ro=("$OPTARG") ;;
|
r) bindmounts_ro=("$OPTARG") ;;
|
||||||
w) bindmounts_rw=("$OPTARG") ;;
|
w) bindmounts_rw=("$OPTARG") ;;
|
||||||
h|?) usage ;;
|
h|?) usage ;;
|
||||||
@@ -68,30 +65,17 @@ shift 1
|
|||||||
|
|
||||||
[[ -z $working_dir ]] && die 'Please specify a working directory.'
|
[[ -z $working_dir ]] && die 'Please specify a working directory.'
|
||||||
|
|
||||||
pacconf_cmd=$(command -v pacman-conf || command -v pacconf)
|
if [[ -z $cache_dir ]]; then
|
||||||
|
cache_dirs=($(pacman -v 2>&1 | grep '^Cache Dirs:' | sed 's/Cache Dirs:\s*//g'))
|
||||||
if (( ${#cache_dirs[@]} == 0 )); then
|
else
|
||||||
mapfile -t cache_dirs < <($pacconf_cmd --config "${pac_conf:-$working_dir/etc/pacman.conf}" CacheDir)
|
cache_dirs=("$cache_dir")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
pacconf_cmd=$(command -v pacman-conf || command -v pacconf)
|
||||||
host_mirrors=($($pacconf_cmd --repo world Server 2> /dev/null | sed -r 's#(.*/)world/os/.*#\1$repo/os/$arch#'))
|
host_mirrors=($($pacconf_cmd --repo world Server 2> /dev/null | sed -r 's#(.*/)world/os/.*#\1$repo/os/$arch#'))
|
||||||
|
|
||||||
while read -r line; do
|
|
||||||
mapfile -t lines < <($pacconf_cmd --config "${pac_conf:-$working_dir/etc/pacman.conf}" \
|
|
||||||
--repo $line Server | sed -r 's#(.*/)[^/]+/os/.+#\1$repo/os/$arch#')
|
|
||||||
if [[ ${lines[0]} != ${host_mirrors[0]} ]]; then
|
|
||||||
for line in "${lines[@]}"; do
|
|
||||||
if [[ $line = file://* ]]; then
|
|
||||||
line=${line#file://}
|
|
||||||
in_array "$line" "${cache_dirs[@]}" || cache_dirs+=("$line")
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
done < <($pacconf_cmd --config "${pac_conf:-$working_dir/etc/pacman.conf}" --repo-list)
|
|
||||||
|
|
||||||
copy_hostconf () {
|
copy_hostconf () {
|
||||||
unshare --fork --pid gpg --homedir "$working_dir"/etc/pacman.d/gnupg/ --no-permission-warning --quiet --batch --import --import-options import-local-sigs "$(pacman-conf GpgDir)"/pubring.gpg >/dev/null 2>&1
|
cp -a /etc/pacman.d/gnupg "$1/etc/pacman.d"
|
||||||
pacman-key --gpgdir "$working_dir"/etc/pacman.d/gnupg/ --import-trustdb "$(pacman-conf GpgDir)" >/dev/null 2>&1
|
|
||||||
|
|
||||||
printf 'Server = %s\n' "${host_mirrors[@]}" >"$working_dir/etc/pacman.d/mirrorlist"
|
printf 'Server = %s\n' "${host_mirrors[@]}" >"$working_dir/etc/pacman.d/mirrorlist"
|
||||||
|
|
||||||
@@ -111,11 +95,8 @@ copy_hostconf () {
|
|||||||
chroot_extra_mount() {
|
chroot_extra_mount() {
|
||||||
chroot_add_resolv_conf "$1"
|
chroot_add_resolv_conf "$1"
|
||||||
chroot_mount "/etc/hosts" "$1/etc/hosts" -B
|
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 "${cache_dirs[0]}" "$1${cache_dirs[0]}" -B
|
chroot_mount "${cache_dirs[0]}" "$1${cache_dirs[0]}" -B
|
||||||
# if [[ -e /etc/localtime ]];then
|
|
||||||
# [[ -e $1/etc/localtime ]] || touch $1/etc/localtime
|
|
||||||
# chroot_mount "/etc/localtime" "$1/etc/localtime" -B
|
|
||||||
# fi
|
|
||||||
|
|
||||||
for cache_dir in ${cache_dirs[@]:1}; do
|
for cache_dir in ${cache_dirs[@]:1}; do
|
||||||
chroot_mount "$cache_dir" "$1${cache_dir}" -Br
|
chroot_mount "$cache_dir" "$1${cache_dir}" -Br
|
||||||
@@ -154,7 +135,7 @@ copy_hostconf "${working_dir}"
|
|||||||
|
|
||||||
eval $(grep '^CARCH=' "$working_dir/etc/makepkg.conf")
|
eval $(grep '^CARCH=' "$working_dir/etc/makepkg.conf")
|
||||||
|
|
||||||
[[ -z $nosetarch ]] || unset CARCH
|
${nosetarch} && unset CARCH
|
||||||
|
|
||||||
${CARCH:+setarch "$CARCH"} chroot "${working_dir}" "$@"
|
${CARCH:+setarch "$CARCH"} chroot "${working_dir}" "$@"
|
||||||
|
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ done
|
|||||||
[[ $device = *'\040(deleted)' ]] && continue
|
[[ $device = *'\040(deleted)' ]] && continue
|
||||||
|
|
||||||
if [[ $type = file ]]; then
|
if [[ $type = file ]]; then
|
||||||
printf '%-20s' "${device#${root%/}}"
|
printf '%-20s' "$device"
|
||||||
elif [[ $device = /dev/dm-+([0-9]) ]]; then
|
elif [[ $device = /dev/dm-+([0-9]) ]]; then
|
||||||
# device mapper doesn't allow characters we need to worry
|
# device mapper doesn't allow characters we need to worry
|
||||||
# about being mangled, and it does the escaping of dashes
|
# about being mangled, and it does the escaping of dashes
|
||||||
|
|||||||
@@ -15,9 +15,11 @@
|
|||||||
. @libdir@/artools/util-base.sh
|
. @libdir@/artools/util-base.sh
|
||||||
|
|
||||||
working_dir=''
|
working_dir=''
|
||||||
|
|
||||||
files=()
|
files=()
|
||||||
chroot_args=()
|
|
||||||
|
nosetarch=false
|
||||||
|
copy_mirrorlist=true
|
||||||
|
basestrap_args=(-Gc)
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "Usage: ${0##*/} [options] working-dir package-list..."
|
echo "Usage: ${0##*/} [options] working-dir package-list..."
|
||||||
@@ -26,6 +28,7 @@ usage() {
|
|||||||
echo ' -M <file> Location of a makepkg config file'
|
echo ' -M <file> Location of a makepkg config file'
|
||||||
echo ' -c <dir> Set pacman cache'
|
echo ' -c <dir> Set pacman cache'
|
||||||
echo ' -f <file> Copy file from the host to the chroot'
|
echo ' -f <file> Copy file from the host to the chroot'
|
||||||
|
echo ' -m Do not copy mirrorlist to the chroot'
|
||||||
echo ' -s Do not run setarch'
|
echo ' -s Do not run setarch'
|
||||||
echo ' -h This message'
|
echo ' -h This message'
|
||||||
exit 1
|
exit 1
|
||||||
@@ -33,7 +36,7 @@ usage() {
|
|||||||
|
|
||||||
orig_argv=("$0" "$@")
|
orig_argv=("$0" "$@")
|
||||||
|
|
||||||
opts='hC:M:c:f:s'
|
opts='hC:M:c:f:sm'
|
||||||
|
|
||||||
while getopts ${opts} arg; do
|
while getopts ${opts} arg; do
|
||||||
case "${arg}" in
|
case "${arg}" in
|
||||||
@@ -41,12 +44,11 @@ while getopts ${opts} arg; do
|
|||||||
M) makepkg_conf="$OPTARG" ;;
|
M) makepkg_conf="$OPTARG" ;;
|
||||||
c) cache_dir="$OPTARG" ;;
|
c) cache_dir="$OPTARG" ;;
|
||||||
f) files+=("$OPTARG") ;;
|
f) files+=("$OPTARG") ;;
|
||||||
s) nosetarch=1 ;;
|
s) nosetarch=true ;;
|
||||||
|
m) copy_mirrorlist=false; basestrap_args+=(-M) ;;
|
||||||
h|?) usage ;;
|
h|?) usage ;;
|
||||||
*) error "invalid argument '%s'" "$arg"; usage ;;
|
*) error "invalid argument '%s'" "$arg"; usage ;;
|
||||||
esac
|
esac
|
||||||
chroot_args+=("-$arg")
|
|
||||||
[[ -v OPTARG ]] && chroot_args+=("$OPTARG")
|
|
||||||
done
|
done
|
||||||
shift $(($OPTIND - 1))
|
shift $(($OPTIND - 1))
|
||||||
|
|
||||||
@@ -59,10 +61,10 @@ shift 1
|
|||||||
|
|
||||||
[[ -z $working_dir ]] && die 'Please specify a working directory.'
|
[[ -z $working_dir ]] && die 'Please specify a working directory.'
|
||||||
|
|
||||||
pacconf_cmd=$(command -v pacman-conf || command -v pacconf)
|
if [[ -z $cache_dir ]]; then
|
||||||
|
cache_dirs=($(pacman -v $cache_conf 2>&1 | grep '^Cache Dirs:' | sed 's/Cache Dirs:\s*//g'))
|
||||||
if (( ${#cache_dirs[@]} == 0 )); then
|
else
|
||||||
mapfile -t cache_dirs < <($pacconf_cmd CacheDir)
|
cache_dirs=(${cache_dir})
|
||||||
fi
|
fi
|
||||||
|
|
||||||
umask 0022
|
umask 0022
|
||||||
@@ -88,15 +90,26 @@ for f in "${files[@]}"; do
|
|||||||
cp "$f" "$working_dir$f"
|
cp "$f" "$working_dir$f"
|
||||||
done
|
done
|
||||||
|
|
||||||
basestrap -Mc ${pacman_conf:+-C "$pacman_conf"} "$working_dir" \
|
_env=()
|
||||||
${cache_dirs[@]/#/--cachedir=} "$@" || die 'Failed to install all packages'
|
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[@]}" ${pacman_conf:+-C "$pacman_conf"} "$working_dir" ${cache_dirs[@]/#/--cachedir=} "$@" || die 'Failed to install all packages'
|
||||||
|
|
||||||
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"
|
|
||||||
echo "${CHROOTVERSION}" > "$working_dir/.artools"
|
echo "${CHROOTVERSION}" > "$working_dir/.artools"
|
||||||
|
|
||||||
|
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
|
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})
|
||||||
|
|
||||||
exec chroot-run \
|
exec chroot-run \
|
||||||
"${chroot_args[@]}" \
|
"${chroot_args[@]}" \
|
||||||
"$working_dir" locale-gen
|
"$working_dir" locale-gen
|
||||||
|
|||||||
@@ -15,25 +15,10 @@
|
|||||||
. @libdir@/artools/util-base.sh
|
. @libdir@/artools/util-base.sh
|
||||||
. @libdir@/artools/util-iso.sh
|
. @libdir@/artools/util-iso.sh
|
||||||
|
|
||||||
gen_iso_fn(){
|
|
||||||
local vars=("artix") name
|
|
||||||
vars+=("${PROFILE}")
|
|
||||||
vars+=("${INITSYS}")
|
|
||||||
case "${REPOSITORY}" in
|
|
||||||
'gremlins'|'goblins') vars+=("${REPOSITORY}") ;;
|
|
||||||
esac
|
|
||||||
vars+=("${ISO_VERSION}")
|
|
||||||
vars+=("${ARCH}")
|
|
||||||
for n in ${vars[@]};do
|
|
||||||
name=${name:-}${name:+-}${n}
|
|
||||||
done
|
|
||||||
echo $name
|
|
||||||
}
|
|
||||||
|
|
||||||
prepare_build(){
|
prepare_build(){
|
||||||
timer_start=$(get_timer)
|
timer_start=$(get_timer)
|
||||||
|
|
||||||
load_profile
|
load_profile "${PROFILE}"
|
||||||
|
|
||||||
local pacman_conf pac_file="pacman-default.conf"
|
local pacman_conf pac_file="pacman-default.conf"
|
||||||
|
|
||||||
@@ -48,7 +33,7 @@ prepare_build(){
|
|||||||
|
|
||||||
iso_label="ARTIX_$(date +%Y%m)"
|
iso_label="ARTIX_$(date +%Y%m)"
|
||||||
|
|
||||||
basestrap_args+=(-C ${pacman_conf})
|
mkchroot_args+=(-C ${pacman_conf} -m)
|
||||||
work_dir=${CHROOTS_ISO}/${PROFILE}/${ARCH}
|
work_dir=${CHROOTS_ISO}/${PROFILE}/${ARCH}
|
||||||
|
|
||||||
iso_dir="${ISO_POOL}/${PROFILE}"
|
iso_dir="${ISO_POOL}/${PROFILE}"
|
||||||
@@ -88,9 +73,7 @@ build(){
|
|||||||
lock_close 9
|
lock_close 9
|
||||||
|
|
||||||
rm -rf --one-file-system "${work_dir}"
|
rm -rf --one-file-system "${work_dir}"
|
||||||
|
clean_iso_root "${iso_root}"
|
||||||
msg "Deleting isoroot [%s] ..." "${iso_root##*/}"
|
|
||||||
rm -rf --one-file-system "${iso_root}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ${iso_only}; then
|
if ${iso_only}; then
|
||||||
@@ -118,9 +101,10 @@ clean_first=true
|
|||||||
pretend=false
|
pretend=false
|
||||||
images_only=false
|
images_only=false
|
||||||
iso_only=false
|
iso_only=false
|
||||||
|
log=false
|
||||||
persist=false
|
persist=false
|
||||||
|
|
||||||
basestrap_args=(-GMc)
|
mkchroot_args=()
|
||||||
cmd=${0##*/}
|
cmd=${0##*/}
|
||||||
|
|
||||||
REPOSITORY=${cmd##*-}
|
REPOSITORY=${cmd##*-}
|
||||||
@@ -141,6 +125,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 ' -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 ''
|
||||||
@@ -150,7 +135,7 @@ usage() {
|
|||||||
|
|
||||||
orig_argv=("$0" "$@")
|
orig_argv=("$0" "$@")
|
||||||
|
|
||||||
opts='p:r:t:i:g:czxmqh'
|
opts='p:r:t:i:g:czxmlqh'
|
||||||
|
|
||||||
while getopts "${opts}" arg; do
|
while getopts "${opts}" arg; do
|
||||||
case "${arg}" in
|
case "${arg}" in
|
||||||
@@ -163,6 +148,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 ;;
|
||||||
|
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 ;;
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ load_user_info
|
|||||||
load_config "${USERCONFDIR}/artools/artools.conf" || load_config "${SYSCONFDIR}/artools.conf"
|
load_config "${USERCONFDIR}/artools/artools.conf" || load_config "${SYSCONFDIR}/artools.conf"
|
||||||
|
|
||||||
create_first=false
|
create_first=false
|
||||||
rebuild=false
|
|
||||||
|
|
||||||
mkchrootpkg_args=(-c -n)
|
mkchrootpkg_args=(-c -n)
|
||||||
|
|
||||||
@@ -28,11 +27,22 @@ cmd=${0##*/}
|
|||||||
repo=${cmd#*-}
|
repo=${cmd#*-}
|
||||||
base_devel=('base-devel')
|
base_devel=('base-devel')
|
||||||
|
|
||||||
|
case ${repo} in
|
||||||
|
system|world|galaxy) repo='default' ;;
|
||||||
|
lib32*) base_devel+=('multilib-devel') ;;
|
||||||
|
galaxy-gremlins|galaxy-goblins) repo=${repo#*-} ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
pacman_conf="${DATADIR}/pacman-${repo}.conf"
|
||||||
|
[[ -f ${USERCONFDIR}/artools/pacman-${repo}.conf ]] && pacman_conf="${USERCONFDIR}/artools/pacman-${repo}.conf"
|
||||||
|
|
||||||
|
makepkg_conf="${DATADIR}/makepkg.conf"
|
||||||
|
[[ -f ${USERCONFDIR}/artools/makepkg.conf ]] && makepkg_conf="${USERCONFDIR}/artools/makepkg.conf"
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "Usage: ${0##*/} [options] -- [mkchrootpkg_args]"
|
echo "Usage: ${0##*/} [options] -- [mkchrootpkg_args]"
|
||||||
echo " -r <dir> Create chroots in this directory"
|
echo " -r <dir> Create chroots in this directory"
|
||||||
echo ' -c Recreate the chroot before building'
|
echo ' -c Recreate the chroot before building'
|
||||||
echo ' -m Major rebuild'
|
|
||||||
echo ' -h This help'
|
echo ' -h This help'
|
||||||
echo ''
|
echo ''
|
||||||
echo "Default mkchrootpkg_args args: ${mkchrootpkg_args[*]}"
|
echo "Default mkchrootpkg_args args: ${mkchrootpkg_args[*]}"
|
||||||
@@ -42,34 +52,17 @@ usage() {
|
|||||||
|
|
||||||
orig_argv=("$0" "$@")
|
orig_argv=("$0" "$@")
|
||||||
|
|
||||||
opts='hcmr:'
|
opts='hcr:'
|
||||||
|
|
||||||
while getopts "${opts}" arg; do
|
while getopts "${opts}" arg; do
|
||||||
case "${arg}" in
|
case "${arg}" in
|
||||||
r) CHROOTS_PKG="$OPTARG" ;;
|
r) CHROOTS_PKG="$OPTARG" ;;
|
||||||
c) create_first=true ;;
|
c) create_first=true ;;
|
||||||
m) rebuild=true ;;
|
|
||||||
h|?) usage 0 ;;
|
h|?) usage 0 ;;
|
||||||
*) echo "invalid argument '%s'" "${arg}"; usage 1 ;;
|
*) echo "invalid argument '%s'" "${arg}"; usage 1 ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if ${rebuild};then
|
|
||||||
repo='default'
|
|
||||||
else
|
|
||||||
case ${repo} in
|
|
||||||
system|world|galaxy) repo='default' ;;
|
|
||||||
lib32*) base_devel+=('multilib-devel') ;;
|
|
||||||
galaxy-gremlins|galaxy-goblins) repo=${repo#*-} ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
pacman_conf="${DATADIR}/pacman-${repo}.conf"
|
|
||||||
[[ -f ${USERCONFDIR}/artools/pacman-${repo}.conf ]] && pacman_conf="${USERCONFDIR}/artools/pacman-${repo}.conf"
|
|
||||||
|
|
||||||
makepkg_conf="${DATADIR}/makepkg.conf"
|
|
||||||
[[ -f ${USERCONFDIR}/artools/makepkg.conf ]] && makepkg_conf="${USERCONFDIR}/artools/makepkg.conf"
|
|
||||||
|
|
||||||
check_root SOURCE_DATE_EPOCH
|
check_root SOURCE_DATE_EPOCH
|
||||||
|
|
||||||
mkchrootpkg_args+=("${@:$OPTIND}")
|
mkchrootpkg_args+=("${@:$OPTIND}")
|
||||||
@@ -101,7 +94,7 @@ else
|
|||||||
-C "${pacman_conf}" \
|
-C "${pacman_conf}" \
|
||||||
-M "${makepkg_conf}" \
|
-M "${makepkg_conf}" \
|
||||||
"${CHROOTS_PKG}/${repo}-${ARCH}/root" \
|
"${CHROOTS_PKG}/${repo}-${ARCH}/root" \
|
||||||
pacman -Syuu --noconfirm || abort
|
pacman -Syu --noconfirm || abort
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Always build official packages reproducibly
|
# Always build official packages reproducibly
|
||||||
|
|||||||
@@ -29,9 +29,8 @@ pull_tree_arch(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
pull_tree_artix(){
|
pull_tree_artix(){
|
||||||
local repos=("$1")
|
|
||||||
cd ${TREE_DIR_ARTIX}
|
cd ${TREE_DIR_ARTIX}
|
||||||
for tree in ${repos[@]};do
|
for tree in ${TREE_NAMES_ARTIX[@]};do
|
||||||
if [[ -d ${tree} ]];then
|
if [[ -d ${tree} ]];then
|
||||||
config_tree "${tree}"
|
config_tree "${tree}"
|
||||||
cd ${tree}
|
cd ${tree}
|
||||||
@@ -58,7 +57,7 @@ show_deps(){
|
|||||||
|
|
||||||
[[ $arch == 'any' ]] && CARCH=any
|
[[ $arch == 'any' ]] && CARCH=any
|
||||||
|
|
||||||
local archver=$(get_full_version)
|
local archver=$(get_full_version $pkg)
|
||||||
|
|
||||||
msg2 "repo: %s" "$repo"
|
msg2 "repo: %s" "$repo"
|
||||||
[[ -n ${pkgbase} ]] && msg2 "pkgbase: %s" "${pkgbase}"
|
[[ -n ${pkgbase} ]] && msg2 "pkgbase: %s" "${pkgbase}"
|
||||||
@@ -73,42 +72,20 @@ show_deps(){
|
|||||||
[[ -n ${optdepends[@]} ]] && msg2 "optdepends: %s" "${optdepends[@]}"
|
[[ -n ${optdepends[@]} ]] && msg2 "optdepends: %s" "${optdepends[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
subrepo_new(){
|
|
||||||
local group="$1" team="$2"
|
|
||||||
local dest=${TREE_DIR_ARTIX}/$group/${PACKAGE}/trunk
|
|
||||||
|
|
||||||
cd ${TREE_DIR_ARTIX}/$group
|
|
||||||
|
|
||||||
local org=$(get_pkg_org "${PACKAGE}")
|
|
||||||
|
|
||||||
create_repo "${PACKAGE}" "$org"
|
|
||||||
|
|
||||||
add_repo_to_team "${PACKAGE}" "$org" "$team"
|
|
||||||
|
|
||||||
subrepo_clone "${PACKAGE}" "$org"
|
|
||||||
|
|
||||||
prepare_dir "$dest"
|
|
||||||
|
|
||||||
commit_jenkins_files "${PACKAGE}"
|
|
||||||
}
|
|
||||||
|
|
||||||
from_arch(){
|
from_arch(){
|
||||||
local src= dest=
|
local pkg="$1" src= dest=
|
||||||
|
local git_tree_arch=$(find_tree "${TREE_DIR_ARCH}" "$pkg")
|
||||||
|
[[ -z $git_tree_arch ]] && die "Package '%s' does not exist!" "$pkg"
|
||||||
|
|
||||||
cd ${TREE_DIR_ARTIX}
|
local package=${TREE_DIR_ARCH}/$git_tree_arch/$pkg
|
||||||
|
local repo=$(find_repo "$package")
|
||||||
local git_tree_arch=$(find_tree "${TREE_DIR_ARCH}" "${PACKAGE}")
|
|
||||||
[[ -z $git_tree_arch ]] && die "Package '%s' does not exist!" "${PACKAGE}"
|
|
||||||
|
|
||||||
local package=${TREE_DIR_ARCH}/$git_tree_arch/${PACKAGE}
|
|
||||||
local repo=$(find_repo "$package" "${staging}" "${unstable}")
|
|
||||||
|
|
||||||
src=$package/repos/$repo
|
src=$package/repos/$repo
|
||||||
|
|
||||||
local git_tree_artix=$(find_tree "${TREE_DIR_ARTIX}" "${PACKAGE}")
|
local git_tree_artix=$(find_tree "${TREE_DIR_ARTIX}" "$pkg")
|
||||||
local tree_dir=$(get_artix_tree "${PACKAGE}" "$git_tree_artix" "$git_tree_arch")
|
local tree_dir=$(get_artix_tree "$pkg" "$git_tree_artix" "$git_tree_arch")
|
||||||
|
|
||||||
dest=${TREE_DIR_ARTIX}/$tree_dir/${PACKAGE}/trunk
|
dest=${TREE_DIR_ARTIX}/$tree_dir/$pkg/trunk
|
||||||
|
|
||||||
msg "tree: %s" "$tree_dir"
|
msg "tree: %s" "$tree_dir"
|
||||||
show_deps "$src" "$repo"
|
show_deps "$src" "$repo"
|
||||||
@@ -118,51 +95,35 @@ from_arch(){
|
|||||||
cd ${TREE_DIR_ARTIX}/$git_tree_artix
|
cd ${TREE_DIR_ARTIX}/$git_tree_artix
|
||||||
|
|
||||||
. $dest/PKGBUILD 2>/dev/null
|
. $dest/PKGBUILD 2>/dev/null
|
||||||
local artixver=$(get_full_version)
|
local artixver=$(get_full_version $pkg)
|
||||||
|
|
||||||
msg2 "Artix Version: %s" "$artixver"
|
msg2 "Artix Version: %s" "$artixver"
|
||||||
else
|
else
|
||||||
subrepo_new "$tree_dir" "$git_tree_arch"
|
subrepo_new "$pkg" "$tree_dir" "$git_tree_arch"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg "Sync (%s) from [%s] to [%s]" "${PACKAGE}" "$git_tree_arch" "$tree_dir"
|
msg "Sync (%s) from [%s] to [%s]" "$pkg" "$git_tree_arch" "$tree_dir"
|
||||||
|
|
||||||
sync_pkg "$src" "$dest"
|
sync_pkg "$src" "$dest"
|
||||||
patch_pkg "${PACKAGE}"
|
patch_pkg "$pkg"
|
||||||
}
|
}
|
||||||
|
|
||||||
view_build(){
|
view_build(){
|
||||||
local src=
|
local pkg="$1" src=
|
||||||
local git_tree_arch=$(find_tree "${TREE_DIR_ARCH}" "${PACKAGE}")
|
local git_tree_arch=$(find_tree "${TREE_DIR_ARCH}" "$pkg")
|
||||||
[[ -z $git_tree_arch ]] && die "Package '%s' does not exist!" "${PACKAGE}"
|
[[ -z $git_tree_arch ]] && die "Package '%s' does not exist!" "$pkg"
|
||||||
|
|
||||||
local pkg_path=${TREE_DIR_ARCH}/$git_tree_arch/${PACKAGE}
|
local pkg_path=${TREE_DIR_ARCH}/$git_tree_arch/$pkg
|
||||||
local repo=$(find_repo "$pkg_path" "${staging}" "${unstable}")
|
local repo=$(find_repo "$pkg_path")
|
||||||
|
|
||||||
src=$pkg_path/repos/$repo
|
src=$pkg_path/repos/$repo
|
||||||
|
|
||||||
show_deps "$src" "$repo"
|
show_deps "$src" "$repo"
|
||||||
}
|
}
|
||||||
|
|
||||||
check_tree(){
|
|
||||||
local git_tree_arch=$(find_tree "${TREE_DIR_ARCH}" "${PACKAGE}")
|
|
||||||
[[ -z $git_tree_arch ]] && die "Package '%s' does not exist!" "${PACKAGE}"
|
|
||||||
local git_tree_artix=$(find_tree "${TREE_DIR_ARTIX}" "${PACKAGE}")
|
|
||||||
local tree_dir=$(get_artix_tree "${PACKAGE}" "$git_tree_artix" "$git_tree_arch")
|
|
||||||
msg "tree_dir: %s" "$tree_dir"
|
|
||||||
[[ -z $git_tree_artix ]] && msg2 "exists: %s" "no"
|
|
||||||
[[ -n $git_tree_artix ]] && msg2 "exists: %s" "yes"
|
|
||||||
}
|
|
||||||
|
|
||||||
sync_repos(){
|
sync_repos(){
|
||||||
${sync_arch} && pull_tree_arch
|
${sync_arch} && pull_tree_arch
|
||||||
if ${sync_artix};then
|
${sync_artix} && pull_tree_artix
|
||||||
if ${sync_group}; then
|
|
||||||
pull_tree_artix "${GROUP}"
|
|
||||||
else
|
|
||||||
pull_tree_artix "${TREE_NAMES_ARTIX[*]}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
load_user_info
|
load_user_info
|
||||||
@@ -178,10 +139,6 @@ import=false
|
|||||||
view=false
|
view=false
|
||||||
createnew=false
|
createnew=false
|
||||||
conf=false
|
conf=false
|
||||||
unstable=false
|
|
||||||
staging=true
|
|
||||||
sync_group=false
|
|
||||||
check=false
|
|
||||||
|
|
||||||
PACKAGE=''
|
PACKAGE=''
|
||||||
|
|
||||||
@@ -193,17 +150,14 @@ usage() {
|
|||||||
echo ' -p <pkg> Package name'
|
echo ' -p <pkg> Package name'
|
||||||
echo ' -t <team> Team name (only with -n)'
|
echo ' -t <team> Team name (only with -n)'
|
||||||
echo " [default: ${TEAM}]"
|
echo " [default: ${TEAM}]"
|
||||||
echo ' -g <group> Group name, the superrepo (only with -n or -s)'
|
echo ' -g <group> Group name, the superrepo (only with -n)'
|
||||||
echo " [default: ${GROUP}]"
|
echo " [default: ${GROUP}]"
|
||||||
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 " -y Don't clone or pull artix repos"
|
echo " -y Don't clone or pull artix repos"
|
||||||
echo ' -i Import a package from arch repos'
|
echo ' -i Import a package from arch repos'
|
||||||
echo ' -n Make new remote subrepo and clone it'
|
echo ' -n Make new remote subrepo and clone it'
|
||||||
echo ' -u Include kde & gnome unstable (only with -i)'
|
echo ' -v View package depends'
|
||||||
echo ' -w Exclude staging (only with -i)'
|
|
||||||
echo ' -v Check if a package is in the artix tree(s)'
|
|
||||||
echo ' -c View package depends'
|
|
||||||
echo ' -h This help'
|
echo ' -h This help'
|
||||||
echo ''
|
echo ''
|
||||||
echo ''
|
echo ''
|
||||||
@@ -212,21 +166,18 @@ usage() {
|
|||||||
|
|
||||||
orig_argv=("$0" "$@")
|
orig_argv=("$0" "$@")
|
||||||
|
|
||||||
opts='p:t:g:uwsinzycvh'
|
opts='p:t:g:sinzyvh'
|
||||||
|
|
||||||
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" ;;
|
t) TEAM="$OPTARG" ;;
|
||||||
g) GROUP="$OPTARG"; sync_group=true ;;
|
g) GROUP="$OPTARG" ;;
|
||||||
s) sync=true ;;
|
s) sync=true ;;
|
||||||
z) sync_arch=false ;;
|
z) sync_arch=false ;;
|
||||||
y) sync_artix=false ;;
|
y) sync_artix=false ;;
|
||||||
i) import=true ;;
|
i) import=true ;;
|
||||||
n) createnew=true ;;
|
n) createnew=true ;;
|
||||||
w) staging=false ;;
|
|
||||||
u) unstable=true ;;
|
|
||||||
c) check=true ;;
|
|
||||||
v) view=true ;;
|
v) view=true ;;
|
||||||
h|?) usage 0 ;;
|
h|?) usage 0 ;;
|
||||||
*) echo "invalid argument '${arg}'"; usage 1 ;;
|
*) echo "invalid argument '${arg}'"; usage 1 ;;
|
||||||
@@ -240,10 +191,8 @@ prepare_dir "${TREE_DIR_ARCH}"
|
|||||||
|
|
||||||
${sync} && sync_repos
|
${sync} && sync_repos
|
||||||
|
|
||||||
${view} && view_build
|
${view} && view_build "${PACKAGE}"
|
||||||
|
|
||||||
${check} && check_tree
|
${import} && from_arch "${PACKAGE}"
|
||||||
|
|
||||||
${import} && from_arch
|
${createnew} && subrepo_new "${PACKAGE}" "${GROUP}" "${TEAM}"
|
||||||
|
|
||||||
${createnew} && subrepo_new
|
|
||||||
|
|||||||
@@ -1,98 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Copyright (C) 2018-19 artoo@artixlinux.org
|
|
||||||
# Copyright (C) 2018 Artix Linux Developers
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
. @libdir@/artools/util-base.sh
|
|
||||||
. @libdir@/artools/util-pkg.sh
|
|
||||||
|
|
||||||
shopt -s extglob
|
|
||||||
|
|
||||||
if [[ -r '/etc/makepkg.conf' ]]; then
|
|
||||||
source '/etc/makepkg.conf'
|
|
||||||
else
|
|
||||||
die '/etc/makepkg.conf not found!'
|
|
||||||
fi
|
|
||||||
|
|
||||||
load_user_info
|
|
||||||
|
|
||||||
load_vars "${USERCONFDIR}/pacman/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf"
|
|
||||||
load_vars /etc/makepkg.conf
|
|
||||||
|
|
||||||
if [[ ! -f PKGBUILD ]]; then
|
|
||||||
die 'This must be run in the directory of a built package.'
|
|
||||||
fi
|
|
||||||
|
|
||||||
. ./PKGBUILD
|
|
||||||
if [[ $arch == 'any' ]]; then
|
|
||||||
CARCH='any'
|
|
||||||
fi
|
|
||||||
|
|
||||||
STARTDIR=$(pwd)
|
|
||||||
TEMPDIR=$(mktemp -d --tmpdir checkpkg-script.XXXX)
|
|
||||||
|
|
||||||
for _pkgname in "${pkgname[@]}"; do
|
|
||||||
comparepkg=$_pkgname
|
|
||||||
pkgurl=
|
|
||||||
target_pkgver=$(get_full_version)
|
|
||||||
if ! pkgfile=$(find_cached_package "$_pkgname" "$target_pkgver" "$CARCH"); then
|
|
||||||
die 'tarball not found for package: %s' "${_pkgname}-$target_pkgver"
|
|
||||||
fi
|
|
||||||
|
|
||||||
ln -s "$pkgfile" "$TEMPDIR"
|
|
||||||
|
|
||||||
if (( $# )); then
|
|
||||||
case $1 in
|
|
||||||
/*|*/*)
|
|
||||||
pkgurl=file://$(readlink -m "$1") ;;
|
|
||||||
*.pkg.tar*)
|
|
||||||
pkgurl=$1 ;;
|
|
||||||
'')
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
comparepkg=$1 ;;
|
|
||||||
esac
|
|
||||||
shift
|
|
||||||
fi
|
|
||||||
[[ -n $pkgurl ]] || pkgurl=$(pacman -Spdd --print-format '%l' --noconfirm "$comparepkg") ||
|
|
||||||
die "Couldn't download previous package for %s." "$comparepkg"
|
|
||||||
|
|
||||||
oldpkg=${pkgurl##*/}
|
|
||||||
|
|
||||||
if [[ ${oldpkg} = "${pkgfile##*/}" ]]; then
|
|
||||||
die "The built package (%s) is the one in the repo right now!" "$_pkgname"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $pkgurl = file://* || ( $pkgurl = /* && -f $pkgurl ) ]]; then
|
|
||||||
ln -s "${pkgurl#file://}" "$TEMPDIR/$oldpkg"
|
|
||||||
elif [[ -f "$PKGDEST/$oldpkg" ]]; then
|
|
||||||
ln -s "$PKGDEST/$oldpkg" "$TEMPDIR/$oldpkg"
|
|
||||||
elif [[ -f "$STARTDIR/$oldpkg" ]]; then
|
|
||||||
ln -s "$STARTDIR/$oldpkg" "$TEMPDIR/$oldpkg"
|
|
||||||
else
|
|
||||||
curl -fsLC - --retry 3 --retry-delay 3 -o "$TEMPDIR/$oldpkg" "$pkgurl"
|
|
||||||
fi
|
|
||||||
|
|
||||||
bsdtar tf "$TEMPDIR/$oldpkg" | sort > "$TEMPDIR/filelist-$_pkgname-old"
|
|
||||||
bsdtar tf "$pkgfile" | sort > "$TEMPDIR/filelist-$_pkgname"
|
|
||||||
|
|
||||||
sdiff -s "$TEMPDIR/filelist-$_pkgname-old" "$TEMPDIR/filelist-$_pkgname"
|
|
||||||
|
|
||||||
find-libprovides "$TEMPDIR/$oldpkg" 2>/dev/null | sort > "$TEMPDIR/libraries-$_pkgname-old"
|
|
||||||
find-libprovides "$pkgfile" 2>/dev/null | sort > "$TEMPDIR/libraries-$_pkgname"
|
|
||||||
if ! diff_output="$(sdiff -s "$TEMPDIR/libraries-$_pkgname-old" "$TEMPDIR/libraries-$_pkgname")"; then
|
|
||||||
msg "Sonames differ in %s!" "$_pkgname"
|
|
||||||
echo "$diff_output"
|
|
||||||
else
|
|
||||||
msg "No soname differences for %s" "$_pkgname."
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
@@ -15,22 +15,6 @@
|
|||||||
. @libdir@/artools/util-base.sh
|
. @libdir@/artools/util-base.sh
|
||||||
. @libdir@/artools/util-pkg.sh
|
. @libdir@/artools/util-pkg.sh
|
||||||
|
|
||||||
get_path(){
|
|
||||||
local repo="$1" pkg=trunk/PKGBUILD
|
|
||||||
if [[ $repo != trunk ]]; then
|
|
||||||
[[ -f repos/$repo-${ARCH}/PKGBUILD ]] && pkg=repos/$repo-${ARCH}/PKGBUILD
|
|
||||||
[[ -f repos/$repo-any/PKGBUILD ]] && pkg=repos/$repo-any/PKGBUILD
|
|
||||||
fi
|
|
||||||
echo $pkg
|
|
||||||
}
|
|
||||||
|
|
||||||
prepare_commit(){
|
|
||||||
local dest="$1"
|
|
||||||
[[ -d repos/$dest ]] && git rm -r repos/$dest
|
|
||||||
[[ ! -d repos ]] && mkdir repos
|
|
||||||
[[ ! -d repos/$dest ]] && mkdir repos/$dest
|
|
||||||
}
|
|
||||||
|
|
||||||
commit_pkg(){
|
commit_pkg(){
|
||||||
local git_tree=$(find_tree "${TREE_DIR_ARTIX}" "${PACKAGE}")
|
local git_tree=$(find_tree "${TREE_DIR_ARTIX}" "${PACKAGE}")
|
||||||
if [[ -n ${git_tree} ]];then
|
if [[ -n ${git_tree} ]];then
|
||||||
@@ -41,13 +25,9 @@ commit_pkg(){
|
|||||||
|
|
||||||
cd ${TREE_DIR_ARTIX}/${git_tree}/${PACKAGE}
|
cd ${TREE_DIR_ARTIX}/${git_tree}/${PACKAGE}
|
||||||
|
|
||||||
local pkgbuild=$(get_path "${REPO_SRC}")
|
. trunk/PKGBUILD
|
||||||
|
|
||||||
. $pkgbuild
|
|
||||||
[[ $arch == 'any' ]] && CARCH=any
|
[[ $arch == 'any' ]] && CARCH=any
|
||||||
|
local ver=$(get_full_version "${PACKAGE}")
|
||||||
local version=$(get_full_version)
|
|
||||||
|
|
||||||
local commit_msg=""
|
local commit_msg=""
|
||||||
|
|
||||||
if ${remove};then
|
if ${remove};then
|
||||||
@@ -56,14 +36,14 @@ commit_pkg(){
|
|||||||
local pkg=${PACKAGE}
|
local pkg=${PACKAGE}
|
||||||
git rm -r trunk
|
git rm -r trunk
|
||||||
else
|
else
|
||||||
local pkg="${PACKAGE}-$version"
|
local pkg="${PACKAGE}-$ver"
|
||||||
git rm -r repos/"${REPO_SRC}-$CARCH"
|
git rm -r repos/"${REPO_SRC}-$CARCH"
|
||||||
fi
|
fi
|
||||||
commit_msg="[${REPO_SRC}] '$pkg' ${action}"
|
commit_msg="[${REPO_SRC}] '$pkg' ${action}"
|
||||||
msg "Action: %s" "$commit_msg"
|
msg "Action: %s" "$commit_msg"
|
||||||
else
|
else
|
||||||
local action='modify'
|
local action='modify'
|
||||||
commit_msg="[${REPO_SRC}] '${PACKAGE}-$version' ${action}"
|
commit_msg="[${REPO_SRC}] '${PACKAGE}-$ver' ${action}"
|
||||||
msg "Action: %s" "$commit_msg"
|
msg "Action: %s" "$commit_msg"
|
||||||
git add .
|
git add .
|
||||||
|
|
||||||
@@ -74,7 +54,7 @@ commit_pkg(){
|
|||||||
|
|
||||||
${push} && pull_tree "${git_tree}" "$head"
|
${push} && pull_tree "${git_tree}" "$head"
|
||||||
|
|
||||||
# subrepo_pull "${PACKAGE}"
|
subrepo_pull "${PACKAGE}"
|
||||||
subrepo_push "${PACKAGE}"
|
subrepo_push "${PACKAGE}"
|
||||||
subrepo_clean "${PACKAGE}"
|
subrepo_clean "${PACKAGE}"
|
||||||
|
|
||||||
@@ -96,18 +76,17 @@ symlink_commit_pkg(){
|
|||||||
|
|
||||||
cd ${TREE_DIR_ARTIX}/${git_tree}/${PACKAGE}
|
cd ${TREE_DIR_ARTIX}/${git_tree}/${PACKAGE}
|
||||||
|
|
||||||
local pkgbuild=$(get_path "${REPO_SRC}")
|
. trunk/PKGBUILD
|
||||||
|
|
||||||
. $pkgbuild
|
|
||||||
[[ $arch == 'any' ]] && CARCH=any
|
[[ $arch == 'any' ]] && CARCH=any
|
||||||
|
local ver=$(get_full_version "${PACKAGE}")
|
||||||
local version=$(get_full_version)
|
|
||||||
|
|
||||||
if [[ ${REPO_SRC} == 'trunk' ]];then
|
if [[ ${REPO_SRC} == 'trunk' ]];then
|
||||||
local action='add'
|
local action='add'
|
||||||
local dest="${REPO_DEST}-$CARCH"
|
local dest="${REPO_DEST}-$CARCH"
|
||||||
|
|
||||||
prepare_commit "$dest"
|
[[ -d repos/$dest ]] && git rm -r repos/$dest
|
||||||
|
[[ ! -d repos ]] && mkdir repos
|
||||||
|
[[ ! -d repos/$dest ]] && mkdir repos/$dest
|
||||||
|
|
||||||
cp trunk/* repos/$dest/
|
cp trunk/* repos/$dest/
|
||||||
else
|
else
|
||||||
@@ -115,12 +94,14 @@ symlink_commit_pkg(){
|
|||||||
local src="${REPO_SRC}-$CARCH" dest="${REPO_DEST}-$CARCH"
|
local src="${REPO_SRC}-$CARCH" dest="${REPO_DEST}-$CARCH"
|
||||||
|
|
||||||
[[ ! -f repos/$src/PKGBUILD ]] && die "%s does not exist!" "repos/$src/PKGBUILD"
|
[[ ! -f repos/$src/PKGBUILD ]] && die "%s does not exist!" "repos/$src/PKGBUILD"
|
||||||
prepare_commit "$dest"
|
[[ -d repos/$dest ]] && git rm -r repos/$dest
|
||||||
|
[[ ! -d repos ]] && mkdir repos
|
||||||
|
[[ ! -d repos/$dest ]] && mkdir repos/$dest
|
||||||
|
|
||||||
cp repos/$src/* repos/$dest/
|
cp repos/$src/* repos/$dest/
|
||||||
git rm -r repos/$src
|
git rm -r repos/$src
|
||||||
fi
|
fi
|
||||||
local commit_msg="[${REPO_SRC}] -> [${REPO_DEST}] '${PACKAGE}-$version' ${action}"
|
local commit_msg="[${REPO_SRC}] -> [${REPO_DEST}] '${PACKAGE}-$ver' ${action}"
|
||||||
msg "Action: %s" "$commit_msg"
|
msg "Action: %s" "$commit_msg"
|
||||||
|
|
||||||
git add .
|
git add .
|
||||||
@@ -130,7 +111,7 @@ symlink_commit_pkg(){
|
|||||||
|
|
||||||
${push} && pull_tree "${git_tree}" "$head"
|
${push} && pull_tree "${git_tree}" "$head"
|
||||||
|
|
||||||
# subrepo_pull "${PACKAGE}"
|
subrepo_pull "${PACKAGE}"
|
||||||
subrepo_push "${PACKAGE}"
|
subrepo_push "${PACKAGE}"
|
||||||
subrepo_clean "${PACKAGE}"
|
subrepo_clean "${PACKAGE}"
|
||||||
|
|
||||||
|
|||||||
@@ -16,16 +16,16 @@
|
|||||||
. @libdir@/artools/util-pkg.sh
|
. @libdir@/artools/util-pkg.sh
|
||||||
|
|
||||||
compare(){
|
compare(){
|
||||||
local pkgpath="$1" group="$2"
|
local pkgpath="$1"
|
||||||
local pkg=${pkgpath##*/}
|
local pkg=${pkgpath##*/}
|
||||||
local artixrepo=$(find_repo "$pkgpath" "${staging}" "${unstable}")
|
local artixrepo=$(find_repo "$package" "${staging}" "${unstable}")
|
||||||
local artixshow=${artixrepo%-*}
|
local artixshow=${artixrepo%-*}
|
||||||
local pkgbuild=$pkgpath/repos/$artixrepo/PKGBUILD
|
local pkgbuild=$pkgpath/repos/$artixrepo/PKGBUILD
|
||||||
|
|
||||||
if [[ -f $pkgbuild ]];then
|
if [[ -f $pkgbuild ]];then
|
||||||
|
|
||||||
. $pkgbuild 2>/dev/null
|
. $pkgbuild 2>/dev/null
|
||||||
local artixver=$(get_full_version)
|
local artixver=$(get_full_version $pkg)
|
||||||
|
|
||||||
local archpath=$(get_import_path $pkg)
|
local archpath=$(get_import_path $pkg)
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ compare(){
|
|||||||
|
|
||||||
if [[ -f $pkgbuild ]];then
|
if [[ -f $pkgbuild ]];then
|
||||||
. $pkgbuild 2>/dev/null
|
. $pkgbuild 2>/dev/null
|
||||||
local archver=$(get_full_version)
|
local archver=$(get_full_version $pkg)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local result=$(vercmp "$artixver" "$archver")
|
local result=$(vercmp "$artixver" "$archver")
|
||||||
@@ -50,9 +50,9 @@ compare(){
|
|||||||
case $artixrepo in
|
case $artixrepo in
|
||||||
*testing*|*staging*)
|
*testing*|*staging*)
|
||||||
if $repomatch;then
|
if $repomatch;then
|
||||||
msg_row "${table}" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver" "${group#*-}"
|
msg_row "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
|
||||||
else
|
else
|
||||||
msg_row_notify "${table}" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver" "${group#*-}"
|
msg_row_notify "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -61,14 +61,14 @@ compare(){
|
|||||||
elif ${upgrades};then
|
elif ${upgrades};then
|
||||||
|
|
||||||
if [ $result -eq -1 ];then
|
if [ $result -eq -1 ];then
|
||||||
msg_row_upgrade "${table}" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver" "${group#*-}"
|
msg_row_upgrade "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
elif ${downgrades};then
|
elif ${downgrades};then
|
||||||
|
|
||||||
if [ $result -eq 1 ];then
|
if [ $result -eq 1 ];then
|
||||||
if [[ -n $archver ]] && [[ -n $archrepo ]];then
|
if [[ -n $archver ]] && [[ -n $archrepo ]];then
|
||||||
msg_row_downgrade "${table}" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver" "${group#*-}"
|
msg_row_downgrade "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@ check_db(){
|
|||||||
if [[ -f $pkgbuild ]];then
|
if [[ -f $pkgbuild ]];then
|
||||||
|
|
||||||
. $pkgbuild 2>/dev/null
|
. $pkgbuild 2>/dev/null
|
||||||
local artixver=$(get_full_version)
|
local artixver=$(get_full_version $pkg)
|
||||||
local is_entry=false
|
local is_entry=false
|
||||||
|
|
||||||
for name in ${pkgname[@]};do
|
for name in ${pkgname[@]};do
|
||||||
@@ -110,7 +110,7 @@ check_db(){
|
|||||||
is_entry=true
|
is_entry=true
|
||||||
fi
|
fi
|
||||||
if ! $is_entry; then
|
if ! $is_entry; then
|
||||||
msg_row "${table2}" "$repo" "$name" "$artixver" "$is_entry"
|
msg_row "%-20s %-35s %-20s %-10s" "$repo" "$name" "$artixver" "$is_entry"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
unset artixver is_entry pkgbuild pkgver epoch pkgname pkgbase
|
unset artixver is_entry pkgbuild pkgver epoch pkgname pkgbase
|
||||||
@@ -133,7 +133,7 @@ update_db_cache(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
query_db() {
|
query_db() {
|
||||||
msg_table_header "${table3}" "Repo" "Package" "Library"
|
msg_table_header "%-20s %-45s %s" "Repo" "Package" "Library"
|
||||||
for repo in "${searchrepos[@]}"; do
|
for repo in "${searchrepos[@]}"; do
|
||||||
local prefix=
|
local prefix=
|
||||||
local db=${USERCACHEDIR}/${LINKSDBEXT}/${ARCH}/${repo}/
|
local db=${USERCACHEDIR}/${LINKSDBEXT}/${ARCH}/${repo}/
|
||||||
@@ -143,7 +143,7 @@ query_db() {
|
|||||||
pkg=${pkg#${db}}
|
pkg=${pkg#${db}}
|
||||||
pkg="${pkg%/*}"
|
pkg="${pkg%/*}"
|
||||||
|
|
||||||
msg_row "${table3}" "${repo}" "${pkg}" "${match}"
|
msg_row "%-20s %-45s %s" "${repo}" "${pkg}" "${match}"
|
||||||
done < <(grep -rZ "${library}" "${db}") | sort -u
|
done < <(grep -rZ "${library}" "${db}") | sort -u
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -154,12 +154,12 @@ show_version_table(){
|
|||||||
|
|
||||||
if ${check};then
|
if ${check};then
|
||||||
${sync} && update_db_cache
|
${sync} && update_db_cache
|
||||||
msg_table_header "${table2}" "Repo" "Package" "Version" "Database"
|
msg_table_header "%-20s %-35s %-20s %-10s" "Repo" "Package" "Version" "Database"
|
||||||
elif ${query};then
|
elif ${query};then
|
||||||
${sync} && update_db_cache
|
${sync} && update_db_cache
|
||||||
query_db
|
query_db
|
||||||
else
|
else
|
||||||
msg_table_header "${table}" "Arch Repo" "Artix Repo" "Package" "Arch version" "Artix version" "Group"
|
msg_table_header "%-20s %-20s %-25s %-30s %-30s" "Arch Repo" "Artix Repo" "Package" "Arch version" "Artix version"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for tree in ${TREE_NAMES_ARTIX[@]};do
|
for tree in ${TREE_NAMES_ARTIX[@]};do
|
||||||
@@ -170,7 +170,7 @@ show_version_table(){
|
|||||||
if ${check};then
|
if ${check};then
|
||||||
check_db "$package"
|
check_db "$package"
|
||||||
else
|
else
|
||||||
compare "$package" "$tree"
|
compare "$package"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
@@ -198,10 +198,6 @@ artix_repos=(
|
|||||||
'gnome-wobble' 'kde-wobble'
|
'gnome-wobble' 'kde-wobble'
|
||||||
)
|
)
|
||||||
|
|
||||||
readonly table="%-18s %-18s %-25s %-27s %-27s %-10s"
|
|
||||||
readonly table2="%-20s %-35s %-30s %-10s"
|
|
||||||
readonly table3="%-20s %-45s %s"
|
|
||||||
|
|
||||||
searchrepos=(${artix_repos[@]})
|
searchrepos=(${artix_repos[@]})
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
|
|||||||
@@ -15,79 +15,6 @@
|
|||||||
. @libdir@/artools/util-base.sh
|
. @libdir@/artools/util-base.sh
|
||||||
. @libdir@/artools/util-pkg.sh
|
. @libdir@/artools/util-pkg.sh
|
||||||
|
|
||||||
find_cached_pkgfile() {
|
|
||||||
local searchdirs=("$PKGDEST" "$PWD") results=()
|
|
||||||
local pkg="$1"
|
|
||||||
for dir in "${searchdirs[@]}"; do
|
|
||||||
[[ -d $dir ]] || continue
|
|
||||||
results+=$(find "$dir" -type f -name "$pkg")
|
|
||||||
done
|
|
||||||
case ${#results[*]} in
|
|
||||||
0)
|
|
||||||
return 1
|
|
||||||
;;
|
|
||||||
1)
|
|
||||||
printf '%s\n' "${results[0]}"
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
error 'Multiple packages found:'
|
|
||||||
printf '\t%s\n' "${results[@]}" >&2
|
|
||||||
return 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
get_pkgbasename(){
|
|
||||||
local pkg="$1"
|
|
||||||
local pkgbasename name ver rel arch
|
|
||||||
|
|
||||||
pkgbasename=${pkg%.pkg.tar.?z}
|
|
||||||
arch=${pkgbasename##*-}
|
|
||||||
pkgbasename=${pkgbasename%-"$arch"}
|
|
||||||
|
|
||||||
rel=${pkgbasename##*-}
|
|
||||||
pkgbasename=${pkgbasename%-"$rel"}
|
|
||||||
|
|
||||||
ver=${pkgbasename##*-}
|
|
||||||
|
|
||||||
name=${pkgbasename%-"$ver"}
|
|
||||||
echo $name
|
|
||||||
}
|
|
||||||
|
|
||||||
update_repo2(){
|
|
||||||
local repo="$1"
|
|
||||||
local repo_path=${REPOS_ROOT}/$repo/os/${ARCH} packages=()
|
|
||||||
|
|
||||||
for name in ${passfiles[@]}; do
|
|
||||||
if pkgfile=$(find_cached_pkgfile "$name");then
|
|
||||||
info "Found: %s" "$name"
|
|
||||||
if ${add_pkg};then
|
|
||||||
local action='add'
|
|
||||||
packages+=("$name")
|
|
||||||
# checkpkg "${pkgfile}" || return 2
|
|
||||||
if ${sign_pkg};then
|
|
||||||
[[ -e ${pkgfile}.sig ]] && rm ${pkgfile}.sig
|
|
||||||
signfile ${pkgfile}
|
|
||||||
fi
|
|
||||||
ln -sf ${pkgfile}{,.sig} $repo_path/
|
|
||||||
elif ${del_pkg};then
|
|
||||||
local action='remove'
|
|
||||||
packages+=("$(get_pkgbasename "$name")")
|
|
||||||
[[ -e $repo_path/$name ]] && rm $repo_path/$name
|
|
||||||
[[ -e $repo_path/$name.sig ]] && rm $repo_path/$name.sig
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
cd $repo_path
|
|
||||||
if [[ -n $action ]]; then
|
|
||||||
repo-$action -R $repo.${PKGDBEXT} ${packages[@]}
|
|
||||||
${linksdb} && links-$action $repo.${LINKSDBEXT} ${packages[@]}
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
update_repo(){
|
update_repo(){
|
||||||
local repo="$1" pkgfile ver
|
local repo="$1" pkgfile ver
|
||||||
local repo_path=${REPOS_ROOT}/$repo/os/${ARCH} packages=()
|
local repo_path=${REPOS_ROOT}/$repo/os/${ARCH} packages=()
|
||||||
@@ -102,7 +29,7 @@ update_repo(){
|
|||||||
|
|
||||||
for name in ${pkgsearch[@]}; do
|
for name in ${pkgsearch[@]}; do
|
||||||
pkgarch=$(get_pkg_arch "$name")
|
pkgarch=$(get_pkg_arch "$name")
|
||||||
ver=$(get_full_version)
|
ver=$(get_full_version "$name")
|
||||||
if pkgfile=$(find_cached_package "$name" "$ver" "$pkgarch");then
|
if pkgfile=$(find_cached_package "$name" "$ver" "$pkgarch");then
|
||||||
local pkg=${pkgfile##*/}
|
local pkg=${pkgfile##*/}
|
||||||
info "Found: %s" "$pkg"
|
info "Found: %s" "$pkg"
|
||||||
@@ -173,12 +100,6 @@ done
|
|||||||
|
|
||||||
shift $(($OPTIND - 1))
|
shift $(($OPTIND - 1))
|
||||||
|
|
||||||
passfiles="$@"
|
|
||||||
|
|
||||||
prepare_dir "${REPOS_ROOT}"
|
prepare_dir "${REPOS_ROOT}"
|
||||||
|
|
||||||
if [[ -n ${passfiles[@]} ]]; then
|
|
||||||
update_repo2 "${dest_repo}"
|
|
||||||
else
|
|
||||||
update_repo "${dest_repo}"
|
update_repo "${dest_repo}"
|
||||||
fi
|
|
||||||
|
|||||||
@@ -1,100 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Copyright (C) 2018-19 artoo@artixlinux.org
|
|
||||||
# Copyright (C) 2018 Artix Linux Developers
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
. @libdir@/artools/util-base.sh
|
|
||||||
. @libdir@/artools/util-pkg.sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
shopt -s extglob
|
|
||||||
|
|
||||||
IGNORE_INTERNAL=0
|
|
||||||
|
|
||||||
if [[ $1 = "--ignore-internal" ]]; then
|
|
||||||
IGNORE_INTERNAL=1
|
|
||||||
shift
|
|
||||||
fi
|
|
||||||
|
|
||||||
script_mode=${BASH_SOURCE[0]##*/find-lib}
|
|
||||||
|
|
||||||
case $script_mode in
|
|
||||||
deps|provides) true;;
|
|
||||||
*) die "Unknown mode %s" "$script_mode" ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [[ -z $1 ]]; then
|
|
||||||
echo "${0##*/} [options] <package file|extracted package dir>"
|
|
||||||
echo "Options:"
|
|
||||||
echo " --ignore-internal ignore internal libraries"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -d $1 ]]; then
|
|
||||||
pushd "$1" >/dev/null
|
|
||||||
else
|
|
||||||
setup_workdir
|
|
||||||
|
|
||||||
case ${script_mode} in
|
|
||||||
deps) bsdtar -C "$WORKDIR" -xf "$1";;
|
|
||||||
provides) bsdtar -C "$WORKDIR" -xf "$1" --include="*.so*";;
|
|
||||||
esac
|
|
||||||
|
|
||||||
pushd "$WORKDIR" >/dev/null
|
|
||||||
fi
|
|
||||||
|
|
||||||
process_sofile() {
|
|
||||||
# extract the library name: libfoo.so
|
|
||||||
soname="${sofile%.so?(+(.+([0-9])))}".so
|
|
||||||
# extract the major version: 1
|
|
||||||
soversion="${sofile##*\.so\.}"
|
|
||||||
if [[ "$soversion" = "$sofile" ]] && ((IGNORE_INTERNAL)); then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
if ! in_array "${soname}=${soversion}-${soarch}" "${soobjects[@]}"; then
|
|
||||||
# libfoo.so=1-64
|
|
||||||
echo "${soname}=${soversion}-${soarch}"
|
|
||||||
soobjects+=("${soname}=${soversion}-${soarch}")
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
case $script_mode in
|
|
||||||
deps) find_args=(-perm -u+x);;
|
|
||||||
provides) find_args=(-name '*.so*');;
|
|
||||||
esac
|
|
||||||
|
|
||||||
find . -type f "${find_args[@]}" | while read -r filename; do
|
|
||||||
if [[ $script_mode = "provides" ]]; then
|
|
||||||
# ignore if we don't have a shared object
|
|
||||||
if ! LC_ALL=C readelf -h "$filename" 2>/dev/null | grep -q '.*Type:.*DYN (Shared object file).*'; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# get architecture of the file; if soarch is empty it's not an ELF binary
|
|
||||||
soarch=$(LC_ALL=C readelf -h "$filename" 2>/dev/null | sed -n 's/.*Class.*ELF\(32\|64\)/\1/p')
|
|
||||||
[[ -n $soarch ]] || continue
|
|
||||||
|
|
||||||
if [[ $script_mode = "provides" ]]; then
|
|
||||||
# get the string binaries link to: libfoo.so.1.2 -> libfoo.so.1
|
|
||||||
sofile=$(LC_ALL=C readelf -d "$filename" 2>/dev/null | sed -n 's/.*Library soname: \[\(.*\)\].*/\1/p')
|
|
||||||
[[ -z $sofile ]] && sofile="${filename##*/}"
|
|
||||||
process_sofile
|
|
||||||
elif [[ $script_mode = "deps" ]]; then
|
|
||||||
# process all libraries needed by the binary
|
|
||||||
for sofile in $(LC_ALL=C readelf -d "$filename" 2>/dev/null | sed -nr 's/.*Shared library: \[(.*)\].*/\1/p'); do
|
|
||||||
process_sofile
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
popd >/dev/null
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Copyright (C) 2018-19 artoo@artixlinux.org
|
|
||||||
# Copyright (C) 2018 Artix Linux Developers
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
. @libdir@/artools/util-base.sh
|
|
||||||
|
|
||||||
match=$1
|
|
||||||
|
|
||||||
if [[ -z $match ]]; then
|
|
||||||
echo 'Usage: finddeps <depname>'
|
|
||||||
echo ''
|
|
||||||
echo 'Find packages that depend on a given depname.'
|
|
||||||
echo 'Run this script from the top-level directory of your ABS tree.'
|
|
||||||
echo ''
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
find . -type d -print0 2>/dev/null| while read -r -d '' d; do
|
|
||||||
if [[ -f "$d/PKGBUILD" ]]; then
|
|
||||||
pkgname=() depends=() makedepends=() optdepends=()
|
|
||||||
# shellcheck source=PKGBUILD.proto
|
|
||||||
. "$d/PKGBUILD"
|
|
||||||
for dep in "${depends[@]}"; do
|
|
||||||
# lose the version comparator, if any
|
|
||||||
depname=${dep%%[<>=]*}
|
|
||||||
[[ $depname = "$match" ]] && msg "$d (depends)"
|
|
||||||
done
|
|
||||||
for dep in "${makedepends[@]}"; do
|
|
||||||
# lose the version comparator, if any
|
|
||||||
depname=${dep%%[<>=]*}
|
|
||||||
[[ $depname = "$match" ]] && msg "$d (makedepends)"
|
|
||||||
done
|
|
||||||
for dep in "${optdepends[@]/:*}"; do
|
|
||||||
# lose the version comaparator, if any
|
|
||||||
depname=${dep%%[<>=]*}
|
|
||||||
[[ $depname = "$match" ]] && msg "$d (optdepends)"
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
@@ -16,29 +16,6 @@
|
|||||||
|
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
||||||
default_makepkg_args=(--syncdeps --noconfirm --log --holdver --skipinteg)
|
|
||||||
makepkg_args=("${default_makepkg_args[@]}")
|
|
||||||
verifysource_args=()
|
|
||||||
chrootdir=
|
|
||||||
passeddir=
|
|
||||||
makepkg_user=
|
|
||||||
declare -a install_pkgs
|
|
||||||
declare -i ret=0
|
|
||||||
|
|
||||||
keepbuilddir=0
|
|
||||||
update_first=0
|
|
||||||
clean_first=0
|
|
||||||
run_namcap=0
|
|
||||||
temp_chroot=0
|
|
||||||
|
|
||||||
bindmounts_ro=()
|
|
||||||
bindmounts_rw=()
|
|
||||||
|
|
||||||
copy=$USER
|
|
||||||
[[ -n ${SUDO_USER:-} ]] && copy=$SUDO_USER
|
|
||||||
[[ -z "$copy" || $copy = root ]] && copy=copy
|
|
||||||
src_owner=${SUDO_USER:-$USER}
|
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "Usage: ${0##*/} [options] -r <chrootdir> [--] [makepkg args]"
|
echo "Usage: ${0##*/} [options] -r <chrootdir> [--] [makepkg args]"
|
||||||
echo ' Run this script in a PKGBUILD dir to build a package inside a'
|
echo ' Run this script in a PKGBUILD dir to build a package inside a'
|
||||||
@@ -141,7 +118,11 @@ delete_chroot() {
|
|||||||
stat_done
|
stat_done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Usage: install_packages $copydir $pkgs...
|
||||||
install_packages() {
|
install_packages() {
|
||||||
|
local copydir=$1
|
||||||
|
local install_pkgs=("${@:2}")
|
||||||
|
|
||||||
local -a pkgnames
|
local -a pkgnames
|
||||||
local ret
|
local ret
|
||||||
|
|
||||||
@@ -152,19 +133,28 @@ install_packages() {
|
|||||||
-r "${bindmounts_ro[@]}" \
|
-r "${bindmounts_ro[@]}" \
|
||||||
-r "${bindmounts_rw[@]}" \
|
-r "${bindmounts_rw[@]}" \
|
||||||
"$copydir" \
|
"$copydir" \
|
||||||
bash -c 'yes y | pacman -U -- "$@"' -bash "${pkgnames[@]/#//root/}"
|
pacman -U --noconfirm -- "${pkgnames[@]/#//root/}"
|
||||||
ret=$?
|
ret=$?
|
||||||
rm -- "${pkgnames[@]/#/$copydir/root/}"
|
rm -- "${pkgnames[@]/#/$copydir/root/}"
|
||||||
|
|
||||||
return $ret
|
return $ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Usage: prepare_chroot $copydir $HOME $keepbuilddir $run_namcap
|
||||||
|
# Globals:
|
||||||
|
# - MAKEFLAGS
|
||||||
|
# - PACKAGER
|
||||||
prepare_chroot() {
|
prepare_chroot() {
|
||||||
(( keepbuilddir )) || rm -rf "$copydir/build"
|
local copydir=$1
|
||||||
|
local USER_HOME=$2
|
||||||
|
local keepbuilddir=$3
|
||||||
|
local run_namcap=$4
|
||||||
|
|
||||||
|
[[ $keepbuilddir = true ]] || rm -rf "$copydir/build"
|
||||||
|
|
||||||
local builduser_uid builduser_gid
|
local builduser_uid builduser_gid
|
||||||
builduser_uid="$(id -u "$makepkg_user")"
|
builduser_uid="${SUDO_UID:-$UID}"
|
||||||
builduser_gid="$(id -g "$makepkg_user")"
|
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
|
||||||
|
|
||||||
@@ -199,7 +189,7 @@ EOF
|
|||||||
declare -p SOURCE_DATE_EPOCH 2>/dev/null || true
|
declare -p SOURCE_DATE_EPOCH 2>/dev/null || true
|
||||||
printf '_chrootbuild "$@" || exit\n'
|
printf '_chrootbuild "$@" || exit\n'
|
||||||
|
|
||||||
if (( run_namcap )); then
|
if [[ $run_namcap = true ]]; then
|
||||||
declare -f _chrootnamcap
|
declare -f _chrootnamcap
|
||||||
printf '_chrootnamcap || exit\n'
|
printf '_chrootnamcap || exit\n'
|
||||||
fi
|
fi
|
||||||
@@ -240,21 +230,39 @@ _chrootnamcap() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Usage: download_sources $copydir $makepkg_user
|
||||||
|
# Globals:
|
||||||
|
# - SRCDEST
|
||||||
download_sources() {
|
download_sources() {
|
||||||
|
local copydir=$1
|
||||||
|
local makepkg_user=$2
|
||||||
|
|
||||||
|
# local builddir
|
||||||
|
# builddir="$(mktemp -d)"
|
||||||
|
# chown "$makepkg_user:" "$builddir"
|
||||||
|
|
||||||
setup_workdir
|
setup_workdir
|
||||||
chown "$makepkg_user:" "$WORKDIR"
|
chown "$makepkg_user:" "$WORKDIR"
|
||||||
|
|
||||||
# Ensure sources are downloaded
|
# Ensure sources are downloaded
|
||||||
sudo -u "$makepkg_user" --preserve-env=GNUPGHOME \
|
sudo -u "$makepkg_user" --preserve-env=GNUPGHOME \
|
||||||
env SRCDEST="$SRCDEST" BUILDDIR="$WORKDIR" \
|
env SRCDEST="$SRCDEST" BUILDDIR="$WORKDIR" \
|
||||||
makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o "${verifysource_args[@]}" ||
|
makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o ||
|
||||||
die "Could not download sources."
|
die "Could not download sources."
|
||||||
|
|
||||||
# Clean up garbage from verifysource
|
# Clean up garbage from verifysource
|
||||||
# rm -rf "$builddir"
|
# rm -rf "$builddir"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Usage: move_products $copydir $owner
|
||||||
|
# Globals:
|
||||||
|
# - PKGDEST
|
||||||
|
# - LOGDEST
|
||||||
|
# - SRCPKGDEST
|
||||||
move_products() {
|
move_products() {
|
||||||
|
local copydir=$1
|
||||||
|
local src_owner=$2
|
||||||
|
|
||||||
local pkgfile
|
local pkgfile
|
||||||
for pkgfile in "$copydir"/pkgdest/*; do
|
for pkgfile in "$copydir"/pkgdest/*; do
|
||||||
chown "$src_owner" "$pkgfile"
|
chown "$src_owner" "$pkgfile"
|
||||||
@@ -287,19 +295,41 @@ move_products() {
|
|||||||
|
|
||||||
orig_argv=("$0" "$@")
|
orig_argv=("$0" "$@")
|
||||||
|
|
||||||
opts='hcur:I:l:nTD:d:U:'
|
main() {
|
||||||
|
default_makepkg_args=(--syncdeps --noconfirm --log --holdver --skipinteg)
|
||||||
|
makepkg_args=("${default_makepkg_args[@]}")
|
||||||
|
keepbuilddir=false
|
||||||
|
update_first=false
|
||||||
|
clean_first=false
|
||||||
|
run_namcap=false
|
||||||
|
temp_chroot=false
|
||||||
|
chrootdir=
|
||||||
|
passeddir=
|
||||||
|
makepkg_user=
|
||||||
|
declare -a install_pkgs
|
||||||
|
declare -i ret=0
|
||||||
|
|
||||||
|
bindmounts_ro=()
|
||||||
|
bindmounts_rw=()
|
||||||
|
|
||||||
|
copy=$USER
|
||||||
|
[[ -n ${SUDO_USER:-} ]] && copy=$SUDO_USER
|
||||||
|
[[ -z "$copy" || $copy = root ]] && copy=copy
|
||||||
|
src_owner=${SUDO_USER:-$USER}
|
||||||
|
|
||||||
|
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=1 ;;
|
c) clean_first=true ;;
|
||||||
D) bindmounts_ro+=("$OPTARG") ;;
|
D) bindmounts_ro+=("$OPTARG") ;;
|
||||||
d) bindmounts_rw+=("$OPTARG") ;;
|
d) bindmounts_rw+=("$OPTARG") ;;
|
||||||
u) update_first=1 ;;
|
u) update_first=true ;;
|
||||||
r) passeddir="$OPTARG" ;;
|
r) passeddir="$OPTARG" ;;
|
||||||
I) install_pkgs+=("$OPTARG") ;;
|
I) install_pkgs+=("$OPTARG") ;;
|
||||||
l) copy="$OPTARG" ;;
|
l) copy="$OPTARG" ;;
|
||||||
n) run_namcap=1; makepkg_args+=(--install) ;;
|
n) run_namcap=true; makepkg_args+=(--install) ;;
|
||||||
T) temp_chroot=1; copy+="-$$" ;;
|
T) temp_chroot=true; copy+="-$$" ;;
|
||||||
U) makepkg_user="$OPTARG" ;;
|
U) makepkg_user="$OPTARG" ;;
|
||||||
h|*) usage ;;
|
h|*) usage ;;
|
||||||
esac
|
esac
|
||||||
@@ -326,12 +356,12 @@ fi
|
|||||||
makepkg_args+=("${@:$OPTIND}")
|
makepkg_args+=("${@:$OPTIND}")
|
||||||
|
|
||||||
# See if -R or -e was passed to makepkg
|
# See if -R or -e was passed to makepkg
|
||||||
for arg in "${@:$OPTIND}"; do
|
for arg in "${makepkg_args[@]}"; do
|
||||||
case ${arg%%=*} in
|
case ${arg%%=*} in
|
||||||
--skip*|--holdver) verifysource_args+=("$arg") ;;
|
--repackage|--noextract) keepbuilddir=true; break ;;
|
||||||
--repackage|--noextract) keepbuilddir=1 ;;
|
--repackage|--noextract) keepbuilddir=true; break ;;
|
||||||
--*) ;;
|
--*) ;;
|
||||||
-*R*|-*e*) keepbuilddir=1 ;;
|
-*R*|-*e*) keepbuilddir=true; break ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -351,23 +381,23 @@ load_vars /etc/makepkg.conf
|
|||||||
# Lock the chroot we want to use. We'll keep this lock until we exit.
|
# Lock the chroot we want to use. We'll keep this lock until we exit.
|
||||||
lock 9 "$copydir.lock" "Locking chroot copy [%s]" "$copy"
|
lock 9 "$copydir.lock" "Locking chroot copy [%s]" "$copy"
|
||||||
|
|
||||||
if [[ ! -d $copydir ]] || (( clean_first )); then
|
if [[ ! -d $copydir ]] || $clean_first; then
|
||||||
sync_chroot "$chrootdir/root" "$copydir" "$copy"
|
sync_chroot "$chrootdir/root" "$copydir" "$copy"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
bindmounts_rw+=("${PWD}:/startdir" "${SRCDEST}:/srcdest")
|
bindmounts_rw+=("${PWD}:/startdir" "${SRCDEST}:/srcdest")
|
||||||
|
|
||||||
(( update_first )) && chroot-run \
|
$update_first && chroot-run \
|
||||||
-r "${bindmounts_ro[*]}" \
|
-r "${bindmounts_ro[*]}" \
|
||||||
-w "${bindmounts_rw[*]}" \
|
-w "${bindmounts_rw[*]}" \
|
||||||
"$copydir" \
|
"$copydir" \
|
||||||
pacman -Syuu --noconfirm
|
pacman -Syu --noconfirm
|
||||||
|
|
||||||
if [[ -n ${install_pkgs[*]:-} ]]; then
|
if [[ -n ${install_pkgs[*]:-} ]]; then
|
||||||
install_packages
|
install_packages "$copydir" "${install_pkgs[@]}"
|
||||||
ret=$?
|
ret=$?
|
||||||
# If there is no PKGBUILD we are done
|
# If there is no PKGBUILD we have done
|
||||||
[[ -f PKGBUILD ]] || exit $ret
|
[[ -f PKGBUILD ]] || return $ret
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$(id -u "$makepkg_user")" == 0 ]]; then
|
if [[ "$(id -u "$makepkg_user")" == 0 ]]; then
|
||||||
@@ -375,9 +405,9 @@ if [[ "$(id -u "$makepkg_user")" == 0 ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
download_sources
|
download_sources "$copydir" "$makepkg_user"
|
||||||
|
|
||||||
prepare_chroot
|
prepare_chroot "$copydir" "$USER_HOME" "$keepbuilddir" "$run_namcap"
|
||||||
|
|
||||||
if chroot-run \
|
if chroot-run \
|
||||||
-r "${bindmounts_ro[*]}" \
|
-r "${bindmounts_ro[*]}" \
|
||||||
@@ -385,15 +415,15 @@ if chroot-run \
|
|||||||
"$copydir" \
|
"$copydir" \
|
||||||
/chrootbuild "${makepkg_args[@]}"
|
/chrootbuild "${makepkg_args[@]}"
|
||||||
then
|
then
|
||||||
move_products
|
move_products "$copydir" "$src_owner"
|
||||||
else
|
else
|
||||||
(( ret += 1 ))
|
(( ret += 1 ))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
(( temp_chroot )) && delete_chroot "$copydir" "$copy"
|
$temp_chroot && delete_chroot "$copydir" "$copy"
|
||||||
|
|
||||||
if (( ret != 0 )); then
|
if (( ret != 0 )); then
|
||||||
if (( temp_chroot )); then
|
if $temp_chroot; then
|
||||||
die "Build failed"
|
die "Build failed"
|
||||||
else
|
else
|
||||||
die "Build failed, check %s/build" "$copydir"
|
die "Build failed, check %s/build" "$copydir"
|
||||||
@@ -401,4 +431,6 @@ if (( ret != 0 )); then
|
|||||||
else
|
else
|
||||||
true
|
true
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
# gitea user access token
|
# gitea user access token
|
||||||
# GIT_TOKEN=''
|
# GIT_TOKEN=''
|
||||||
|
|
||||||
# HOST_TREE_ARTIX='gitea@gitea.artixlinux.org:artixlinux'
|
# HOST_TREE_ARTIX='gitea@gitea.artixlinux.org:artix'
|
||||||
|
|
||||||
# TREE_DIR_ARTIX=${WORKSPACE_DIR}/artixlinux
|
# TREE_DIR_ARTIX=${WORKSPACE_DIR}/artixlinux
|
||||||
|
|
||||||
@@ -25,27 +25,19 @@
|
|||||||
# packages-kernel
|
# packages-kernel
|
||||||
# packages-openrc
|
# packages-openrc
|
||||||
# packages-runit
|
# packages-runit
|
||||||
# packages-s6
|
|
||||||
# packages-media
|
|
||||||
# packages-xorg
|
# packages-xorg
|
||||||
# packages-python
|
# packages-python
|
||||||
# packages-perl
|
# packages-perl
|
||||||
# packages-qt5
|
# packages-qt5
|
||||||
# packages-devel
|
|
||||||
# packages-ruby
|
# packages-ruby
|
||||||
# packages-gtk
|
|
||||||
# packages-gnome
|
|
||||||
# packages-cinnamon
|
|
||||||
# packages-lxqt
|
|
||||||
# packages-mate
|
|
||||||
# packages-kde
|
|
||||||
# packages-xfce
|
|
||||||
# )
|
# )
|
||||||
|
|
||||||
# HOST_TREE_ARCH=git://git.archlinux.org/svntogit
|
# HOST_TREE_ARCH=git://git.archlinux.org/svntogit
|
||||||
|
|
||||||
# TREE_DIR_ARCH=${WORKSPACE_DIR}/archlinux
|
# TREE_DIR_ARCH=${WORKSPACE_DIR}/archlinux
|
||||||
|
|
||||||
|
# TREE_NAMES_ARCH=(packages community)
|
||||||
|
|
||||||
# default repos root
|
# default repos root
|
||||||
# REPOS_ROOT=${WORKSPACE_DIR}/repos
|
# REPOS_ROOT=${WORKSPACE_DIR}/repos
|
||||||
|
|
||||||
@@ -62,12 +54,9 @@
|
|||||||
# the dist release; default: auto
|
# the dist release; default: auto
|
||||||
# ISO_VERSION=$(date +%Y%m%d)
|
# ISO_VERSION=$(date +%Y%m%d)
|
||||||
|
|
||||||
# possible values: openrc, runit, s6
|
# possible values: openrc, runit (s6 not yet supported)
|
||||||
# INITSYS="openrc"
|
# INITSYS="openrc"
|
||||||
|
|
||||||
# gpg key; leave empty or commented to skip sfs signing
|
|
||||||
# GPG_KEY=""
|
|
||||||
|
|
||||||
# set upload bandwidth limit in kB/s
|
# set upload bandwidth limit in kB/s
|
||||||
# UPLIMIT=1000
|
# UPLIMIT=1000
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
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 filesystems keyboard keymap)
|
|
||||||
|
|
||||||
COMPRESSION="xz"
|
|
||||||
63
data/pkglists/freedesktop.list
Normal file
63
data/pkglists/freedesktop.list
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
accountsservice
|
||||||
|
cairo
|
||||||
|
colord
|
||||||
|
cppunit
|
||||||
|
dbus
|
||||||
|
dbus-glib
|
||||||
|
dbus-python
|
||||||
|
desktop-file-utils
|
||||||
|
fontconfig
|
||||||
|
geoclue2
|
||||||
|
glu
|
||||||
|
gst-plugins-bad
|
||||||
|
gst-plugins-base
|
||||||
|
gst-plugins-good
|
||||||
|
gst-plugins-ugly
|
||||||
|
gstreamer
|
||||||
|
harfbuzz
|
||||||
|
hicolor-icon-theme
|
||||||
|
libatasmart
|
||||||
|
libbsd
|
||||||
|
libdrm
|
||||||
|
libevdev
|
||||||
|
libinput
|
||||||
|
libmbim
|
||||||
|
libnice
|
||||||
|
libqmi
|
||||||
|
libvdpau
|
||||||
|
libxcb
|
||||||
|
libxft
|
||||||
|
libxi
|
||||||
|
media-player-info
|
||||||
|
mesa
|
||||||
|
modemmanager
|
||||||
|
networkmanager
|
||||||
|
orc
|
||||||
|
p11-kit
|
||||||
|
polkit
|
||||||
|
poppler
|
||||||
|
poppler-data
|
||||||
|
pulseaudio
|
||||||
|
pyxdg
|
||||||
|
r
|
||||||
|
sdl
|
||||||
|
shared-mime-info
|
||||||
|
sound-theme-freedesktop
|
||||||
|
startup-notification
|
||||||
|
systemdcompat
|
||||||
|
telepathy-glib
|
||||||
|
ttf-dejavu
|
||||||
|
udisks2
|
||||||
|
upower
|
||||||
|
wayland
|
||||||
|
wayland-protocols
|
||||||
|
webrtc-audio-processing
|
||||||
|
xcb-proto
|
||||||
|
xcb-util
|
||||||
|
xcb-util-cursor
|
||||||
|
xcb-util-image
|
||||||
|
xcb-util-keysyms
|
||||||
|
xcb-util-renderutil
|
||||||
|
xcb-util-wm
|
||||||
|
xdg-user-dirs
|
||||||
|
xdg-utils
|
||||||
63
data/pkglists/gnome.list
Normal file
63
data/pkglists/gnome.list
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
adwaita-icon-theme
|
||||||
|
atk
|
||||||
|
at-spi2-atk
|
||||||
|
at-spi2-core
|
||||||
|
babl
|
||||||
|
cantarell-fonts
|
||||||
|
cogl
|
||||||
|
dconf
|
||||||
|
flatpak
|
||||||
|
gamin
|
||||||
|
gcab
|
||||||
|
gconf
|
||||||
|
gcr
|
||||||
|
gdk-pixbuf2
|
||||||
|
gegl02
|
||||||
|
git
|
||||||
|
glade
|
||||||
|
glib2
|
||||||
|
glib-networking
|
||||||
|
gnome-common
|
||||||
|
gnome-keyring
|
||||||
|
gobject-introspection
|
||||||
|
gsettings-desktop-schemas
|
||||||
|
gssdp
|
||||||
|
gtk2
|
||||||
|
gtk3
|
||||||
|
gtk-doc
|
||||||
|
gtksourceview3
|
||||||
|
gupnp
|
||||||
|
gupnp-igd
|
||||||
|
gvfs
|
||||||
|
json-glib
|
||||||
|
libcloudproviders
|
||||||
|
libcroco
|
||||||
|
libgee
|
||||||
|
libglade
|
||||||
|
libgnome-keyring
|
||||||
|
libgudev
|
||||||
|
libnotify
|
||||||
|
librsvg
|
||||||
|
libsecret
|
||||||
|
libsoup
|
||||||
|
libxml2
|
||||||
|
libxslt
|
||||||
|
meld
|
||||||
|
mobile-broadband-provider-info
|
||||||
|
modemmanager
|
||||||
|
networkmanager
|
||||||
|
network-manager-applet
|
||||||
|
orca
|
||||||
|
ostree
|
||||||
|
pango
|
||||||
|
pyatspi
|
||||||
|
pygobject
|
||||||
|
pygobject2
|
||||||
|
pygtk
|
||||||
|
rest
|
||||||
|
ttf-bitstream-vera
|
||||||
|
vala
|
||||||
|
vte
|
||||||
|
vte3
|
||||||
|
yelp-tools
|
||||||
|
yelp-xsl
|
||||||
4
data/pkglists/kde.list
Normal file
4
data/pkglists/kde.list
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
phonon-gstreamer
|
||||||
|
polkit-qt
|
||||||
|
extra-cmake-modules
|
||||||
|
phonon
|
||||||
17
data/pkglists/kernel.list
Normal file
17
data/pkglists/kernel.list
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
linux
|
||||||
|
nvidia
|
||||||
|
nvidia-utils
|
||||||
|
acpi_call
|
||||||
|
bbswitch
|
||||||
|
broadcom-wl
|
||||||
|
tp_smapi
|
||||||
|
r8168
|
||||||
|
virtualbox-modules-artix
|
||||||
|
linux-lts
|
||||||
|
nvidia-lts
|
||||||
|
acpi_call-lts
|
||||||
|
bbswitch-lts
|
||||||
|
broadcom-wl-lts
|
||||||
|
tp_smapi-lts
|
||||||
|
r8168-lts
|
||||||
|
linux-firmware
|
||||||
31
data/pkglists/lxqt.list
Normal file
31
data/pkglists/lxqt.list
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
lxqt-about
|
||||||
|
lxqt-admin
|
||||||
|
lxqt-config
|
||||||
|
lxqt-globalkeys
|
||||||
|
lxqt-notificationd
|
||||||
|
lxqt-openssh-askpass
|
||||||
|
lxqt-panel
|
||||||
|
lxqt-policykit
|
||||||
|
lxqt-powermanagement
|
||||||
|
lxqt-qtplugin
|
||||||
|
lxqt-runner
|
||||||
|
lxqt-session
|
||||||
|
lxqt-sudo
|
||||||
|
lxqt-themes
|
||||||
|
lxqt-build-tools
|
||||||
|
|
||||||
|
compton-conf
|
||||||
|
lximage-qt
|
||||||
|
obconf-qt
|
||||||
|
openbox
|
||||||
|
pcmanfm-qt
|
||||||
|
qterminal
|
||||||
|
liblxqt
|
||||||
|
libqtxdg
|
||||||
|
lxmenu-data
|
||||||
|
libfm-qt
|
||||||
|
libfm
|
||||||
|
qtermwidget
|
||||||
|
libsysstat
|
||||||
|
libstatgrab
|
||||||
|
qps
|
||||||
37
data/pkglists/xorg.list
Normal file
37
data/pkglists/xorg.list
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
libdmx
|
||||||
|
libfontenc
|
||||||
|
libice
|
||||||
|
libpciaccess
|
||||||
|
libsm
|
||||||
|
libx11
|
||||||
|
libxau
|
||||||
|
libxaw
|
||||||
|
libxcomposite
|
||||||
|
libxcursor
|
||||||
|
libxdamage
|
||||||
|
libxdmcp
|
||||||
|
libxext
|
||||||
|
libxfixes
|
||||||
|
libxfont2
|
||||||
|
libxi|libxft
|
||||||
|
libxinerama
|
||||||
|
libxkbfile
|
||||||
|
libxkbui
|
||||||
|
libxmu
|
||||||
|
libxpm
|
||||||
|
libxrandr
|
||||||
|
libxrender
|
||||||
|
libxres
|
||||||
|
libxshmfence
|
||||||
|
libxss
|
||||||
|
libxt
|
||||||
|
libxtst
|
||||||
|
libxv
|
||||||
|
libxvmc
|
||||||
|
libxxf86vm
|
||||||
|
pixman
|
||||||
|
xbitmaps
|
||||||
|
xkeyboard-config
|
||||||
|
xorgproto
|
||||||
|
xterm
|
||||||
|
xtrans
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
DIRMODE = -dm0755
|
|
||||||
MODE = -m0755
|
|
||||||
|
|
||||||
CPIOHOOKS = \
|
|
||||||
$(wildcard hooks/*)
|
|
||||||
|
|
||||||
CPIOINST = \
|
|
||||||
$(wildcard install/*)
|
|
||||||
|
|
||||||
SCRIPT = \
|
|
||||||
$(wildcard script/*)
|
|
||||||
|
|
||||||
install_initcpio:
|
|
||||||
install $(DIRMODE) $(DESTDIR)$(CPIODIR)/hooks
|
|
||||||
install $(MODE) $(CPIOHOOKS) $(DESTDIR)$(CPIODIR)/hooks
|
|
||||||
|
|
||||||
install $(DIRMODE) $(DESTDIR)$(CPIODIR)/install
|
|
||||||
install $(MODE) $(CPIOINST) $(DESTDIR)$(CPIODIR)/install
|
|
||||||
install $(MODE) $(SCRIPT) $(DESTDIR)$(CPIODIR)
|
|
||||||
|
|
||||||
install: install_initcpio
|
|
||||||
|
|
||||||
.PHONY: install
|
|
||||||
@@ -1,250 +0,0 @@
|
|||||||
# args: source, newroot, mountpoint
|
|
||||||
_mnt_dmsnapshot() {
|
|
||||||
local img="${1}"
|
|
||||||
local mnt="${2}"
|
|
||||||
local img_fullname="${img##*/}";
|
|
||||||
local img_name="${img_fullname%%.*}"
|
|
||||||
local dm_snap_name="${dm_snap_prefix}_${img_name}"
|
|
||||||
local ro_dev ro_dev_size rw_dev
|
|
||||||
|
|
||||||
ro_dev=$(losetup --find --show --read-only "${img}")
|
|
||||||
echo ${ro_dev} >> /run/artix/used_block_devices
|
|
||||||
ro_dev_size=$(blockdev --getsz ${ro_dev})
|
|
||||||
|
|
||||||
if [[ "${cow_persistent}" == "P" ]]; then
|
|
||||||
if [[ -f "/run/artix/cowspace/${cow_directory}/${img_name}.cow" ]]; then
|
|
||||||
msg ":: Found '/run/artix/cowspace/${cow_directory}/${img_name}.cow', using as persistent."
|
|
||||||
else
|
|
||||||
msg ":: Creating '/run/artix/cowspace/${cow_directory}/${img_name}.cow' as persistent."
|
|
||||||
truncate -s "${cow_spacesize}" "/run/artix/cowspace/${cow_directory}/${img_name}.cow"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if [[ -f "/run/artix/cowspace/${cow_directory}/${img_name}.cow" ]]; then
|
|
||||||
msg ":: Found '/run/artix/cowspace/${cow_directory}/${img_name}.cow' but non-persistent requested, removing."
|
|
||||||
rm -f "/run/artix/cowspace/${cow_directory}/${img_name}.cow"
|
|
||||||
fi
|
|
||||||
msg ":: Creating '/run/artix/cowspace/${cow_directory}/${img_name}.cow' as non-persistent."
|
|
||||||
truncate -s "${cow_spacesize}" "/run/artix/cowspace/${cow_directory}/${img_name}.cow"
|
|
||||||
fi
|
|
||||||
|
|
||||||
rw_dev=$(losetup --find --show "/run/artix/cowspace/${cow_directory}/${img_name}.cow")
|
|
||||||
echo ${rw_dev} >> /run/artix/used_block_devices
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
# args: source, newroot, mountpoint
|
|
||||||
_mnt_overlayfs() {
|
|
||||||
local src="${1}"
|
|
||||||
local newroot="${2}"
|
|
||||||
local mnt="${3}"
|
|
||||||
local work_dir="/run/artix/overlay_root/work"
|
|
||||||
local upper_dir="/run/artix/overlay_root/upper"
|
|
||||||
|
|
||||||
mkdir -p "${upper_dir}" "${work_dir}"
|
|
||||||
|
|
||||||
mount -t overlay overlay -o lowerdir="${src}",upperdir="${upper_dir}",workdir="${work_dir}" "${newroot}${mnt}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# args: /path/to/image_file, mountpoint
|
|
||||||
_mnt_sfs() {
|
|
||||||
local img="${1}"
|
|
||||||
local mnt="${2}"
|
|
||||||
local img_fullname="${img##*/}"
|
|
||||||
local sfs_dev
|
|
||||||
local oper=$( [[ -n "${ip}" && -n "${miso_http_srv}" ]] && echo "mv" || echo "cp" )
|
|
||||||
|
|
||||||
if [[ "${copytoram}" == "y" ]]; then
|
|
||||||
msg -n ":: Copying squashfs image to RAM..."
|
|
||||||
if ! "${oper}" "${img}" "/run/artix/copytoram/${img_fullname}" ; then
|
|
||||||
echo "ERROR: while copy '${img}' to '/run/artix/copytoram/${img_fullname}'"
|
|
||||||
launch_interactive_shell
|
|
||||||
fi
|
|
||||||
img="/run/artix/copytoram/${img_fullname}"
|
|
||||||
msg "done."
|
|
||||||
fi
|
|
||||||
sfs_dev=$(losetup --find --show --read-only "${img}")
|
|
||||||
echo ${sfs_dev} >> /run/artix/used_block_devices
|
|
||||||
_mnt_dev "${sfs_dev}" "${mnt}" "-r" "defaults"
|
|
||||||
}
|
|
||||||
|
|
||||||
# args: device, mountpoint, flags, opts
|
|
||||||
_mnt_dev() {
|
|
||||||
local dev="${1}"
|
|
||||||
local mnt="${2}"
|
|
||||||
local flg="${3}"
|
|
||||||
local opts="${4}"
|
|
||||||
|
|
||||||
mkdir -p "${mnt}"
|
|
||||||
|
|
||||||
msg ":: Mounting '${dev}' to '${mnt}'"
|
|
||||||
|
|
||||||
while ! poll_device "${dev}" 30; do
|
|
||||||
echo "ERROR: '${dev}' device did not show up after 30 seconds..."
|
|
||||||
echo " Falling back to interactive prompt"
|
|
||||||
echo " You can try to fix the problem manually, log out when you are finished"
|
|
||||||
launch_interactive_shell
|
|
||||||
done
|
|
||||||
|
|
||||||
if mount -o "${opts}" "${flg}" "${dev}" "${mnt}"; then
|
|
||||||
msg ":: Device '${dev}' mounted successfully."
|
|
||||||
else
|
|
||||||
echo "ERROR; Failed to mount '${dev}'"
|
|
||||||
echo " Falling back to interactive prompt"
|
|
||||||
echo " You can try to fix the problem manually, log out when you are finished"
|
|
||||||
launch_interactive_shell
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
_verify_checksum() {
|
|
||||||
local _status
|
|
||||||
cd "/run/artix/bootmnt/${artixbasedir}/${arch}"
|
|
||||||
sha512sum -c $1.sha512 > /tmp/checksum.log 2>&1
|
|
||||||
_status=$?
|
|
||||||
cd "${OLDPWD}"
|
|
||||||
return ${_status}
|
|
||||||
}
|
|
||||||
|
|
||||||
_verify_signature() {
|
|
||||||
local _status
|
|
||||||
cd "/run/artix/bootmnt/${artixbasedir}/${arch}"
|
|
||||||
gpg --homedir /gpg --status-fd 1 --verify $1.sfs.sig 2>/dev/null | grep -qE '^\[GNUPG:\] GOODSIG'
|
|
||||||
_status=$?
|
|
||||||
cd "${OLDPWD}"
|
|
||||||
return ${_status}
|
|
||||||
}
|
|
||||||
|
|
||||||
run_hook() {
|
|
||||||
[[ -z "${arch}" ]] && arch="$(uname -m)"
|
|
||||||
[[ -z "${copytoram_size}" ]] && copytoram_size="75%"
|
|
||||||
[[ -z "${artixbasedir}" ]] && artixbasedir="artix"
|
|
||||||
|
|
||||||
[[ -z "${dm_snap_prefix}" ]] && dm_snap_prefix="arch"
|
|
||||||
[[ -z "${artixdevice}" ]] && artixdevice="/dev/disk/by-label/${artixlabel}"
|
|
||||||
[[ -z "${cow_spacesize}" ]] && cow_spacesize="256M"
|
|
||||||
[[ -z "${overlay_root_size}" ]] && overlay_root_size="75%"
|
|
||||||
|
|
||||||
if [[ -n "${cow_label}" ]]; then
|
|
||||||
cow_device="/dev/disk/by-label/${cow_label}"
|
|
||||||
[[ -z "${cow_persistent}" ]] && cow_persistent="P"
|
|
||||||
elif [[ -n "${cow_device}" ]]; then
|
|
||||||
[[ -z "${cow_persistent}" ]] && cow_persistent="P"
|
|
||||||
else
|
|
||||||
cow_persistent="N"
|
|
||||||
fi
|
|
||||||
|
|
||||||
[[ -z "${cow_flags}" ]] && cow_flags="defaults"
|
|
||||||
[[ -z "${cow_directory}" ]] && cow_directory="persistent_${artixlabel}/${arch}"
|
|
||||||
[[ -z "${cow_chunksize}" ]] && cow_chunksize="8"
|
|
||||||
|
|
||||||
# set mount handler for artix
|
|
||||||
mount_handler="artix_mount_handler"
|
|
||||||
}
|
|
||||||
|
|
||||||
# This function is called normally from init script, but it can be called
|
|
||||||
# as chain from other mount handlers.
|
|
||||||
# args: /path/to/newroot
|
|
||||||
artix_mount_handler() {
|
|
||||||
local newroot="${1}"
|
|
||||||
|
|
||||||
if ! mountpoint -q "/run/artix/bootmnt"; then
|
|
||||||
_mnt_dev "${artixdevice}" "/run/artix/bootmnt" "-r" "defaults"
|
|
||||||
if [[ "${copytoram}" != "y" ]]; then
|
|
||||||
echo $(readlink -f ${artixdevice}) >> /run/artix/used_block_devices
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "${checksum}" == "y" ]]; then
|
|
||||||
for fs in rootfs livefs;do
|
|
||||||
if [[ -f "/run/artix/bootmnt/${artixbasedir}/${arch}/${fs}.sfs" ]]; then
|
|
||||||
if [[ -f "/run/artix/bootmnt/${artixbasedir}/${arch}/${fs}.sha512" ]]; then
|
|
||||||
msg -n ":: Self-test requested, please wait..."
|
|
||||||
if _verify_checksum "${fs}"; then
|
|
||||||
msg "done. Checksum is OK, continue booting."
|
|
||||||
else
|
|
||||||
echo "ERROR: one or more files are corrupted"
|
|
||||||
echo "see /tmp/checksum.log for details"
|
|
||||||
launch_interactive_shell
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "ERROR: checksum=y option specified but ${artixbasedir}/${arch}/${fs}.sha512 not found"
|
|
||||||
launch_interactive_shell
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "${verify}" == "y" ]]; then
|
|
||||||
for fs in rootfs livefs;do
|
|
||||||
if [[ -f "/run/artix/bootmnt/${artixbasedir}/${arch}/${fs}.sfs" ]]; then
|
|
||||||
if [[ -f "/run/artix/bootmnt/${artixbasedir}/${arch}/${fs}.sfs.sig" ]]; then
|
|
||||||
msg -n ":: Signature verification requested, please wait..."
|
|
||||||
if _verify_signature "${fs}"; then
|
|
||||||
msg "done. Signature is OK, continue booting."
|
|
||||||
else
|
|
||||||
echo "ERROR: one or more files are corrupted"
|
|
||||||
launch_interactive_shell
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "ERROR: verify=y option specified but ${artixbasedir}/${arch}/${fs}.sfs.sig not found"
|
|
||||||
launch_interactive_shell
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "${copytoram}" == "y" ]]; then
|
|
||||||
msg ":: Mounting /run/artix/copytoram (tmpfs) filesystem, size=${copytoram_size}"
|
|
||||||
mkdir -p /run/artix/copytoram
|
|
||||||
mount -t tmpfs -o "size=${copytoram_size}",mode=0755 copytoram /run/artix/copytoram
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n "${cow_device}" ]]; then
|
|
||||||
_mnt_dev "${cow_device}" "/run/artix/cowspace" "-r" "${cow_flags}"
|
|
||||||
echo $(readlink -f ${cow_device}) >> /run/artix/used_block_devices
|
|
||||||
mount -o remount,rw "/run/artix/cowspace"
|
|
||||||
else
|
|
||||||
msg ":: Mounting /run/artix/cowspace (tmpfs) filesystem, size=${cow_spacesize}..."
|
|
||||||
mkdir -p /run/artix/cowspace
|
|
||||||
mount -t tmpfs -o "size=${cow_spacesize}",mode=0755 cowspace /run/artix/cowspace
|
|
||||||
fi
|
|
||||||
mkdir -p -m 0700 "/run/artix/cowspace/${cow_directory}"
|
|
||||||
|
|
||||||
msg -n ":: Mounting overlay root (tmpfs) filesystem, size=${overlay_root_size}..."
|
|
||||||
mkdir -p /run/artix/overlay_root
|
|
||||||
mount -t tmpfs -o "size=${overlay_root_size}",mode=0755 overlay_root /run/artix/overlay_root
|
|
||||||
|
|
||||||
local src="/run/artix/bootmnt/${artixbasedir}/${arch}"
|
|
||||||
local dest_sfs="/run/artix/sfs" dest_img="/run/artix/img"
|
|
||||||
local lower_dir
|
|
||||||
|
|
||||||
for sfs in livefs rootfs;do
|
|
||||||
if [[ -f "${src}/${sfs}.sfs" ]]; then
|
|
||||||
_mnt_sfs "${src}/${sfs}.sfs" "${dest_sfs}/${sfs}"
|
|
||||||
if [[ -f "${dest_sfs}/${sfs}/${sfs}.img" ]]; then
|
|
||||||
mkdir -p ${dest_img}
|
|
||||||
lower_dir=${lower_dir:-}${lower_dir:+:}"${dest_img}/${sfs}"
|
|
||||||
_mnt_dmsnapshot "${dest_sfs}/${sfs}/${sfs}.img" "${dest_img}/${sfs}"
|
|
||||||
else
|
|
||||||
lower_dir=${lower_dir:-}${lower_dir:+:}"${dest_sfs}/${sfs}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
_mnt_overlayfs "${lower_dir}" "${newroot}" "/"
|
|
||||||
|
|
||||||
if [[ "${copytoram}" == "y" ]]; then
|
|
||||||
umount -d /run/artix/bootmnt
|
|
||||||
mkdir -p /run/artix/bootmnt/${artixbasedir}/${arch}
|
|
||||||
mount -o bind /run/artix/copytoram /run/artix/bootmnt/${artixbasedir}/${arch}
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# vim:ft=sh:ts=4:sw=4:et:
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
# vim: set ft=sh:
|
|
||||||
|
|
||||||
run_hook () {
|
|
||||||
[[ -n "${img_label}" ]] && img_dev="/dev/disk/by-label/${img_label}"
|
|
||||||
[[ -z "${img_flags}" ]] && img_flags="defaults"
|
|
||||||
if [[ -n "${img_dev}" && -n "${img_loop}" ]]; then
|
|
||||||
mount_handler="artix_loop_mount_handler"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
artix_loop_mount_handler () {
|
|
||||||
newroot="${1}"
|
|
||||||
|
|
||||||
local _dev_loop
|
|
||||||
|
|
||||||
msg ":: Setup a loop device from ${img_loop} located at device ${img_dev}"
|
|
||||||
_mnt_dev "${img_dev}" "/run/artix/img_dev" "-r" "${img_flags}"
|
|
||||||
if [[ "${copytoram}" != "y" ]]; then
|
|
||||||
echo $(readlink -f ${img_dev}) >> /run/artix/used_block_devices
|
|
||||||
fi
|
|
||||||
|
|
||||||
if _dev_loop=$(losetup --find --show --read-only "/run/artix/img_dev/${img_loop}"); then
|
|
||||||
artixdevice="${_dev_loop}"
|
|
||||||
else
|
|
||||||
echo "ERROR: Setting loopback device for file '/run/artix/img_dev/${img_loop}'"
|
|
||||||
launch_interactive_shell
|
|
||||||
fi
|
|
||||||
|
|
||||||
artix_mount_handler ${newroot}
|
|
||||||
|
|
||||||
if [[ "${copytoram}" == "y" ]]; then
|
|
||||||
losetup -d ${_dev_loop} 2>/dev/null
|
|
||||||
umount /run/artix/img_dev
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
# vim: set ft=sh:
|
|
||||||
|
|
||||||
run_hook () {
|
|
||||||
# Do *not* declare 'bootif_dev' local! We need it in run_latehook().
|
|
||||||
local i net_mac bootif_mac
|
|
||||||
# These variables will be parsed from /tmp/net-*.conf generated by ipconfig
|
|
||||||
local DEVICE
|
|
||||||
local IPV4ADDR IPV4BROADCAST IPV4NETMASK IPV4GATEWAY IPV4DNS0 IPV4DNS1
|
|
||||||
local HOSTNAME DNSDOMAIN NISDOMAIN ROOTSERVER ROOTPATH
|
|
||||||
local filename
|
|
||||||
# /tmp/net-*.conf
|
|
||||||
|
|
||||||
if [[ -n "${ip}" ]]; then
|
|
||||||
if [[ -n "${BOOTIF}" ]]; then
|
|
||||||
bootif_mac=${BOOTIF#01-}
|
|
||||||
bootif_mac=${bootif_mac//-/:}
|
|
||||||
for i in /sys/class/net/*/address; do
|
|
||||||
read net_mac < ${i}
|
|
||||||
if [[ "${bootif_mac}" == "${net_mac}" ]]; then
|
|
||||||
bootif_dev=${i#/sys/class/net/}
|
|
||||||
bootif_dev=${bootif_dev%/address}
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [[ "${ip}" == "dhcp" ]]; then
|
|
||||||
ip=":::::${bootif_dev}:dhcp"
|
|
||||||
else
|
|
||||||
ip="${ip}::${bootif_dev}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# setup network and save some values
|
|
||||||
if ! ipconfig -t 20 "ip=${ip}"; then
|
|
||||||
echo "ERROR; Failed to configure network"
|
|
||||||
echo " Falling back to interactive prompt"
|
|
||||||
echo " You can try to fix the problem manually, log out when you are finished"
|
|
||||||
launch_interactive_shell
|
|
||||||
fi
|
|
||||||
|
|
||||||
. /tmp/net-*.conf
|
|
||||||
|
|
||||||
pxeserver=${ROOTSERVER}
|
|
||||||
|
|
||||||
# setup DNS resolver
|
|
||||||
if [[ "${IPV4DNS0}" != "0.0.0.0" ]]; then
|
|
||||||
echo "# added by artix_pxe_common hook" > /etc/resolv.conf
|
|
||||||
echo "nameserver ${IPV4DNS0}" >> /etc/resolv.conf
|
|
||||||
fi
|
|
||||||
if [[ "${IPV4DNS1}" != "0.0.0.0" ]]; then
|
|
||||||
echo "nameserver ${IPV4DNS1}" >> /etc/resolv.conf
|
|
||||||
fi
|
|
||||||
if [[ -n "${DNSDOMAIN}" ]]; then
|
|
||||||
echo "search ${DNSDOMAIN}" >> /etc/resolv.conf
|
|
||||||
echo "domain ${DNSDOMAIN}" >> /etc/resolv.conf
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
run_latehook () {
|
|
||||||
if [[ -n "${ip}" ]]; then
|
|
||||||
[[ -z "${copy_resolvconf}" ]] && copy_resolvconf="y"
|
|
||||||
|
|
||||||
if [[ "${copytoram}" == "y" ]]; then
|
|
||||||
if [[ -n "${bootif_dev}" ]]; then
|
|
||||||
ip addr flush dev "${bootif_dev}"
|
|
||||||
ip link set "${bootif_dev}" down
|
|
||||||
fi
|
|
||||||
elif [[ "${copy_resolvconf}" != "n" && -f /etc/resolv.conf ]]; then
|
|
||||||
cp /etc/resolv.conf /new_root/etc/resolv.conf
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
# vim: set ft=sh:
|
|
||||||
|
|
||||||
run_hook() {
|
|
||||||
if [[ -n "${ip}" && -n "${artix_http_srv}" ]]; then
|
|
||||||
|
|
||||||
# booting with http is always copy-to-ram, so set here to make sure
|
|
||||||
# addresses are flushed and interface is set down
|
|
||||||
copytoram="y"
|
|
||||||
|
|
||||||
artix_http_srv=$(eval echo ${artix_http_srv})
|
|
||||||
[[ -z "${artix_http_spc}" ]] && artix_http_spc="75%"
|
|
||||||
|
|
||||||
mount_handler="artix_pxe_http_mount_handler"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Fetch a file with CURL
|
|
||||||
#
|
|
||||||
# $1 URL
|
|
||||||
# $2 Destination directory inside httpspace/${artixbasedir}
|
|
||||||
_curl_get() {
|
|
||||||
local _url="${1}"
|
|
||||||
local _dst="${2}"
|
|
||||||
|
|
||||||
msg ":: Downloading '${_url}'"
|
|
||||||
if ! curl -L -f -o "/run/artix/httpspace/${artixbasedir}${_dst}/${_url##*/}" --create-dirs "${_url}"; then
|
|
||||||
echo "ERROR: Downloading '${_url}'"
|
|
||||||
echo " Falling back to interactive prompt"
|
|
||||||
echo " You can try to fix the problem manually, log out when you are finished"
|
|
||||||
launch_interactive_shell
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
artix_pxe_http_mount_handler () {
|
|
||||||
newroot="${1}"
|
|
||||||
|
|
||||||
msg ":: Mounting /run/artix/httpspace (tmpfs) filesystem, size='${artix_http_spc}'"
|
|
||||||
mkdir -p "/run/artix/httpspace"
|
|
||||||
mount -t tmpfs -o size="${artix_http_spc}",mode=0755 httpspace "/run/artix/httpspace"
|
|
||||||
|
|
||||||
local _src=${artix_http_srv}${artixbasedir}/${arch}
|
|
||||||
|
|
||||||
for sfs in livefs rootfs;do
|
|
||||||
if [[ ! -z "$( curl -s --head "${_src}/${sfs}.sfs" | grep "OK" )" ]]; then
|
|
||||||
_curl_get "${_src}/${sfs}.sfs" "/${arch}"
|
|
||||||
|
|
||||||
if [[ "${checksum}" == "y" ]]; then
|
|
||||||
_curl_get "${_src}/${sfs}.md5" "/${arch}"
|
|
||||||
fi
|
|
||||||
if [[ "${verify}" == "y" ]]; then
|
|
||||||
_curl_get "${_src}/${sfs}.sfs.sig" "/${arch}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
mkdir -p "/run/artix/bootmnt"
|
|
||||||
mount -o bind /run/artix/httpspace /run/artix/bootmnt
|
|
||||||
|
|
||||||
artix_mount_handler ${newroot}
|
|
||||||
}
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
# vim: set ft=sh:
|
|
||||||
|
|
||||||
run_earlyhook() {
|
|
||||||
if [[ -n "${ip}" && -n "${artix_nbd_srv}" ]]; then
|
|
||||||
# Module autoloading like with loop devices does not work, doing manually...
|
|
||||||
modprobe nbd 2> /dev/null
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
run_hook() {
|
|
||||||
if [[ -n "${ip}" && -n "${artix_nbd_srv}" ]]; then
|
|
||||||
|
|
||||||
artix_nbd_srv=$(eval echo ${artix_nbd_srv})
|
|
||||||
[[ -z "${artix_nbd_name}" ]] && artix_nbd_name="artix"
|
|
||||||
|
|
||||||
mount_handler="artix_pxe_nbd_mount_handler"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
artix_pxe_nbd_mount_handler () {
|
|
||||||
newroot="${1}"
|
|
||||||
|
|
||||||
msg ":: Waiting for boot device..."
|
|
||||||
while ! poll_device /dev/nbd0 30; do
|
|
||||||
echo "ERROR: boot device didn't show up after 30 seconds..."
|
|
||||||
echo " Falling back to interactive prompt"
|
|
||||||
echo " You can try to fix the problem manually, log out when you are finished"
|
|
||||||
launch_interactive_shell
|
|
||||||
done
|
|
||||||
|
|
||||||
msg ":: Setup NBD from ${artix_nbd_srv} at /dev/nbd0"
|
|
||||||
if [[ "${copytoram}" != "n" ]]; then
|
|
||||||
nbd-client ${artix_nbd_srv} -N ${artix_nbd_name} /dev/nbd0
|
|
||||||
copytoram="y"
|
|
||||||
else
|
|
||||||
nbd-client ${artix_nbd_srv} -N ${artix_nbd_name} -persist /dev/nbd0
|
|
||||||
fi
|
|
||||||
|
|
||||||
artixdevice=/dev/nbd0
|
|
||||||
|
|
||||||
artix_mount_handler ${newroot}
|
|
||||||
|
|
||||||
if [[ "${copytoram}" == "y" ]]; then
|
|
||||||
msg ":: Disconnect NBD from ${artix_nbd_srv} at /dev/nbd0"
|
|
||||||
nbd-client -d /dev/nbd0
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
# vim: set ft=sh:
|
|
||||||
|
|
||||||
run_hook() {
|
|
||||||
if [[ -n "${ip}" && -n "${artix_nfs_srv}" ]]; then
|
|
||||||
|
|
||||||
artix_nfs_srv=$(eval echo ${artix_nfs_srv})
|
|
||||||
[[ -n "${artix_nfs_opt}" ]] && artix_nfs_opt="-o ${artix_nfs_opt}"
|
|
||||||
|
|
||||||
mount_handler="artix_nfs_mount_handler"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
artix_nfs_mount_handler() {
|
|
||||||
newroot="${1}"
|
|
||||||
mkdir -p "/run/artix/bootmnt"
|
|
||||||
msg ":: Mounting '${artix_nfs_srv}'"
|
|
||||||
# Do not put "${artix_nfs_opt}" nfsmount fails!
|
|
||||||
if ! nfsmount ${artix_nfs_opt} "${artix_nfs_srv}" "/run/artix/bootmnt"; then
|
|
||||||
echo "ERROR: Mounting '${artix_nfs_srv}'"
|
|
||||||
echo " Falling back to interactive prompt"
|
|
||||||
echo " You can try to fix the problem manually, log out when you are finished"
|
|
||||||
launch_interactive_shell
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "${copytoram}" != "n" ]]; then
|
|
||||||
copytoram="y"
|
|
||||||
fi
|
|
||||||
|
|
||||||
artix_mount_handler ${newroot}
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
run_cleanuphook() {
|
|
||||||
rm -rf /usr/lib/modules
|
|
||||||
cp -ax / /run/initramfs
|
|
||||||
}
|
|
||||||
|
|
||||||
# vim: set ft=sh ts=4 sw=4 et:
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
build() {
|
|
||||||
add_module "cdrom"
|
|
||||||
add_module "loop"
|
|
||||||
add_module "dm-snapshot"
|
|
||||||
add_module "overlay"
|
|
||||||
|
|
||||||
add_runscript
|
|
||||||
|
|
||||||
add_binary /usr/lib/udev/cdrom_id
|
|
||||||
add_binary blockdev
|
|
||||||
add_binary dmsetup
|
|
||||||
add_binary losetup
|
|
||||||
add_binary mountpoint
|
|
||||||
add_binary truncate
|
|
||||||
add_binary gpg
|
|
||||||
add_binary grep
|
|
||||||
|
|
||||||
add_file /usr/lib/udev/rules.d/60-cdrom_id.rules
|
|
||||||
add_file /usr/lib/udev/rules.d/10-dm.rules
|
|
||||||
add_file /usr/lib/udev/rules.d/95-dm-notify.rules
|
|
||||||
add_file /usr/lib/initcpio/udev/11-dm-initramfs.rules /usr/lib/udev/rules.d/11-dm-initramfs.rules
|
|
||||||
if [[ $ARTIX_GNUPG_FD ]]; then
|
|
||||||
mkdir -p "$BUILDROOT$dest"/gpg
|
|
||||||
gpg --homedir "$BUILDROOT$dest"/gpg --import <&$ARTIX_GNUPG_FD
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# vim: set ft=sh ts=4 sw=4 et:
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
build() {
|
|
||||||
add_module "radeon"
|
|
||||||
add_module "nouveau"
|
|
||||||
add_module "i915"
|
|
||||||
add_module "via-agp"
|
|
||||||
add_module "sis-agp"
|
|
||||||
add_module "intel-agp"
|
|
||||||
}
|
|
||||||
|
|
||||||
help() {
|
|
||||||
cat << HELPEOF
|
|
||||||
Adds all common KMS drivers to the initramfs image.
|
|
||||||
HELPEOF
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
build() {
|
|
||||||
add_runscript
|
|
||||||
}
|
|
||||||
|
|
||||||
help() {
|
|
||||||
cat<<HELPEOF
|
|
||||||
This hook loads the necessary modules for boot via loop device.
|
|
||||||
HELPEOF
|
|
||||||
}
|
|
||||||
|
|
||||||
# vim: set ft=sh ts=4 sw=4 et:
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
build() {
|
|
||||||
add_checked_modules -f "(irda|phy|wimax|wireless|ppp_|plip|pppoe)" "/drivers/net/"
|
|
||||||
|
|
||||||
add_runscript
|
|
||||||
|
|
||||||
add_binary /usr/lib/initcpio/ipconfig /bin/ipconfig
|
|
||||||
|
|
||||||
# Add hosts support files+dns
|
|
||||||
add_symlink /usr/lib/libnss_files.so.2 $(readlink /usr/lib/libnss_files.so.2)
|
|
||||||
add_binary $(readlink -f /usr/lib/libnss_files.so.2)
|
|
||||||
add_symlink /usr/lib/libnss_dns.so.2 $(readlink /usr/lib/libnss_dns.so.2)
|
|
||||||
add_binary $(readlink -f /usr/lib/libnss_dns.so.2)
|
|
||||||
|
|
||||||
add_dir /etc
|
|
||||||
echo "hosts: files dns" > $BUILDROOT/etc/nsswitch.conf
|
|
||||||
}
|
|
||||||
|
|
||||||
help() {
|
|
||||||
cat<<HELPEOF
|
|
||||||
This hook loads the necessary modules for boot via PXE.
|
|
||||||
HELPEOF
|
|
||||||
}
|
|
||||||
|
|
||||||
# vim: set ft=sh ts=4 sw=4 et:
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
build() {
|
|
||||||
add_runscript
|
|
||||||
|
|
||||||
add_binary curl
|
|
||||||
|
|
||||||
add_file $(readlink -f /etc/ssl/certs/ca-certificates.crt) /etc/ssl/certs/ca-certificates.crt
|
|
||||||
}
|
|
||||||
|
|
||||||
help() {
|
|
||||||
cat<<HELPEOF
|
|
||||||
This hook loads the necessary modules for boot via PXE and HTTP.
|
|
||||||
HELPEOF
|
|
||||||
}
|
|
||||||
|
|
||||||
# vim: set ft=sh ts=4 sw=4 et:
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
build() {
|
|
||||||
add_module "nbd"
|
|
||||||
|
|
||||||
add_runscript
|
|
||||||
|
|
||||||
add_binary nbd-client
|
|
||||||
}
|
|
||||||
|
|
||||||
help() {
|
|
||||||
cat<<HELPEOF
|
|
||||||
This hook loads the necessary modules for boot via PXE and NBD.
|
|
||||||
HELPEOF
|
|
||||||
}
|
|
||||||
|
|
||||||
# vim: set ft=sh ts=4 sw=4 et:
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
build() {
|
|
||||||
add_module "nfs"
|
|
||||||
|
|
||||||
add_runscript
|
|
||||||
|
|
||||||
add_binary /usr/lib/initcpio/nfsmount /bin/nfsmount
|
|
||||||
}
|
|
||||||
|
|
||||||
help() {
|
|
||||||
cat <<HELPEOF
|
|
||||||
This hook loads the necessary modules for boot via PXE and NFS.
|
|
||||||
HELPEOF
|
|
||||||
}
|
|
||||||
|
|
||||||
# vim: set ft=sh ts=4 sw=4 et:
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
build() {
|
|
||||||
add_binary cp
|
|
||||||
|
|
||||||
add_runscript
|
|
||||||
|
|
||||||
add_file /etc/initcpio/artix_shutdown /shutdown
|
|
||||||
}
|
|
||||||
|
|
||||||
help() {
|
|
||||||
cat <<HELPEOF
|
|
||||||
This hook will create a shutdown initramfs in /run/initramfs
|
|
||||||
that we can pivot to on shutdown in order to unmount / and
|
|
||||||
and others mount points, dm-snapshot devices and loopback devices.
|
|
||||||
Mostly usefull for dm-snapshot persistent.
|
|
||||||
HELPEOF
|
|
||||||
}
|
|
||||||
|
|
||||||
# vim: set ft=sh ts=4 sw=4 et:
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
#!/bin/ash
|
|
||||||
|
|
||||||
# /oldroot depends on things inside /oldroot/run/artix...
|
|
||||||
mkdir /oldrun
|
|
||||||
mount -n --move /oldroot/run /oldrun
|
|
||||||
|
|
||||||
# Unmount all mounts now.
|
|
||||||
#umount $(mount | awk '$3 ~/^\/oldroot/ {print $3}' | sort -r)
|
|
||||||
umount $(mount | awk '$3 ~/^\/oldroot/ {if($3 != "/run/artix/bootmnt") print $3}' | sort -r)
|
|
||||||
|
|
||||||
# Remove all dm-snapshot devices.
|
|
||||||
dmsetup remove_all
|
|
||||||
|
|
||||||
# Remove all loopback devices.
|
|
||||||
for _lup in $(grep ^/dev/loop /oldrun/artix/used_block_devices | tac); do
|
|
||||||
if ! losetup -d ${_lup} 2> /dev/null; then
|
|
||||||
umount -d ${_lup}
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Unmount the space used to store *.cow.
|
|
||||||
umount /oldrun/artix/cowspace
|
|
||||||
|
|
||||||
# Unmount boot device if needed (no copytoram=y used)
|
|
||||||
if [[ ! -d /oldrun/artix/copytoram ]]; then
|
|
||||||
if [[ -d /oldrun/artix/img_dev ]]; then
|
|
||||||
umount /oldrun/artix/img_dev
|
|
||||||
else
|
|
||||||
umount /oldrun/artix/bootmnt
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# reboot / poweroff / halt, depending on the argument passed by init
|
|
||||||
# if something invalid is passed, we halt
|
|
||||||
case "$1" in
|
|
||||||
reboot|poweroff|halt) "$1" -f ;;
|
|
||||||
*) halt -f;;
|
|
||||||
esac
|
|
||||||
@@ -31,7 +31,7 @@ load_vars() {
|
|||||||
[[ -f $1 ]] || return 1
|
[[ -f $1 ]] || return 1
|
||||||
|
|
||||||
for var in {SRC,SRCPKG,PKG,LOG}DEST MAKEFLAGS PACKAGER CARCH GPGKEY; do
|
for var in {SRC,SRCPKG,PKG,LOG}DEST MAKEFLAGS PACKAGER CARCH GPGKEY; do
|
||||||
[[ -z ${!var:-} ]] && eval "$(source "$1"; printf "%s='%s'" "$var" "${!var}")"
|
[[ -z ${!var:-} ]] && eval "$(grep -a "^${var}=" "$1")"
|
||||||
done
|
done
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
@@ -85,15 +85,10 @@ init_artools_pkg(){
|
|||||||
packages-python
|
packages-python
|
||||||
packages-perl
|
packages-perl
|
||||||
packages-qt5
|
packages-qt5
|
||||||
packages-devel
|
|
||||||
packages-ruby
|
packages-ruby
|
||||||
packages-gtk
|
# packages-desktop
|
||||||
packages-gnome
|
# packages-kde
|
||||||
packages-cinnamon
|
# packages-gnome
|
||||||
packages-lxqt
|
|
||||||
packages-mate
|
|
||||||
packages-kde
|
|
||||||
packages-xfce
|
|
||||||
)
|
)
|
||||||
|
|
||||||
HOST_TREE_ARTIX=${HOST_TREE_ARTIX:-"gitea@${GIT_DOMAIN}:artixlinux"}
|
HOST_TREE_ARTIX=${HOST_TREE_ARTIX:-"gitea@${GIT_DOMAIN}:artixlinux"}
|
||||||
@@ -130,8 +125,6 @@ init_artools_iso(){
|
|||||||
|
|
||||||
INITSYS=${INITSYS:-'openrc'}
|
INITSYS=${INITSYS:-'openrc'}
|
||||||
|
|
||||||
GPG_KEY=${GPG_KEY:-''}
|
|
||||||
|
|
||||||
UPLIMIT=${UPLIMIT:-1000}
|
UPLIMIT=${UPLIMIT:-1000}
|
||||||
|
|
||||||
FILE_HOST="download.${DOMAIN}"
|
FILE_HOST="download.${DOMAIN}"
|
||||||
@@ -160,6 +153,15 @@ load_config(){
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
user_own(){
|
||||||
|
local flag=$2
|
||||||
|
chown ${flag} "${OWNER}:$(id --group ${OWNER})" "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
user_run(){
|
||||||
|
su ${OWNER} -c "$@"
|
||||||
|
}
|
||||||
|
|
||||||
load_user_info(){
|
load_user_info(){
|
||||||
OWNER=${SUDO_USER:-$USER}
|
OWNER=${SUDO_USER:-$USER}
|
||||||
|
|
||||||
|
|||||||
@@ -28,15 +28,6 @@ add_svc_runit(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
add_svc_s6(){
|
|
||||||
local mnt="$1" name="$2"
|
|
||||||
if [[ -d $mnt/etc/s6/sv/$name ]]; then
|
|
||||||
msg2 "Setting %s ..." "$name"
|
|
||||||
chroot $mnt s6-rc-bundle $name default &>/dev/null
|
|
||||||
chroot $mnt s6-rc -u change default &>/dev/null
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
set_xdm(){
|
set_xdm(){
|
||||||
if [[ -f $1/etc/conf.d/xdm ]];then
|
if [[ -f $1/etc/conf.d/xdm ]];then
|
||||||
local conf='DISPLAYMANAGER="'${DISPLAYMANAGER}'"'
|
local conf='DISPLAYMANAGER="'${DISPLAYMANAGER}'"'
|
||||||
@@ -79,14 +70,6 @@ configure_services(){
|
|||||||
add_svc_runit "$mnt" "$svc"
|
add_svc_runit "$mnt" "$svc"
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
's6')
|
|
||||||
for svc in ${SERVICES[@]}; do
|
|
||||||
add_svc_s6 "$mnt" "$svc"
|
|
||||||
done
|
|
||||||
for svc in ${SERVICES_LIVE[@]}; do
|
|
||||||
add_svc_s6 "$mnt" "$svc"
|
|
||||||
done
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
info "Done configuring [%s]" "${INITSYS}"
|
info "Done configuring [%s]" "${INITSYS}"
|
||||||
}
|
}
|
||||||
@@ -94,7 +77,7 @@ configure_services(){
|
|||||||
configure_system(){
|
configure_system(){
|
||||||
local mnt="$1"
|
local mnt="$1"
|
||||||
case ${INITSYS} in
|
case ${INITSYS} in
|
||||||
'openrc' | 'runit'|'s6')
|
'openrc' | 'runit')
|
||||||
configure_logind "$mnt" "elogind"
|
configure_logind "$mnt" "elogind"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -148,15 +131,6 @@ write_servicescfg_conf(){
|
|||||||
yaml+=$(write_yaml_map 4 'runlevel' 'default')
|
yaml+=$(write_yaml_map 4 'runlevel' 'default')
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
's6')
|
|
||||||
yaml+=$(write_yaml_map 0 'svDir' '/etc/s6/sv')
|
|
||||||
yaml+=$(write_yaml_map 0 'rcDir' '/etc/s6-rc')
|
|
||||||
yaml+=$(write_yaml_map 0 'services')
|
|
||||||
for svc in ${SERVICES[@]};do
|
|
||||||
yaml+=$(write_yaml_seq_map 2 'name' "$svc")
|
|
||||||
yaml+=$(write_yaml_map 4 'bundle' 'default')
|
|
||||||
done
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
yaml+=$(write_empty_line)
|
yaml+=$(write_empty_line)
|
||||||
printf '%s' "${yaml}"
|
printf '%s' "${yaml}"
|
||||||
@@ -185,14 +159,14 @@ configure_calamares(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
configure_image(){
|
configure_live_image(){
|
||||||
local fs="$1"
|
local fs="$1"
|
||||||
msg "Configuring [%s]" "${fs##*/}"
|
msg "Configuring [livefs]"
|
||||||
configure_hosts "$fs"
|
configure_hosts "$fs"
|
||||||
configure_system "$fs"
|
configure_system "$fs"
|
||||||
configure_services "$fs"
|
configure_services "$fs"
|
||||||
configure_calamares "$fs"
|
configure_calamares "$fs"
|
||||||
[[ ! -d "$fs/etc/artools" ]] && mkdir -p "$fs/etc/artools"
|
[[ ! -d "$fs/etc/artools" ]] && mkdir -p "$fs/etc/artools"
|
||||||
write_live_session_conf > "$fs/etc/artools/live.conf"
|
write_live_session_conf > "$fs/etc/artools/live.conf"
|
||||||
msg "Done configuring [%s]" "${fs##*/}"
|
msg "Done configuring [livefs]"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,38 +12,11 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
prepare_initcpio(){
|
|
||||||
msg2 "Copying initcpio ..."
|
|
||||||
local dest="$1"
|
|
||||||
cp /etc/initcpio/hooks/artix* $dest/etc/initcpio/hooks
|
|
||||||
cp /etc/initcpio/install/artix* $dest/etc/initcpio/install
|
|
||||||
cp /etc/initcpio/artix_shutdown $dest/etc/initcpio
|
|
||||||
}
|
|
||||||
|
|
||||||
prepare_initramfs(){
|
prepare_initramfs(){
|
||||||
local mnt="$1"
|
local src="$1" dest="$2"
|
||||||
cp ${DATADIR}/mkinitcpio.conf $mnt/etc/mkinitcpio-artix.conf
|
local kver=$(cat $src/usr/lib/modules/extramodules-ARTIX/version)
|
||||||
|
|
||||||
if [[ "${PROFILE}" != 'base' ]];then
|
dracut -fqM $dest/initramfs-${ARCH}.img $kver
|
||||||
sed -e 's/artix_pxe_common artix_pxe_http artix_pxe_nbd artix_pxe_nfs //' -i $mnt/etc/mkinitcpio-artix.conf
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n ${GPG_KEY} ]]; then
|
|
||||||
su ${OWNER} -c "gpg --export ${GPG_KEY} >/tmp/GPG_KEY"
|
|
||||||
exec 17<>/tmp/GPG_KEY
|
|
||||||
fi
|
|
||||||
local _kernel=$(cat $mnt/usr/lib/modules/*/version)
|
|
||||||
ARTIX_GNUPG_FD=${GPG_KEY:+17} artools-chroot $mnt \
|
|
||||||
/usr/bin/mkinitcpio -k ${_kernel} \
|
|
||||||
-c /etc/mkinitcpio-artix.conf \
|
|
||||||
-g /boot/initramfs.img
|
|
||||||
|
|
||||||
if [[ -n ${GPG_KEY} ]]; then
|
|
||||||
exec 17<&-
|
|
||||||
fi
|
|
||||||
if [[ -f /tmp/GPG_KEY ]]; then
|
|
||||||
rm /tmp/GPG_KEY
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
prepare_boot_extras(){
|
prepare_boot_extras(){
|
||||||
@@ -61,12 +34,22 @@ prepare_boot_extras(){
|
|||||||
configure_grub(){
|
configure_grub(){
|
||||||
local conf="$1/boot/grub/kernels.cfg"
|
local conf="$1/boot/grub/kernels.cfg"
|
||||||
sed -e "s|@iso_label@|${iso_label}|" -i $conf
|
sed -e "s|@iso_label@|${iso_label}|" -i $conf
|
||||||
|
|
||||||
|
# rd.vconsole.keymap=
|
||||||
|
# rd.live.overlay.size=
|
||||||
|
# root=live:<URL>
|
||||||
|
# rd.live.ram=1
|
||||||
|
# rd.live.overlay.readonly
|
||||||
|
# rd.live.overlay=none
|
||||||
|
# rd.writable.fsimg=1
|
||||||
|
# rd.live.dir=<path>
|
||||||
|
# rd.live.squashimg=<filename of SquashFS image>
|
||||||
|
# rd.live.overlay.overlayfs=1
|
||||||
}
|
}
|
||||||
|
|
||||||
prepare_grub(){
|
prepare_grub(){
|
||||||
local platform=i386-pc img='core.img' prefix=/boot/grub
|
local platform=i386-pc img='core.img' grub=$3/boot/grub efi=$3/efi/boot \
|
||||||
local lib=$1/usr/lib/grub theme=$2/usr/share/grub
|
lib=$1/usr/lib/grub prefix=/boot/grub theme=$2/usr/share/grub
|
||||||
local grub=${iso_root}/boot/grub efi=${iso_root}/efi/boot
|
|
||||||
|
|
||||||
prepare_dir ${grub}/${platform}
|
prepare_dir ${grub}/${platform}
|
||||||
|
|
||||||
|
|||||||
@@ -12,22 +12,25 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
make_sig () {
|
gen_iso_fn(){
|
||||||
local idir="$1" file="$2"
|
local vars=("artix") name
|
||||||
msg2 "Creating signature file..."
|
vars+=("${PROFILE}")
|
||||||
cd "$idir"
|
vars+=("${INITSYS}")
|
||||||
chown "${OWNER}:$(id --group ${OWNER})" "$idir"
|
case "${REPOSITORY}" in
|
||||||
su ${OWNER} -c "gpg --detach-sign --default-key ${GPG_KEY} $file.sfs"
|
'gremlins'|'goblins') vars+=("${REPOSITORY}") ;;
|
||||||
chown -R root "$idir"
|
esac
|
||||||
cd ${OLDPWD}
|
vars+=("${ISO_VERSION}")
|
||||||
|
vars+=("${ARCH}")
|
||||||
|
for n in ${vars[@]};do
|
||||||
|
name=${name:-}${name:+-}${n}
|
||||||
|
done
|
||||||
|
echo $name
|
||||||
}
|
}
|
||||||
|
|
||||||
make_checksum(){
|
clean_iso_root(){
|
||||||
local idir="$1" file="$2"
|
local dest="$1"
|
||||||
msg2 "Creating sha512sum ..."
|
msg "Deleting isoroot [%s] ..." "${dest##*/}"
|
||||||
cd $idir
|
rm -rf --one-file-system "$dest"
|
||||||
sha512sum $file.sfs > $file.sha512
|
|
||||||
cd ${OLDPWD}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# $1: image path
|
# $1: image path
|
||||||
@@ -87,13 +90,8 @@ make_sfs() {
|
|||||||
|
|
||||||
mksquashfs "${mksfs_args[@]}"
|
mksquashfs "${mksfs_args[@]}"
|
||||||
|
|
||||||
make_checksum "${dest}" "${name}"
|
|
||||||
${persist} && rm "${src}.img"
|
${persist} && rm "${src}.img"
|
||||||
|
|
||||||
if [[ -n ${GPG_KEY} ]];then
|
|
||||||
make_sig "${dest}" "${name}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
show_elapsed_time "${FUNCNAME}" "${timer_start}"
|
show_elapsed_time "${FUNCNAME}" "${timer_start}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,14 +40,13 @@ track_fs() {
|
|||||||
mount_overlay(){
|
mount_overlay(){
|
||||||
FS_ACTIVE_MOUNTS=()
|
FS_ACTIVE_MOUNTS=()
|
||||||
local lower= upper="$1" work="$2"
|
local lower= upper="$1" work="$2"
|
||||||
|
local fs=${upper##*/}
|
||||||
|
local rootfs="$work/rootfs" livefs="$work/livefs"
|
||||||
mkdir -p "${mnt_dir}/work"
|
mkdir -p "${mnt_dir}/work"
|
||||||
mkdir -p "$upper"
|
mkdir -p "$upper"
|
||||||
case $upper in
|
case $fs in
|
||||||
*/livefs) lower="$work/rootfs" ;;
|
livefs) lower="$rootfs" ;;
|
||||||
*/bootfs)
|
bootfs) lower="$livefs":"$rootfs" ;;
|
||||||
lower="$work/rootfs"
|
|
||||||
[[ -d "$work/livefs" ]] && lower="$work/livefs":"$work/rootfs"
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
track_fs -t overlay overlay -olowerdir="$lower",upperdir="$upper",workdir="${mnt_dir}/work" "$upper"
|
track_fs -t overlay overlay -olowerdir="$lower",upperdir="$upper",workdir="${mnt_dir}/work" "$upper"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,21 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
|
init_profile(){
|
||||||
|
local profdir="$1" prof="$2"
|
||||||
|
|
||||||
|
ROOT_LIST="$profdir/base/Packages-Root"
|
||||||
|
ROOT_OVERLAY="$profdir/base/root-overlay"
|
||||||
|
LIVE_LIST="$profdir/base/Packages-Live"
|
||||||
|
LIVE_OVERLAY="$profdir/base/live-overlay"
|
||||||
|
|
||||||
|
[[ -f "$profdir/$prof/Packages-Root" ]] && ROOT_LIST="$profdir/$prof/Packages-Root"
|
||||||
|
[[ -d "$profdir/$prof/root-overlay" ]] && ROOT_OVERLAY="$profdir/$prof/root-overlay"
|
||||||
|
|
||||||
|
[[ -f "$profdir/$prof/Packages-Live" ]] && LIVE_LIST="$profdir/$prof/Packages-Live"
|
||||||
|
[[ -d "$profdir/$prof/live-overlay" ]] && LIVE_OVERLAY="$profdir/$prof/live-overlay"
|
||||||
|
}
|
||||||
|
|
||||||
show_profile(){
|
show_profile(){
|
||||||
msg2 "iso_file: %s" "${iso_file}"
|
msg2 "iso_file: %s" "${iso_file}"
|
||||||
msg2 "AUTOLOGIN: %s" "${AUTOLOGIN}"
|
msg2 "AUTOLOGIN: %s" "${AUTOLOGIN}"
|
||||||
@@ -24,18 +39,15 @@ show_profile(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
load_profile(){
|
load_profile(){
|
||||||
local profile_dir="${DATADIR}/iso-profiles"
|
local prof="$1"
|
||||||
[[ -d ${WORKSPACE_DIR}/iso-profiles ]] && profile_dir=${WORKSPACE_DIR}/iso-profiles
|
local profdir="${DATADIR}/iso-profiles"
|
||||||
|
[[ -d ${WORKSPACE_DIR}/iso-profiles ]] && profdir=${WORKSPACE_DIR}/iso-profiles
|
||||||
|
|
||||||
ROOT_LIST="$profile_dir/${PROFILE}/Packages-Root"
|
init_profile "$profdir" "$prof"
|
||||||
ROOT_OVERLAY="$profile_dir/${PROFILE}/root-overlay"
|
|
||||||
|
|
||||||
[[ -f "$profile_dir/${PROFILE}/Packages-Live" ]] && LIVE_LIST="$profile_dir/${PROFILE}/Packages-Live"
|
[[ -f $profdir/$prof/profile.conf ]] || return 1
|
||||||
[[ -d "$profile_dir/${PROFILE}/live-overlay" ]] && LIVE_OVERLAY="$profile_dir/${PROFILE}/live-overlay"
|
|
||||||
|
|
||||||
[[ -f $profile_dir/${PROFILE}/profile.conf ]] || return 1
|
[[ -r $profdir/$prof/profile.conf ]] && . $profdir/$prof/profile.conf
|
||||||
|
|
||||||
[[ -r $profile_dir/${PROFILE}/profile.conf ]] && . $profile_dir/${PROFILE}/profile.conf
|
|
||||||
|
|
||||||
DISPLAYMANAGER=${DISPLAYMANAGER:-'none'}
|
DISPLAYMANAGER=${DISPLAYMANAGER:-'none'}
|
||||||
|
|
||||||
@@ -51,13 +63,13 @@ load_profile(){
|
|||||||
ADDGROUPS=${ADDGROUPS:-"video,power,optical,network,lp,scanner,wheel,users,log"}
|
ADDGROUPS=${ADDGROUPS:-"video,power,optical,network,lp,scanner,wheel,users,log"}
|
||||||
|
|
||||||
if [[ -z ${SERVICES[@]} ]];then
|
if [[ -z ${SERVICES[@]} ]];then
|
||||||
SERVICES=('acpid' 'bluetooth' 'cronie' 'cupsd' 'syslog-ng' 'connman')
|
SERVICES=('acpid' 'bluetooth' 'cronie' 'cupsd' 'syslog-ng' 'NetworkManager')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ${DISPLAYMANAGER} != "none" ]];then
|
if [[ ${DISPLAYMANAGER} != "none" ]];then
|
||||||
case "${INITSYS}" in
|
case "${INITSYS}" in
|
||||||
'openrc') SERVICES+=('xdm') ;;
|
'openrc') SERVICES+=('xdm') ;;
|
||||||
'runit'|'s6') SERVICES+=("${DISPLAYMANAGER}") ;;
|
'runit') SERVICES+=("${DISPLAYMANAGER}") ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,9 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
error_function() {
|
error_function() {
|
||||||
|
if [[ -p $logpipe ]]; then
|
||||||
|
rm "$logpipe"
|
||||||
|
fi
|
||||||
local func="$1"
|
local func="$1"
|
||||||
# first exit all subshells, then print the error
|
# first exit all subshells, then print the error
|
||||||
if (( ! BASH_SUBSHELL )); then
|
if (( ! BASH_SUBSHELL )); then
|
||||||
@@ -24,6 +27,20 @@ error_function() {
|
|||||||
exit 2
|
exit 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# $1: function
|
||||||
|
run_log(){
|
||||||
|
local func="$1" log_dir='/var/log/artools'
|
||||||
|
[[ ! -d $log_dir ]] && mkdir -p $log_dir
|
||||||
|
local logfile=${log_dir}/$(gen_iso_fn).$func.log
|
||||||
|
logpipe=$(mktemp -u "/tmp/$func.pipe.XXXXXXXX")
|
||||||
|
mkfifo "$logpipe"
|
||||||
|
tee "$logfile" < "$logpipe" &
|
||||||
|
local teepid=$!
|
||||||
|
$func &> "$logpipe"
|
||||||
|
wait $teepid
|
||||||
|
rm "$logpipe"
|
||||||
|
}
|
||||||
|
|
||||||
run_safe() {
|
run_safe() {
|
||||||
local restoretrap func="$1"
|
local restoretrap func="$1"
|
||||||
set -e
|
set -e
|
||||||
@@ -31,7 +48,11 @@ run_safe() {
|
|||||||
restoretrap=$(trap -p ERR)
|
restoretrap=$(trap -p ERR)
|
||||||
trap 'error_function $func' ERR
|
trap 'error_function $func' ERR
|
||||||
|
|
||||||
|
if ${log};then
|
||||||
|
run_log "$func"
|
||||||
|
else
|
||||||
"$func"
|
"$func"
|
||||||
|
fi
|
||||||
|
|
||||||
eval $restoretrap
|
eval $restoretrap
|
||||||
set +E
|
set +E
|
||||||
@@ -75,6 +96,12 @@ make_iso() {
|
|||||||
msg "Done [Build ISO]"
|
msg "Done [Build ISO]"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
install_packages(){
|
||||||
|
local fs="$1"
|
||||||
|
setarch "${ARCH}" mkchroot \
|
||||||
|
"${mkchroot_args[@]}" "${fs}" "${packages[@]}"
|
||||||
|
}
|
||||||
|
|
||||||
copy_overlay(){
|
copy_overlay(){
|
||||||
local src="$1" dest="$2"
|
local src="$1" dest="$2"
|
||||||
if [[ -e "$src" ]];then
|
if [[ -e "$src" ]];then
|
||||||
@@ -87,6 +114,10 @@ clean_up_image(){
|
|||||||
local path mnt="$1"
|
local path mnt="$1"
|
||||||
msg2 "Cleaning [%s]" "${mnt##*/}"
|
msg2 "Cleaning [%s]" "${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
|
path=$mnt/boot
|
||||||
if [[ -d "$path" ]]; then
|
if [[ -d "$path" ]]; then
|
||||||
find "$path" -name 'initramfs*.img' -delete &> /dev/null
|
find "$path" -name 'initramfs*.img' -delete &> /dev/null
|
||||||
@@ -111,6 +142,11 @@ clean_up_image(){
|
|||||||
if [[ -d $path ]];then
|
if [[ -d $path ]];then
|
||||||
find "$path" -mindepth 1 -delete &> /dev/null
|
find "$path" -mindepth 1 -delete &> /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ ${mnt##*/} == 'livefs' ]];then
|
||||||
|
rm -rf "$mnt/etc/pacman.d/gnupg"
|
||||||
|
fi
|
||||||
|
|
||||||
find "$mnt" -name *.pacnew -name *.pacsave -name *.pacorig -delete
|
find "$mnt" -name *.pacnew -name *.pacsave -name *.pacorig -delete
|
||||||
if [[ -f "$mnt/boot/grub/grub.cfg" ]]; then
|
if [[ -f "$mnt/boot/grub/grub.cfg" ]]; then
|
||||||
rm $mnt/boot/grub/grub.cfg
|
rm $mnt/boot/grub/grub.cfg
|
||||||
@@ -127,16 +163,12 @@ make_rootfs() {
|
|||||||
|
|
||||||
prepare_dir "${rootfs}"
|
prepare_dir "${rootfs}"
|
||||||
|
|
||||||
basestrap "${basestrap_args[@]}" "${rootfs}" "${packages[@]}"
|
install_packages "${rootfs}"
|
||||||
|
|
||||||
copy_overlay "${ROOT_OVERLAY}" "${rootfs}"
|
copy_overlay "${ROOT_OVERLAY}" "${rootfs}"
|
||||||
|
|
||||||
[[ -z ${LIVE_LIST} ]] && configure_image "${rootfs}"
|
|
||||||
|
|
||||||
clean_up_image "${rootfs}"
|
clean_up_image "${rootfs}"
|
||||||
|
|
||||||
: > ${work_dir}/rootfs.lock
|
|
||||||
|
|
||||||
msg "Done [Base installation] (rootfs)"
|
msg "Done [Base installation] (rootfs)"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -150,18 +182,16 @@ make_livefs() {
|
|||||||
|
|
||||||
mount_overlay "${livefs}" "${work_dir}"
|
mount_overlay "${livefs}" "${work_dir}"
|
||||||
|
|
||||||
basestrap "${basestrap_args[@]}" "${livefs}" "${packages[@]}"
|
install_packages "${livefs}"
|
||||||
|
|
||||||
copy_overlay "${LIVE_OVERLAY}" "${livefs}"
|
copy_overlay "${LIVE_OVERLAY}" "${livefs}"
|
||||||
|
|
||||||
configure_image "${livefs}"
|
configure_live_image "${livefs}"
|
||||||
|
|
||||||
umount_overlay
|
umount_overlay
|
||||||
|
|
||||||
clean_up_image "${livefs}"
|
clean_up_image "${livefs}"
|
||||||
|
|
||||||
: > ${work_dir}/livefs.lock
|
|
||||||
|
|
||||||
msg "Done [Live installation] (livefs)"
|
msg "Done [Live installation] (livefs)"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -179,10 +209,9 @@ make_bootfs() {
|
|||||||
|
|
||||||
mount_overlay "${bootfs}" "${work_dir}"
|
mount_overlay "${bootfs}" "${work_dir}"
|
||||||
|
|
||||||
prepare_initcpio "${bootfs}"
|
prepare_initramfs "${bootfs}" "${boot}"
|
||||||
prepare_initramfs "${bootfs}"
|
|
||||||
|
|
||||||
cp ${bootfs}/boot/initramfs.img ${boot}/initramfs-${ARCH}.img
|
# cp ${bootfs}/boot/initramfs.img ${boot}/initramfs-${ARCH}.img
|
||||||
prepare_boot_extras "${bootfs}" "${boot}"
|
prepare_boot_extras "${bootfs}" "${boot}"
|
||||||
|
|
||||||
umount_overlay
|
umount_overlay
|
||||||
@@ -197,12 +226,9 @@ make_grub(){
|
|||||||
if [[ ! -e ${work_dir}/grub.lock ]]; then
|
if [[ ! -e ${work_dir}/grub.lock ]]; then
|
||||||
msg "Prepare [/iso/boot/grub]"
|
msg "Prepare [/iso/boot/grub]"
|
||||||
|
|
||||||
local layer=${work_dir}/rootfs
|
prepare_grub "${work_dir}/rootfs" "${work_dir}/livefs" "${iso_root}"
|
||||||
[[ -n ${LIVE_LIST} ]] && layer=${work_dir}/livefs
|
|
||||||
|
|
||||||
prepare_grub "${work_dir}/rootfs" "$layer"
|
configure_grub "${iso_root}"
|
||||||
|
|
||||||
configure_grub
|
|
||||||
|
|
||||||
: > ${work_dir}/grub.lock
|
: > ${work_dir}/grub.lock
|
||||||
msg "Done [/iso/boot/grub]"
|
msg "Done [/iso/boot/grub]"
|
||||||
@@ -212,7 +238,7 @@ make_grub(){
|
|||||||
compress_images(){
|
compress_images(){
|
||||||
local timer=$(get_timer)
|
local timer=$(get_timer)
|
||||||
run_safe "make_iso"
|
run_safe "make_iso"
|
||||||
chown -R "${OWNER}:$(id --group ${OWNER})" "${iso_dir}"
|
user_own "${iso_dir}" "-R"
|
||||||
show_elapsed_time "${FUNCNAME}" "${timer}"
|
show_elapsed_time "${FUNCNAME}" "${timer}"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,7 +246,7 @@ prepare_images(){
|
|||||||
local timer=$(get_timer)
|
local timer=$(get_timer)
|
||||||
load_pkgs "${ROOT_LIST}" "${INITSYS}"
|
load_pkgs "${ROOT_LIST}" "${INITSYS}"
|
||||||
run_safe "make_rootfs"
|
run_safe "make_rootfs"
|
||||||
if [[ -n ${LIVE_LIST} ]]; then
|
if [[ -f ${LIVE_LIST} ]]; then
|
||||||
load_pkgs "${LIVE_LIST}" "${INITSYS}"
|
load_pkgs "${LIVE_LIST}" "${INITSYS}"
|
||||||
run_safe "make_livefs"
|
run_safe "make_livefs"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -23,12 +23,14 @@ get_remote_head(){
|
|||||||
get_pkg_org(){
|
get_pkg_org(){
|
||||||
local pkg="$1" org= sub=
|
local pkg="$1" org= sub=
|
||||||
case ${pkg} in
|
case ${pkg} in
|
||||||
ruby-*) org="packagesRuby" ;;
|
ruby-*) org=${pkg:0:6}; sub="${org:5}"; echo "packagesRuby" ;;
|
||||||
perl-*) org="packagesPerl" ;;
|
perl-*) org=${pkg:0:6}; sub="${org:5}"; echo "packagesPerl" ;;
|
||||||
python-*|python2-*) org="packagesPython" ;;
|
python-*) org=${pkg:0:8}; sub="${org:7}"; echo "packagesPython" ;;
|
||||||
*) sub=${pkg:0:1}; org="packages${sub^^}" ;;
|
python2-*) org=${pkg:0:9}; sub="${org:8}"; echo "packagesPython" ;;
|
||||||
|
lib32*) org=${pkg:0:7}; sub="${org:6}"; echo "packagesL" ;; #"packages${sub^^}" ;;
|
||||||
|
# lib*) org=${pkg:0:4}; sub="${org:3}"; echo "packagesLib${sub^^}" ;;
|
||||||
|
*) org=${pkg:0:1}; echo "packages${org^^}" ;;
|
||||||
esac
|
esac
|
||||||
echo $org
|
|
||||||
}
|
}
|
||||||
|
|
||||||
subrepo_push(){
|
subrepo_push(){
|
||||||
@@ -139,3 +141,22 @@ config_tree(){
|
|||||||
fi
|
fi
|
||||||
cd ..
|
cd ..
|
||||||
}
|
}
|
||||||
|
|
||||||
|
subrepo_new(){
|
||||||
|
local pkg="$1" tree="$2" team="${3:-$2}"
|
||||||
|
local dest=${TREE_DIR_ARTIX}/$tree/$pkg/trunk
|
||||||
|
|
||||||
|
cd ${TREE_DIR_ARTIX}/$tree
|
||||||
|
|
||||||
|
local org=$(get_pkg_org "$pkg")
|
||||||
|
|
||||||
|
create_repo "$pkg" "$org"
|
||||||
|
|
||||||
|
add_repo_to_team "$pkg" "$org" "$team"
|
||||||
|
|
||||||
|
subrepo_clone "$pkg" "$org"
|
||||||
|
|
||||||
|
prepare_dir "$dest"
|
||||||
|
|
||||||
|
commit_jenkins_files "$pkg"
|
||||||
|
}
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ find_repo(){
|
|||||||
local pkg="$1" stag="$2" unst="$3" repo=
|
local pkg="$1" stag="$2" unst="$3" repo=
|
||||||
|
|
||||||
for r in $(arch_repos "$stag" "$unst");do
|
for r in $(arch_repos "$stag" "$unst");do
|
||||||
[[ -f $pkg/repos/$r-${ARCH}/PKGBUILD ]] && repo=$r-${ARCH}
|
[[ -f $pkg/repos/$r-x86_64/PKGBUILD ]] && repo=$r-x86_64
|
||||||
[[ -f $pkg/repos/$r-any/PKGBUILD ]] && repo=$r-any
|
[[ -f $pkg/repos/$r-any/PKGBUILD ]] && repo=$r-any
|
||||||
done
|
done
|
||||||
echo $repo
|
echo $repo
|
||||||
@@ -127,8 +127,7 @@ is_valid_repo(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_cases(){
|
get_cases(){
|
||||||
local pkglist="${SYSCONFDIR}/pkglist.d/$1.list"
|
local pkglist="${DATADIR}/pkglists/$1.list"
|
||||||
|
|
||||||
local _space="s| ||g" _clean=':a;N;$!ba;s/\n/ /g' _com_rm="s|#.*||g"
|
local _space="s| ||g" _clean=':a;N;$!ba;s/\n/ /g' _com_rm="s|#.*||g"
|
||||||
|
|
||||||
local pkgs=($(sed "$_com_rm" "$pkglist" | sed "$_space" | sed "$_clean"))
|
local pkgs=($(sed "$_com_rm" "$pkglist" | sed "$_space" | sed "$_clean"))
|
||||||
@@ -144,26 +143,22 @@ get_artix_tree(){
|
|||||||
local pkg="$1" artix_tree="${2:-$3}" tree
|
local pkg="$1" artix_tree="${2:-$3}" tree
|
||||||
eval "case $pkg in
|
eval "case $pkg in
|
||||||
$(get_cases kernel)) tree=packages-kernel ;;
|
$(get_cases kernel)) tree=packages-kernel ;;
|
||||||
$(get_cases python)) tree=packages-python ;;
|
python-*|python2-*) tree=packages-python ;;
|
||||||
$(get_cases perl)) tree=packages-perl ;;
|
perl-*) tree=packages-perl ;;
|
||||||
$(get_cases ruby)) tree=packages-ruby ;;
|
ruby-*) tree=packages-ruby ;;
|
||||||
$(get_cases openrc)) tree=packages-openrc ;;
|
xorg*|xf86*|$(get_cases xorg)) tree=packages-xorg ;;
|
||||||
$(get_cases runit)) tree=packages-runit ;;
|
*-openrc) tree=packages-openrc ;;
|
||||||
$(get_cases s6)) tree=packages-s6 ;;
|
*-runit) tree=packages-runit ;;
|
||||||
$(get_cases media)) tree=packages-media ;;
|
qt5-*) tree=packages-qt5 ;;
|
||||||
$(get_cases xorg)) tree=packages-xorg ;;
|
lxqt*|$(get_cases lxqt)) tree=packages-lxqt ;;
|
||||||
$(get_cases qt5)) tree=packages-qt5 ;;
|
|
||||||
$(get_cases gtk)) tree=packages-gtk ;;
|
|
||||||
$(get_cases devel)) tree=packages-devel ;;
|
|
||||||
$(get_cases lxqt)) tree=packages-lxqt ;;
|
|
||||||
$(get_cases cinnamon)) tree=packages-cinnamon ;;
|
|
||||||
$(get_cases kde)) tree=packages-kde ;;
|
|
||||||
$(get_cases gnome)) tree=packages-gnome ;;
|
|
||||||
$(get_cases mate)) tree=packages-mate ;;
|
|
||||||
$(get_cases xfce)) tree=packages-xfce ;;
|
|
||||||
*) tree=$artix_tree
|
*) tree=$artix_tree
|
||||||
esac"
|
esac"
|
||||||
echo $tree
|
echo $tree
|
||||||
|
|
||||||
|
# $(get_cases freedesktop)) tree=packages-desktop ;;
|
||||||
|
# $(get_cases kde)) tree=packages-kde ;;
|
||||||
|
# $(get_cases gnome)) tree=packages-gnome ;;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get_import_path(){
|
get_import_path(){
|
||||||
|
|||||||
Reference in New Issue
Block a user