diff options
-rwxr-xr-x | configs/profile/build.sh | 18 | ||||
-rwxr-xr-x | parabolaiso/mkparabolaiso | 38 |
2 files changed, 37 insertions, 19 deletions
diff --git a/configs/profile/build.sh b/configs/profile/build.sh index c26982a..3a49a8a 100755 --- a/configs/profile/build.sh +++ b/configs/profile/build.sh @@ -17,6 +17,7 @@ iso_version=$(date +%Y.%m.%d) iso_label="PARA_$(date +%Y%m)" iso_dirname='parabola' enable_offline_install='false' +offline_switch='' work_dir=./work out_dir=./out target='' @@ -137,7 +138,7 @@ make_packages() { if [[ "$enable_offline_install" == 'true' ]]; then if [[ -n ${_cache_packages} ]]; then # download any cache packages and prune obsolete packages - cache_only='true' setarch ${arch} mkparabolaiso ${verbose} -w ${work_dir}/${arch} -C ${pacman_conf} -D ${iso_dirname} -p "${_cache_packages}" -O install + setarch ${arch} mkparabolaiso ${verbose} -w ${work_dir}/${arch} -C ${pacman_conf} -D ${iso_dirname} -p "${_cache_packages}" ${offline_switch} cache fi # create 'isorepo' for offline install pushd ${work_dir}/${arch}/root-image/isorepo > /dev/null @@ -164,7 +165,6 @@ make_setup_mkinitcpio() { # Customize installation (root-image) make_customize_root_image() { - [[ "$enable_offline_install" == 'true' ]] && offline='-O' || offline='' cp -af ${releng_dir}/root-image ${work_dir}/${arch} @@ -177,7 +177,7 @@ make_customize_root_image() { setarch ${arch} mkparabolaiso ${verbose} -w ${work_dir}/${arch} \ -C ${pacman_conf} \ -D ${iso_dirname} \ - ${offline} \ + ${offline_switch} \ -r /root/customize_root_image.sh \ run rm ${work_dir}/${arch}/root-image/root/customize_root_image* @@ -310,11 +310,9 @@ make_aitab() { # Build all filesystem images specified in aitab (.fs.sfs .sfs) make_prepare() { - [[ "$enable_offline_install" == 'true' ]] && offline='-O' || offline='' - cp -a -l -f ${work_dir}/${arch}/root-image ${work_dir} setarch ${arch} mkparabolaiso ${verbose} -w ${work_dir} -D ${iso_dirname} pkglist - setarch ${arch} mkparabolaiso ${verbose} -w ${work_dir} -D ${iso_dirname} -C ${pacman_conf} ${offline} prepare + setarch ${arch} mkparabolaiso ${verbose} -w ${work_dir} -D ${iso_dirname} -C ${pacman_conf} ${offline_switch} prepare rm -rf ${work_dir}/root-image # rm -rf ${work_dir}/${arch}/root-image (if low space, this helps) @@ -337,7 +335,7 @@ while getopts 'E:T:V:L:D:OC:w:o:vh' arg; do V) iso_version="${OPTARG}" ;; L) iso_label="${OPTARG}" ;; D) iso_dirname="${OPTARG}" ;; - O) enable_offline_install='true' ;; + O) enable_offline_install='true' offline_switch='-O' ;; C) pacman_conf="${OPTARG}" ;; w) work_dir="${OPTARG}" ;; o) out_dir="${OPTARG}" ;; @@ -363,12 +361,12 @@ case "${target}" in esac if [[ "$enable_offline_install" == 'true' ]]; then iso_type='complete' - launch_msg="${launch_msg} (net-install or offline install)" + launch_msg="${launch_msg} (offline install enabled)" else iso_type='netinstall' - launch_msg="${launch_msg} (net-install only)" + launch_msg="${launch_msg} (net install only)" fi -iso_title="${iso_title} ${iso_edition} Edition ${iso_version}" +iso_title="${iso_title} - ${iso_edition} Edition ${iso_version}" iso_filename="parabola-${iso_edition}-${iso_arch}-${iso_type}-${iso_version}.iso" iso_filename=$(echo ${iso_filename} | tr '[:upper:]/' '[:lower:]-') iso_init=$(echo ${iso_edition} | cut -d '/' -f 1 | tr '[:upper:]' '[:lower:]') diff --git a/parabolaiso/mkparabolaiso b/parabolaiso/mkparabolaiso index f13b0ba..bd2db9f 100755 --- a/parabolaiso/mkparabolaiso +++ b/parabolaiso/mkparabolaiso @@ -192,7 +192,7 @@ _usage () } # Shows configuration according to command mode. -# $1: init | install | run | prepare | checksum | iso +# $1: init | install | cache | run | prepare | checksum | iso _show_config () { local _mode="$1" echo @@ -211,6 +211,10 @@ _show_config () { _msg_info " Offline install: ${enable_offline_install}" _msg_info " Packages: ${pkg_list}" ;; + cache) + _msg_info " Pacman config file: ${pacman_conf}" + _msg_info " Packages: ${pkg_list}" + ;; run) _msg_info " Run command: ${run_cmd}" _msg_info " Offline install: ${enable_offline_install}" @@ -251,9 +255,7 @@ _pacman () _msg_info "Packages installed successfully!" } -# Cache uninstalled packages in offline /isorepo and prune un-needed packages packages. -# Optimally, this function should be called only once after all packages are installed -# and even if there are no 'cache-only' packages. +# Cache uninstalled packages in offline /isorepo and prune obsolete packages. _pacman_cache () { _msg_info "Caching packages to '${work_dir}/root-image/'..." @@ -573,15 +575,30 @@ command_install () { if [[ -f "${work_dir}/install.${_pkg_list_hash}" ]]; then _msg_info "These packages are already installed, skipping." else - if [[ "${cache_only:-}" == 'true' ]]; then - _pacman_cache "${pkg_list}" - else - _pacman "${pkg_list}" - fi + _pacman "${pkg_list}" : > "${work_dir}/install.${_pkg_list_hash}" fi } +# Cache uninstalled packages in offline /isorepo and prune obsolete packages. +# Optimally, this function should be called only once after all packages are installed +command_cache () { + if [[ ! -f "${pacman_conf}" ]]; then + _msg_error "Pacman config file '${pacman_conf}' does not exist" 1 + fi + + #trim spaces + pkg_list="$(echo ${pkg_list})" + + if [[ -z ${pkg_list} ]]; then + _msg_error "Packages must be specified" 0 + _usage 1 + fi + + _show_config cache + _pacman_cache "${pkg_list}" +} + command_init() { _show_config init _chroot_init @@ -637,6 +654,9 @@ case "${command_name}" in install) command_install ;; + cache) + command_cache + ;; run) command_run ;; |