mirror of
https://gitlab.archlinux.org/tpowa/archboot.git
synced 2024-09-20 03:50:37 +02:00
don't allow new images on local image, better progressbars on new image
This commit is contained in:
parent
d146b64d01
commit
5ce5859639
4 changed files with 25 additions and 19 deletions
|
@ -56,12 +56,10 @@ _manage() {
|
|||
[[ -e /.launcher-running ]] && rm /.launcher-running
|
||||
_EXIT="$(cat ${_ANSWER})"
|
||||
if [[ "${_EXIT}" == "FULL" ]]; then
|
||||
_show_coffee
|
||||
update -full-system
|
||||
elif [[ "${_EXIT}" == "UPDATE" ]]; then
|
||||
_run_update_environment
|
||||
elif [[ "${_EXIT}" == "IMAGE" ]]; then
|
||||
_show_coffee
|
||||
update -latest-image
|
||||
fi
|
||||
exit 0
|
||||
|
|
|
@ -21,7 +21,8 @@ while [ $# -gt 0 ]; do
|
|||
-u|--u|-update|--update) _D_SCRIPTS="1" ;;
|
||||
-latest|--latest) _L_COMPLETE="1" ;;
|
||||
-latest-install|--latest-install) _L_INSTALL_COMPLETE="1";;
|
||||
-latest-image|--latest-image) _G_RELEASE="1" ;;
|
||||
-latest-image|--latest-image) _G_RELEASE="1"
|
||||
_L_INSTALL_COMPLETE="1";;
|
||||
-xfce|--xfce) _L_XFCE="1" ;;
|
||||
-sway|--sway) _L_SWAY="1" ;;
|
||||
-gnome|--gnome) _L_GNOME="1";;
|
||||
|
@ -44,7 +45,7 @@ if [[ -n "${_D_SCRIPTS}" ]]; then
|
|||
_download_latest
|
||||
fi
|
||||
# Generate new environment and launch it with kexec
|
||||
if [[ -n "${_L_COMPLETE}" || -n "${_L_INSTALL_COMPLETE}" ]]; then
|
||||
if [[ -n "${_L_COMPLETE}" || -n "${_L_INSTALL_COMPLETE}" ]] && [[ -z "${_G_RELEASE}" ]] ; then
|
||||
_update_installer_check
|
||||
touch /.update
|
||||
_TITLE="Archboot $(uname -m) | Basic Setup | New Environment"
|
||||
|
|
|
@ -346,37 +346,44 @@ _new_image() {
|
|||
_PRESET_LATEST="${_RUNNING_ARCH}-latest"
|
||||
_PRESET_LOCAL="${_RUNNING_ARCH}-local"
|
||||
_ISONAME="archboot-$(date +%Y.%m.%d-%H.%M)"
|
||||
_progress "1" "Removing files from /..."
|
||||
_clean_archboot
|
||||
_clean_kernel_cache
|
||||
[[ -d var/cache/pacman/pkg ]] && rm -f /var/cache/pacman/pkg/*
|
||||
mkdir /archboot
|
||||
cd /archboot || exit 1
|
||||
_W_DIR="$(mktemp -u archboot-release.XXX)"
|
||||
# create container
|
||||
_progress "5" "Creating archboot container..."
|
||||
archboot-"${_RUNNING_ARCH}"-create-container.sh "${_W_DIR}" -cc > "${_LOG}" || exit 1
|
||||
[[ -d "${_W_DIR}" ]] || mkdir -p "${_W_DIR}"
|
||||
touch "${_W_DIR}"/.archboot
|
||||
_create_container &
|
||||
_progress_wait "2" "33" "Generating container in ${_W_DIR}..." "5"
|
||||
_progress "34" "Create archboot.db in ${_W_DIR}..."
|
||||
_create_archboot_db "${_W_DIR}"/var/cache/pacman/pkg > "${_LOG}"
|
||||
# riscv64 does not support kexec at the moment
|
||||
if ! [[ "${_RUNNING_ARCH}" == "riscv64" ]]; then
|
||||
# removing not working lvm2 from latest image
|
||||
_progress "35" "Removing lvm2 from container..."
|
||||
${_NSPAWN} "${_W_DIR}" pacman -Rdd lvm2 --noconfirm &>"${_NO_LOG}"
|
||||
_progress "40" "Generating local ISO..."
|
||||
_progress_wait "36" "64" "Generating local ISO..." "5"
|
||||
# generate local iso in container, umount tmp it's a tmpfs and weird things could happen then
|
||||
${_NSPAWN} "${_W_DIR}" /bin/bash -c "umount /tmp;rm -rf /tmp/*; archboot-${_RUNNING_ARCH}-iso.sh -g -p=${_PRESET_LOCAL} \
|
||||
-i=${_ISONAME}-local-${_RUNNING_ARCH}" > "${_LOG}" || exit 1
|
||||
rm -rf "${_W_DIR}"/var/cache/pacman/pkg/*
|
||||
touch "${_W_DIR}"/.archboot
|
||||
(${_NSPAWN} "${_W_DIR}" /bin/bash -c "umount /tmp;rm -rf /tmp/*; archboot-${_RUNNING_ARCH}-iso.sh -g -p=${_PRESET_LOCAL} \
|
||||
-i=${_ISONAME}-local-${_RUNNING_ARCH}" > "${_LOG}"; rm -rf "${_W_DIR}"/var/cache/pacman/pkg/*; rm "${_W_DIR}"/.archboot) &
|
||||
_ram_check
|
||||
_progress "65" "Generating latest ISO..."
|
||||
_progress_wait "65" "71" "Generating latest ISO..." "5"
|
||||
# generate latest iso in container
|
||||
${_NSPAWN} "${_W_DIR}" /bin/bash -c "umount /tmp;rm -rf /tmp/*;archboot-${_RUNNING_ARCH}-iso.sh -g -p=${_PRESET_LATEST} \
|
||||
-i=${_ISONAME}-latest-${_RUNNING_ARCH}" > "${_LOG}" || exit 1
|
||||
touch "${_W_DIR}"/.archboot
|
||||
(${_NSPAWN} "${_W_DIR}" /bin/bash -c "umount /tmp;rm -rf /tmp/*;archboot-${_RUNNING_ARCH}-iso.sh -g -p=${_PRESET_LATEST} \
|
||||
-i=${_ISONAME}-latest-${_RUNNING_ARCH}" > "${_LOG}"; rm "${_W_DIR}"/.archboot) &
|
||||
_progress "72" "Installing lvm2 to container..."
|
||||
${_NSPAWN} "${_W_DIR}" pacman -Sy lvm2 --noconfirm &>"${_NO_LOG}"
|
||||
fi
|
||||
_progress "75" "Generating normal ISO..."
|
||||
_progress_wait "73" "97" "Generating normal ISO..." "5"
|
||||
touch "${_W_DIR}"/.archboot
|
||||
# generate iso in container
|
||||
${_NSPAWN} "${_W_DIR}" /bin/bash -c "umount /tmp;archboot-${_RUNNING_ARCH}-iso.sh -g \
|
||||
-i=${_ISONAME}-${_RUNNING_ARCH}" > "${_LOG}" || exit 1
|
||||
(${_NSPAWN} "${_W_DIR}" /bin/bash -c "umount /tmp;archboot-${_RUNNING_ARCH}-iso.sh -g \
|
||||
-i=${_ISONAME}-${_RUNNING_ARCH}" > "${_LOG}"; rm "${_W_DIR}"/.archboot) &
|
||||
_progress "98" "Cleanup container..."
|
||||
# move iso out of container
|
||||
mv "${_W_DIR}"/*.iso ./ &>"${_NO_LOG}"
|
||||
|
|
|
@ -74,10 +74,10 @@ usage () {
|
|||
echo -e " package cache (using kexec)."
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [[ "$(grep -w MemTotal /proc/meminfo | cut -d ':' -f2 | sed -e 's# ##g' -e 's#kB$##g')" -gt 3216000 ]]; then
|
||||
echo -e " \e[1m-latest-image\e[m Generate latest image files in /archboot directory."
|
||||
fi
|
||||
fi
|
||||
exit 0
|
||||
}
|
||||
# vim: set ft=sh ts=4 sw=4 et:
|
||||
|
|
Loading…
Reference in a new issue