diff --git a/ublinux/rc.post.d/08-install-pkg b/ublinux/rc.post.d/08-install-pkg new file mode 100755 index 0000000..b60083c --- /dev/null +++ b/ublinux/rc.post.d/08-install-pkg @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +ENABLED=yes +[[ ${ENABLED} == "yes" ]] || exit 0 +DEBUGMODE=no + +[[ -d /usr/lib/ublinux ]] && { ROOTFS= ; CMD_CHROOT= ; } || { [[ -d /sysroot ]] && ROOTFS="/sysroot" || ROOTFS="."; CMD_CHROOT="chroot ${ROOTFS}"; } +SOURCE=${ROOTFS}/usr/lib/ublinux/functions; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +SOURCE=${ROOTFS}/usr/lib/ublinux/default; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +debug_mode "$0" "$@" + +SYSCONF="${ROOTFS}${SYSCONF}" +SOURCE=${SYSCONF}/config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null + +exec_install_pkg_tar(){ + find /memory/layer-base/*/install -maxdepth 1 -type f -name "*.pkg.tar.*" -exec pacman -U --noprogressbar --noconfirm {} + 2>/dev/null +} + +################ +##### MAIN ##### +################ + + # Если файл подключен как ресурс с функциями, то выйти + return 0 2>/dev/null && return 0 + + exec_install_pkg_tar $@ diff --git a/ublinux/rc.preinit/08-install-pkg b/ublinux/rc.preinit/08-install-pkg index 688559b..ecfa823 100755 --- a/ublinux/rc.preinit/08-install-pkg +++ b/ublinux/rc.preinit/08-install-pkg @@ -13,17 +13,17 @@ SYSCONF="${ROOTFS}${SYSCONF}" SOURCE=${SYSCONF}/config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null exec_install_pkg_tar(){ - [[ -n $(find /memory/layer-base/*/install/preinit -type f -name "*.pkg.tar.*" -print 2>/dev/null) ]] || return 0 - if [[ -n ${ROOTFS} ]]; then + LIST_PKG=$(find /memory/layer-base/*/install/preinit -type f -name "*.pkg.tar.*" -print 2>/dev/null) + if [[ -n ${ROOTFS} && -n ${LIST_PKG} ]]; then mount -t proc /proc /${ROOTFS}/proc mount -t sysfs /sys /${ROOTFS}/sys mount --bind /dev/ /${ROOTFS}/dev - LC_ALL=C LD_LIBRARY_PATH="${ROOTFS}/usr/lib" find /memory/layer-base/*/install/preinit -type f -name "*.pkg.tar.*" -exec ${ROOTFS}/usr/bin/pacman --quiet --sysroot ${ROOTFS} -U --noprogressbar --noconfirm {} + + LC_ALL=C LD_LIBRARY_PATH="${ROOTFS}/usr/lib" ${ROOTFS}/usr/bin/pacman --sysroot ${ROOTFS} -U --noprogressbar --noconfirm ${LIST_PKG} umount /${ROOTFS}/dev umount /${ROOTFS}/sys umount /${ROOTFS}/proc - else - find /memory/layer-base/*/install/preinit -type f -name "*.pkg.tar.*" -exec pacman --quiet -U --noprogressbar --noconfirm {} + + elif [[ -n ${LIST_PKG} ]]; then + pacman -U --noprogressbar --noconfirm ${LIST_PKG} fi }