From 7bda53cd534ee6b6604367cd4c2a45376d41c7df Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sat, 12 Oct 2013 17:30:07 -0400 Subject: Replace ${opt_base_dir} with ${base_dir}. --- diff --git a/lib/db.sh b/lib/db.sh index 6dc15fa..e2f8fb7 100644 --- a/lib/db.sh +++ b/lib/db.sh @@ -33,7 +33,7 @@ db_get_srcver() local source="${3}" local dir= - dir="${opt_base_dir}/feeds/${chan}/${dist}/.db" + dir="${base_dir}/feeds/${chan}/${dist}/.db" dir="${dir}/$(hash_name "${source}")/${source}" if [ -f "${dir}/srcver" ]; then cat "${dir}/srcver" @@ -50,7 +50,7 @@ db_set_srcver() local srcver="${4}" local dir= - dir="${opt_base_dir}/feeds/${chan}/${dist}/.db" + dir="${base_dir}/feeds/${chan}/${dist}/.db" dir="${dir}/$(hash_name "${source}")/${source}" mkdir -p "${dir}" printf '%s\n' "${srcver}" >"${dir}/srcver" @@ -65,7 +65,7 @@ db_del_srcver() local source="${3}" local dir= - dir="${opt_base_dir}/feeds/${chan}/${dist}/.db" + dir="${base_dir}/feeds/${chan}/${dist}/.db" dir="${dir}/$(hash_name "${source}")/${source}" rm -f "${dir}/srcver" # Remove ".../.db//". @@ -87,7 +87,7 @@ db_get_binver() local source="${5}" local dir= - dir="${opt_base_dir}/feeds/${chan}/${dist}/.db" + dir="${base_dir}/feeds/${chan}/${dist}/.db" dir="${dir}/$(hash_name "${source}")/${source}/${arch}_${plat}" if [ -f "${dir}/binver" ]; then cat "${dir}/binver" @@ -106,7 +106,7 @@ db_set_binver() local binver="${6}" local dir= - dir="${opt_base_dir}/feeds/${chan}/${dist}/.db" + dir="${base_dir}/feeds/${chan}/${dist}/.db" dir="${dir}/$(hash_name "${source}")/${source}/${arch}_${plat}" mkdir -p "${dir}" printf '%s\n' "${binver}" >"${dir}/binver" @@ -123,7 +123,7 @@ db_del_binver() local source="${5}" local dir= - dir="${opt_base_dir}/feeds/${chan}/${dist}/.db" + dir="${base_dir}/feeds/${chan}/${dist}/.db" dir="${dir}/$(hash_name "${source}")/${source}/${arch}_${plat}" rm -f "${dir}/binver" # Remove ".../.db///_". @@ -141,7 +141,7 @@ db_foreach_source() shift 3 - dir="${opt_base_dir}/feeds/${chan}/${dist}/.db" + dir="${base_dir}/feeds/${chan}/${dist}/.db" # For each hash: for dir in "${dir}/"*/; do if [ ! -d "${dir}" ]; then @@ -168,7 +168,7 @@ db_get_archplats() local source="${3}" local dir= - dir="${opt_base_dir}/feeds/${chan}/${dist}/.db" + dir="${base_dir}/feeds/${chan}/${dist}/.db" dir="${dir}/$(hash_name "${source}")/${source}" for dir in "${dir}/"*_*/; do if [ ! -d "${dir}" ]; then @@ -194,7 +194,7 @@ db_get_packages() local binver="${4}" local dir= - dir="${opt_base_dir}/pool/$(hash_name "${source}")/${source}/.db" + dir="${base_dir}/pool/$(hash_name "${source}")/${source}/.db" dir="${dir}/${binver}_${arch}_${plat}" if [ -f "${dir}/packages" ]; then cat "${dir}/packages" @@ -214,7 +214,7 @@ db_add_package() local pkg="${7}" local dir= - dir="${opt_base_dir}/pool/$(hash_name "${source}")/${source}/.db" + dir="${base_dir}/pool/$(hash_name "${source}")/${source}/.db" dir="${dir}/${binver}_${arch}_${plat}" mkdir -p "${dir}" printf '%s %s %s\n' "${size}" "${sect}" "${pkg}" >>"${dir}/packages" @@ -230,7 +230,7 @@ db_del_packages() local binver="${4}" local dir= - dir="${opt_base_dir}/pool/$(hash_name "${source}")/${source}/.db" + dir="${base_dir}/pool/$(hash_name "${source}")/${source}/.db" dir="${dir}/${binver}_${arch}_${plat}" rm -f "${dir}/packages" # Remove "pool///.db/__". @@ -250,7 +250,7 @@ db_inc_references() local dir= local refs= - dir="${opt_base_dir}/pool/$(hash_name "${source}")/${source}/.db" + dir="${base_dir}/pool/$(hash_name "${source}")/${source}/.db" dir="${dir}/${binver}_${arch}_${plat}" if [ -f "${dir}/references" ]; then refs="$(cat "${dir}/references")" @@ -274,7 +274,7 @@ db_dec_references() local dir= local refs= - dir="${opt_base_dir}/pool/$(hash_name "${source}")/${source}/.db" + dir="${base_dir}/pool/$(hash_name "${source}")/${source}/.db" dir="${dir}/${binver}_${arch}_${plat}" if [ -f "${dir}/references" ]; then refs="$(cat "${dir}/references")" diff --git a/lib/garbage.sh b/lib/garbage.sh index d78c530..9f3bd33 100644 --- a/lib/garbage.sh +++ b/lib/garbage.sh @@ -34,7 +34,7 @@ collect_garbage() # it is supported by the GNU and BusyBox implementations of date. cur_time=$(date '+%s') - for garbage in "${opt_base_dir}/.db/garbage/"*; do + for garbage in "${base_dir}/.db/garbage/"*; do if [ ! -f "${garbage}" ]; then continue fi @@ -43,10 +43,10 @@ collect_garbage() break fi while read -r dirs file; do - rm -f "${opt_base_dir}/${file}" + rm -f "${base_dir}/${file}" while [ ${dirs} -gt 0 ]; do file="${file%/*}" - try_rmdir "${opt_base_dir}/${file}" + try_rmdir "${base_dir}/${file}" dirs=$(($dirs - 1)) done done <<-EOF @@ -66,6 +66,6 @@ mark_pool_garbage() time=$(date '+%s') time=$(($time + $conf_pool_gc_delay)) - mkdir -p "${opt_base_dir}/.db/garbage" - printf '2 %s\n' "${file}" >>"${opt_base_dir}/.db/garbage/${time}" + mkdir -p "${base_dir}/.db/garbage" + printf '2 %s\n' "${file}" >>"${base_dir}/.db/garbage/${time}" } diff --git a/lib/include.sh b/lib/include.sh index 74ebcb9..0b3e91b 100644 --- a/lib/include.sh +++ b/lib/include.sh @@ -125,7 +125,7 @@ include_changes() pool_file="${pool_file}/${pkg}_${binver}_${arch}_${plat}.opk" file="$(dirname "${changes}")/${file}" files="${files} ${file}" - cp -p "${file}" "${opt_base_dir}/${pool_file}" + cp -p "${file}" "${base_dir}/${pool_file}" feed_add_package "${chan}" "${dist}" "${arch}" "${plat}" \ "${sect}" "${pkg}" "${size}" "${pool_file}" done <<-EOF diff --git a/lib/index.sh b/lib/index.sh index 4ff674c..808431a 100644 --- a/lib/index.sh +++ b/lib/index.sh @@ -39,18 +39,18 @@ feed_add_package() pkg_hash="$(hash_name "${pkg}")" # Add package metadata to feed hash index. - feed_hash_idx="${opt_base_dir}/feeds/${chan}/${dist}/${arch}/${plat}" + feed_hash_idx="${base_dir}/feeds/${chan}/${dist}/${arch}/${plat}" feed_hash_idx="${feed_hash_idx}/${sect}/.db/${pkg_hash}" mkdir -p "${feed_hash_idx}/info" - tar -xzOf "${opt_base_dir}/${file}" 'control.tar.gz' | \ + tar -xzOf "${base_dir}/${file}" 'control.tar.gz' | \ tar -xzO './control' >"${feed_hash_idx}/info/${pkg}.control" printf 'Filename: %s\nSize: %s\nMD5sum: %s\n\n' \ "../../../../../../${file}" "${size}" \ - "$(md5sum "${opt_base_dir}/${file}" | sed 's/ .*$//')" \ + "$(md5sum "${base_dir}/${file}" | sed 's/ .*$//')" \ >>"${feed_hash_idx}/info/${pkg}.control" # Mark feed index fragment as outdated. - old_dir="${opt_base_dir}/feeds/.db/${chan}_${dist}/${arch}_${plat}" + old_dir="${base_dir}/feeds/.db/${chan}_${dist}/${arch}_${plat}" old_dir="${old_dir}/${sect}" mkdir -p "${old_dir}" >"${old_dir}/${pkg_hash}" @@ -73,13 +73,13 @@ feed_remove_package() pkg_hash="$(hash_name "${pkg}")" # Remove package metadata from feed hash index. - feed_hash_idx="${opt_base_dir}/feeds/${chan}/${dist}/${arch}/${plat}" + feed_hash_idx="${base_dir}/feeds/${chan}/${dist}/${arch}/${plat}" feed_hash_idx="${feed_hash_idx}/${sect}/.db/${pkg_hash}" rm -f "${feed_hash_idx}/info/${pkg}.control" try_rmdir "${feed_hash_idx}/info" # Mark feed index fragment as outdated. - old_dir="${opt_base_dir}/feeds/.db/${chan}_${dist}/${arch}_${plat}" + old_dir="${base_dir}/feeds/.db/${chan}_${dist}/${arch}_${plat}" old_dir="${old_dir}/${sect}" mkdir -p "${old_dir}" >"${old_dir}/${pkg_hash}" @@ -103,7 +103,7 @@ update_feeds() local idx= # For each suite: - for suite_dirent in "${opt_base_dir}/feeds/.db/"*_*/; do + for suite_dirent in "${base_dir}/feeds/.db/"*_*/; do if [ ! -d "${suite_dirent}" ]; then continue fi @@ -111,7 +111,7 @@ update_feeds() chan="${chan##*/}" dist="${chan##*_}" chan="${chan%_*}" - suite="${opt_base_dir}/feeds/${chan}/${dist}" + suite="${base_dir}/feeds/${chan}/${dist}" # For each archplat: for archplat_dirent in "${suite_dirent}/"*_*/; do if [ ! -d "${archplat_dirent}" ]; then -- cgit v0.9.1