From affa6e70a9da9b4538f85141e604e2189a175e0a Mon Sep 17 00:00:00 2001 From: bill-auger Date: Mon, 16 Oct 2017 23:40:09 -0400 Subject: enable offline install --- parabolaiso/mkparabolaiso | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) (limited to 'parabolaiso') diff --git a/parabolaiso/mkparabolaiso b/parabolaiso/mkparabolaiso index 7e70554..82eab30 100755 --- a/parabolaiso/mkparabolaiso +++ b/parabolaiso/mkparabolaiso @@ -16,6 +16,8 @@ iso_application="Parabola GNU/Linux-libre Live/Rescue CD" install_dir="parabola" work_dir="work" out_dir="out" +enable_offline_install='false' + # Show an INFO message # $1: message string @@ -77,6 +79,10 @@ _chroot_init() { _pacman "base" _pacman "syslinux" fi + # Restore live local repo cache + if [[ -d "${work_dir}/isorepo-${arch}" ]]; then + mv "${work_dir}/isorepo-${arch}" "${work_dir}/root-image/" + fi } _chroot_run() { @@ -152,6 +158,8 @@ _usage () echo " -D Set an install_dir. All files will by located here." echo " Default: '${install_dir}'" echo " NOTE: Max 8 characters, use only [a-z0-9]" + echo " -O Enable offline install." + echo " Default: '${enable_offline_install}'" echo " -w Set the working directory" echo " Default: '${work_dir}'" echo " -o Set the output directory" @@ -196,8 +204,10 @@ _show_config () { ;; run) _msg_info " Run command: ${run_cmd}" + _msg_info " Offline install: ${enable_offline_install}" ;; prepare) + _msg_info " Offline install: ${enable_offline_install}" ;; checksum) ;; @@ -243,17 +253,21 @@ _cleanup () { if [[ -d "${work_dir}/root-image/boot" ]]; then find "${work_dir}/root-image/boot" -type f -name 'vmlinuz*' -delete fi - # Delete pacman database sync cache files (*.tar.gz) - if [[ -d "${work_dir}/root-image/var/lib/pacman" ]]; then - find "${work_dir}/root-image/var/lib/pacman" -maxdepth 1 -type f -delete - fi - # Delete pacman database sync cache - if [[ -d "${work_dir}/root-image/var/lib/pacman/sync" ]]; then - find "${work_dir}/root-image/var/lib/pacman/sync" -delete - fi - # Delete pacman package cache - if [[ -d "${work_dir}/root-image/var/cache/pacman/pkg" ]]; then - find "${work_dir}/root-image/var/cache/pacman/pkg" -type f -delete + if [[ "${enable_offline_install}" == 'false' ]]; then + # Delete pacman database sync cache files (*.tar.gz) + if [[ -d "${work_dir}/root-image/var/lib/pacman" ]]; then + find "${work_dir}/root-image/var/lib/pacman" -maxdepth 1 -type f -delete + fi + # Delete pacman database sync cache + if [[ -d "${work_dir}/root-image/var/lib/pacman/sync" ]]; then + find "${work_dir}/root-image/var/lib/pacman/sync" -delete + fi + # Delete pacman package cache + if [[ -d "${work_dir}/root-image/var/cache/pacman/pkg" ]]; then + find "${work_dir}/root-image/var/cache/pacman/pkg" -type f -delete + fi + # Stash live local repo cache + mv "${work_dir}/root-image/isorepo" "${work_dir}/isorepo-${arch}" 2> /dev/null || true fi # Delete all log files, keeps empty dirs. if [[ -d "${work_dir}/root-image/var/log" ]]; then @@ -526,7 +540,7 @@ if [[ ${EUID} -ne 0 ]]; then _msg_error "This script must be run as root." 1 fi -while getopts 'p:r:C:L:P:A:D:w:o:vh' arg; do +while getopts 'p:r:C:L:P:A:D:Ow:o:vh' arg; do case "${arg}" in p) pkg_list="${pkg_list} ${OPTARG}" ;; r) run_cmd="${OPTARG}" ;; @@ -535,6 +549,7 @@ while getopts 'p:r:C:L:P:A:D:w:o:vh' arg; do P) iso_publisher="${OPTARG}" ;; A) iso_application="${OPTARG}" ;; D) install_dir="${OPTARG}" ;; + O) enable_offline_install='true' ;; w) work_dir="${OPTARG}" ;; o) out_dir="${OPTARG}" ;; v) quiet="n" ;; -- cgit v1.2.2