diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2020-07-02 18:36:56 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2020-07-02 18:36:56 (EDT) |
commit | dcf9e96aa3a3530b6f0e6afba8dc0c102b89dd51 (patch) | |
tree | 7cc6010e62dc3800b085d46783630fbe0573737a | |
parent | 6adc62fcdae9d61358ce6fc9fae919d5cbc75156 (diff) |
Prefix "static" vars with "_"
-rw-r--r-- | src/cmd.sh | 20 | ||||
-rw-r--r-- | src/cmd/build.sh | 40 | ||||
-rw-r--r-- | src/cmd/opkg.sh | 14 | ||||
-rw-r--r-- | src/feed.sh | 73 | ||||
-rw-r--r-- | src/install.sh | 40 | ||||
-rw-r--r-- | src/locale.sh | 6 | ||||
-rw-r--r-- | src/package.sh | 20 | ||||
-rw-r--r-- | src/package/2.sh | 8 | ||||
-rw-r--r-- | src/profile.sh | 16 | ||||
-rw-r--r-- | src/profile/proteanos.sh | 22 | ||||
-rw-r--r-- | src/substvars.sh | 8 | ||||
-rw-r--r-- | src/vardata.sh | 30 |
12 files changed, 149 insertions, 148 deletions
@@ -18,16 +18,16 @@ # along with the ProteanOS Development Kit. If not, see # <http://www.gnu.org/licenses/>. -cmds=' ' -running_cmd= -running_cmd_clean= +_cmds=' ' +_cmd_running= +_cmd_running_clean= register_cmd() { local cmd="${1}" shift 1 - cmds="${cmds}${cmd} " + _cmds="${_cmds}${cmd} " return 0 } @@ -68,7 +68,7 @@ print_cmd_summaries() local summary= padding="$(printf '%24s' '')" - for cmd in ${cmds}; do + for cmd in ${_cmds}; do if [ ${#cmd} -gt 20 ]; then printf ' %s\n%24s' "${cmd}" '' else @@ -101,7 +101,7 @@ is_cmd() local cmd="${1}" shift 1 - case "${cmds}" in *" ${cmd} "*) return 0;; *) return 1;; esac + case "${_cmds}" in *" ${cmd} "*) return 0;; *) return 1;; esac } run_cmd() @@ -114,12 +114,12 @@ run_cmd() cmd_clean="$(printf '%s' "${cmd}" | \ tr '[A-Z]' '[a-z]' | tr -C '[a-z0-9_]' '_')" if is_cmd "${cmd}"; then - running_cmd="${cmd}" - running_cmd_clean="${cmd_clean}" + _cmd_running="${cmd}" + _cmd_running_clean="${cmd_clean}" es=0 "cmd_${cmd_clean}_main" "${@}" || es=${?} - running_cmd='' - running_cmd_clean='' + _cmd_running='' + _cmd_running_clean='' else error "$(get_msg 'cmd_not_found')" "${cmd}" return 1 diff --git a/src/cmd/build.sh b/src/cmd/build.sh index f768cba..13792b3 100644 --- a/src/cmd/build.sh +++ b/src/cmd/build.sh @@ -18,15 +18,15 @@ # along with the ProteanOS Development Kit. If not, see # <http://www.gnu.org/licenses/>. -cmd_build_root= -cmd_build_pkg_dir= -cmd_build_build_deps= +_cmd_build_root= +_cmd_build_pkg_dir= +_cmd_build_build_deps= _cmd_build_make_deps_pkg() { local pkg_dir= - pkg_dir="${cmd_build_root}$(session_dir)/builddeps" + pkg_dir="${_cmd_build_root}$(session_dir)/builddeps" mkdir -p -- "${pkg_dir}/control" "${pkg_dir}/data" printf '2.0\n' >"${pkg_dir}/debian-binary" cat >"${pkg_dir}/control/control" <<-EOF @@ -35,7 +35,7 @@ _cmd_build_make_deps_pkg() Version: 1.0 Architecture: all Platform: all - Depends: ${cmd_build_build_deps} + Depends: ${_cmd_build_build_deps} Description: Build dependencies metapackage generated by prokit EOF (cd -- "${pkg_dir}/data"; tar -czf ../data.tar.gz .) @@ -52,19 +52,19 @@ _cmd_build_fini() session_dir="$(session_dir)" - if [ "x${cmd_build_build_deps}" != 'x' ]; then + if [ "x${_cmd_build_build_deps}" != 'x' ]; then session_exec opkg --autoremove remove \ prokit-builddeps-$(session_id) - rm -f -- "${cmd_build_root}${session_dir}/builddeps.opk" + rm -f -- "${_cmd_build_root}${session_dir}/builddeps.opk" # Hack to avoid this code branch if the function is called again # in response to a signal. - cmd_build_build_deps='' + _cmd_build_build_deps='' fi - for f in "${cmd_build_root}${session_dir}/"*; do + for f in "${_cmd_build_root}${session_dir}/"*; do [ -e "${f}" ] || continue [ "x${f##*/}" = 'xwd' ] && continue - mv "${f}" "${cmd_build_pkg_dir}/.." + mv "${f}" "${_cmd_build_pkg_dir}/.." done } @@ -95,7 +95,7 @@ cmd_build_main() fi fi - cmd_build_root="${root}" + _cmd_build_root="${root}" opkbuild_optstring="$(cat -- "${root}/usr/share/opkbuild/optstring")" arch="$(cat -- "${root}/etc/proteanos_arch")" @@ -108,15 +108,15 @@ cmd_build_main() done first_arg=true - cmd_build_pkg_dir='' + _cmd_build_pkg_dir='' for arg in "${@}"; do if ${first_arg}; then set -- first_arg=false else - set -- "${@}" "${cmd_build_pkg_dir}" + set -- "${@}" "${_cmd_build_pkg_dir}" fi - cmd_build_pkg_dir="${arg}" + _cmd_build_pkg_dir="${arg}" done if ! profile_detect "${root}"; then @@ -124,18 +124,18 @@ cmd_build_main() return 2 fi - if ! [ -d "${cmd_build_pkg_dir}" ]; then - error "$(get_msg 'cmd_build_not_a_dir')" "${cmd_build_pkg_dir}" + if ! [ -d "${_cmd_build_pkg_dir}" ]; then + error "$(get_msg 'cmd_build_not_a_dir')" "${_cmd_build_pkg_dir}" [ "x${dev}" != 'x' ] && block_umount "${root}" return 2 fi - if ! package_init "${cmd_build_pkg_dir}"; then + if ! package_init "${_cmd_build_pkg_dir}"; then [ "x${dev}" != 'x' ] && block_umount "${root}" return 2 fi package_set_substvars "${arch}" "${plat}" - if ! session_begin "${root}" "${cmd_build_pkg_dir}" false; then + if ! session_begin "${root}" "${_cmd_build_pkg_dir}" false; then _cmd_build_fini [ "x${dev}" != 'x' ] && block_umount "${root}" return 2 @@ -143,8 +143,8 @@ cmd_build_main() es=0 - cmd_build_build_deps="$(package_get_build_deps "${arch}" "${plat}")" - if [ "x${cmd_build_build_deps}" != 'x' ]; then + _cmd_build_build_deps="$(package_get_build_deps "${arch}" "${plat}")" + if [ "x${_cmd_build_build_deps}" != 'x' ]; then _cmd_build_make_deps_pkg if session_exec opkg -a "${arch}" print-architecture \ 1>/dev/null 2>&1; then diff --git a/src/cmd/opkg.sh b/src/cmd/opkg.sh index 6a21f5f..20b5c72 100644 --- a/src/cmd/opkg.sh +++ b/src/cmd/opkg.sh @@ -18,16 +18,16 @@ # along with the ProteanOS Development Kit. If not, see # <http://www.gnu.org/licenses/>. -cmd_opkg_opks= +_cmd_opkg_opks= _cmd_opkg_fini() { - case "${cmd_opkg_opks}" in + case "${_cmd_opkg_opks}" in *[!\ ]*) - rm -f -- ${cmd_opkg_opks} + rm -f -- ${_cmd_opkg_opks} # Hack to avoid this code branch if the function is # called again in response to a signal. - cmd_opkg_opks='' + _cmd_opkg_opks='' ;; esac } @@ -60,7 +60,7 @@ cmd_opkg_main() first_arg=true install_cmd=false - cmd_opkg_opks='' + _cmd_opkg_opks='' for arg in "${@}"; do if ${first_arg}; then set -- @@ -75,8 +75,8 @@ cmd_opkg_main() fi rand new_fname="/tmp/prokit.${rand_x}.opk" - cmd_opkg_opks="$(printf '%s %s\n' \ - "${cmd_opkg_opks}" \ + _cmd_opkg_opks="$(printf '%s %s\n' \ + "${_cmd_opkg_opks}" \ "${root}${new_fname}")" cp -- "${arg}" "${root}${new_fname}" set -- "${@}" "${new_fname}" diff --git a/src/feed.sh b/src/feed.sh index 8b27723..d111474 100644 --- a/src/feed.sh +++ b/src/feed.sh @@ -18,16 +18,16 @@ # along with the ProteanOS Development Kit. If not, see # <http://www.gnu.org/licenses/>. -feed_dep_fields= -feed_pkg_cb= -feed_deps_cb= -feed_fname_cb= -feed_md5sum_cb= -feed_sha256sum_cb= -feed_pkgs= -feed_pkg_include= -feed_pkg= -feed_deps= +_feed_dep_fields= +_feed_pkg_cb= +_feed_deps_cb= +_feed_fname_cb= +_feed_md5sum_cb= +_feed_sha256sum_cb= +_feed_pkgs= +_feed_pkg_include= +_feed_pkg= +_feed_deps= feed_download() { @@ -121,19 +121,20 @@ _feed_field_cb() name="$(printf '%s\n' "${name}" | tr 'A-Z' 'a-z')" if [ "x${name}" = 'xpackage' ]; then - feed_pkg="${value}" + _feed_pkg="${value}" elif [ "x${name}" = 'xfilename' ]; then - ${feed_fname_cb} "${feed_pkg}" "${value}" + ${_feed_fname_cb} "${_feed_pkg}" "${value}" elif [ "x${name}" = 'xmd5sum' ]; then - ${feed_md5sum_cb} "${feed_pkg}" "${value}" + ${_feed_md5sum_cb} "${_feed_pkg}" "${value}" elif [ "x${name}" = 'xsha256sum' ]; then - ${feed_sha256sum_cb} "${feed_pkg}" "${value}" - elif [ "x${feed_dep_fields#* ${name} }" != "x${feed_dep_fields}" ]; then - feed_deps="${feed_deps}${value}, " + ${_feed_sha256sum_cb} "${_feed_pkg}" "${value}" + elif [ "x${_feed_dep_fields#* ${name} }" != "x${_feed_dep_fields}" ] + then + _feed_deps="${_feed_deps}${value}, " fi - if ${feed_pkg_cb} ${name} ${value}; then - feed_pkg_include='true' + if ${_feed_pkg_cb} ${name} ${value}; then + _feed_pkg_include='true' fi return 0 @@ -144,13 +145,13 @@ _feed_para_cb() local new_deps= local dep= - if ${feed_pkg_include}; then - feed_pkgs="${feed_pkgs} ${feed_pkg}" + if ${_feed_pkg_include}; then + _feed_pkgs="${_feed_pkgs} ${_feed_pkg}" fi new_deps='' IFS=',' - for dep in ${feed_deps%, }; do + for dep in ${_feed_deps%, }; do unset IFS # Trim off versions and disjunctions. dep="${dep%%(*}" @@ -165,11 +166,11 @@ _feed_para_cb() done unset IFS - ${feed_deps_cb} "${feed_pkg}" "${new_deps# }" + ${_feed_deps_cb} "${_feed_pkg}" "${new_deps# }" - feed_pkg_include='false' - feed_pkg='' - feed_deps='' + _feed_pkg_include='false' + _feed_pkg='' + _feed_deps='' return 0 } @@ -185,24 +186,24 @@ feed_find_pkgs() local sha256sum_cb="${7}" shift 7 - feed_dep_fields=" $(printf '%s ' ${dep_fields} | tr 'A-Z' 'a-z')" - feed_pkg_cb="${pkg_cb}" - feed_deps_cb="${deps_cb}" - feed_fname_cb="${fname_cb}" - feed_md5sum_cb="${md5sum_cb}" - feed_sha256sum_cb="${sha256sum_cb}" + _feed_dep_fields=" $(printf '%s ' ${dep_fields} | tr 'A-Z' 'a-z')" + _feed_pkg_cb="${pkg_cb}" + _feed_deps_cb="${deps_cb}" + _feed_fname_cb="${fname_cb}" + _feed_md5sum_cb="${md5sum_cb}" + _feed_sha256sum_cb="${sha256sum_cb}" - feed_pkgs='' - feed_pkg_include='false' - feed_pkg='' - feed_deps='' + _feed_pkgs='' + _feed_pkg_include='false' + _feed_pkg='' + _feed_deps='' parse_control '-' _feed_field_cb _feed_para_cb 'Package' <<-EOF $({ ${GUNZIP} -c -- "${feed_idx}" || cat "${feed_idx}"; } \ 2>/dev/null) EOF - printf '%s\n' "${feed_pkgs# }" + printf '%s\n' "${_feed_pkgs# }" return 0 } diff --git a/src/install.sh b/src/install.sh index 02d26d3..41c217f 100644 --- a/src/install.sh +++ b/src/install.sh @@ -18,11 +18,11 @@ # along with the ProteanOS Development Kit. If not, see # <http://www.gnu.org/licenses/>. -install_deps= -install_urls= -install_md5sums= -install_sha256sums= -install_feed_url= +_install_deps= +_install_urls= +_install_md5sums= +_install_sha256sums= +_install_feed_url= _usign_fingerprint() { @@ -52,7 +52,7 @@ _install_deps_cb() local deps="${2}" shift 2 - install_deps="${install_deps}${pkg}: ${deps}${LF}" + _install_deps="${_install_deps}${pkg}: ${deps}${LF}" return 0 } @@ -63,8 +63,8 @@ _install_fname_cb() local fname="${2}" shift 2 - install_urls="$(printf '%s\n%s %s/%s' "${install_urls}" \ - "${pkg}" "${install_feed_url}" "${fname}")" + _install_urls="$(printf '%s\n%s %s/%s' "${_install_urls}" \ + "${pkg}" "${_install_feed_url}" "${fname}")" return 0 } @@ -75,7 +75,7 @@ _install_md5sum_cb() local md5sum="${2}" shift 2 - install_md5sums="$(printf '%s\n%s %s' "${install_md5sums}" \ + _install_md5sums="$(printf '%s\n%s %s' "${_install_md5sums}" \ "${pkg}" "${md5sum}")" return 0 @@ -87,8 +87,8 @@ _install_sha256sum_cb() local sha256sum="${2}" shift 2 - install_sha256sums="$(printf '%s\n%s %s' \ - "${install_sha256sums}" "${pkg}" "${sha256sum}")" + _install_sha256sums="$(printf '%s\n%s %s' \ + "${_install_sha256sums}" "${pkg}" "${sha256sum}")" return 0 } @@ -119,10 +119,10 @@ install_find_pkgs() fi opkg_conf_fd=${FD} - install_deps= - install_urls= - install_md5sums= - install_sha256sums= + _install_deps= + _install_urls= + _install_md5sums= + _install_sha256sums= if ! fopen "${root}/.prokit/packages" 'w'; then return 1 @@ -167,7 +167,7 @@ install_find_pkgs() ${gzip} "${root}"; then return 1 fi - install_feed_url="${base_url}" + _install_feed_url="${base_url}" feed_find_pkgs \ "${root}/$(profile_opkg_state_dir)/lists/${name}" \ "$(profile_dep_fields)" profile_include_pkg \ @@ -184,7 +184,7 @@ install_find_pkgs() fclose ${pkgs_fd} pkgs="$(resolve_deps "$(cat -- "${root}/.prokit/packages")" \ - "${install_deps}" | xargs printf '%s\n' | sort -u)" + "${_install_deps}" | xargs printf '%s\n' | sort -u)" printf '%s\n' "${pkgs}" >"${root}/.prokit/packages" return 0 @@ -218,11 +218,11 @@ install_get_pkgs() for pkg in $(cat -- "${root}/.prokit/packages"); do info "$(get_msg 'install_downloading_pkg')" "${pkg}" - url="$(printf '%s\n' "${install_urls}" | \ + url="$(printf '%s\n' "${_install_urls}" | \ sed -n "s/^${pkg} //p")" - md5sum="$(printf '%s\n' "${install_md5sums}" | \ + md5sum="$(printf '%s\n' "${_install_md5sums}" | \ sed -n "s/^${pkg} //p")" - sha256sum="$(printf '%s\n' "${install_sha256sums}" | \ + sha256sum="$(printf '%s\n' "${_install_sha256sums}" | \ sed -n "s/^${pkg} //p")" fname="var/cache/opkg/archives/${url##*/}" if ! ${WGET} -q -O "${root}/${fname}" -- "${url}"; then diff --git a/src/locale.sh b/src/locale.sh index c667258..8b9610d 100644 --- a/src/locale.sh +++ b/src/locale.sh @@ -18,7 +18,7 @@ # along with the ProteanOS Development Kit. If not, see # <http://www.gnu.org/licenses/>. -DEFAULT_LOCALE='en_US' +_LOCALE_DEFAULT='en_US' _try_load_locale() { @@ -49,7 +49,7 @@ load_locale() elif [ "x${LANG+set}" = 'xset' ]; then LC_MESSAGES="${LANG}" else - LC_MESSAGES="${DEFAULT_LOCALE}" + LC_MESSAGES="${_LOCALE_DEFAULT}" fi fi @@ -65,7 +65,7 @@ load_locale() if ! _try_load_locale "${localedir}" \ "${LC_MESSAGES%_*}"; then if ! _try_load_locale "${localedir}" \ - "${DEFAULT_LOCALE}"; then + "${_LOCALE_DEFAULT}"; then error 'Cannot load locale' return 1 fi diff --git a/src/package.sh b/src/package.sh index 0be96fb..8f71e9f 100644 --- a/src/package.sh +++ b/src/package.sh @@ -18,26 +18,26 @@ # along with the ProteanOS Development Kit. If not, see # <http://www.gnu.org/licenses/>. -package_dir= -package_format= +_package_dir= +_package_format= package_init() { local dir="${1}" shift 1 - package_dir="${dir}" + _package_dir="${dir}" - package_format='' - if [ -r "${package_dir}/format" ]; then - case "$(cat -- "${package_dir}/format")" in + _package_format='' + if [ -r "${_package_dir}/format" ]; then + case "$(cat -- "${_package_dir}/format")" in 2.*) - package_format=2 + _package_format=2 ;; esac fi - if [ "x${package_format}" = 'x' ]; then + if [ "x${_package_format}" = 'x' ]; then error "$(get_msg 'package_format_unknown')" return 1 fi @@ -51,7 +51,7 @@ package_get_build_deps() local plat="${2}" shift 2 - "package_${package_format}_get_build_deps" "${arch}" "${plat}" + "package_${_package_format}_get_build_deps" "${arch}" "${plat}" } package_set_substvars() @@ -60,5 +60,5 @@ package_set_substvars() local plat="${2}" shift 2 - "package_${package_format}_set_substvars" "${arch}" "${plat}" + "package_${_package_format}_set_substvars" "${arch}" "${plat}" } diff --git a/src/package/2.sh b/src/package/2.sh index ea0e10d..2a856d3 100644 --- a/src/package/2.sh +++ b/src/package/2.sh @@ -18,7 +18,7 @@ # along with the ProteanOS Development Kit. If not, see # <http://www.gnu.org/licenses/>. -package_2_build_deps= +_package_2_build_deps= _package_2_build_deps_field_cb() { @@ -29,7 +29,7 @@ _package_2_build_deps_field_cb() name="$(printf '%s\n' "${name}" | tr 'A-Z' 'a-z')" if [ "x${name}" = 'xbuild-depends' ]; then - package_2_build_deps="${value}" + _package_2_build_deps="${value}" return 1 fi @@ -42,11 +42,11 @@ package_2_get_build_deps() local plat="${2}" shift 2 - package_2_build_deps='' + _package_2_build_deps='' parse_control "${package_dir}/control" \ _package_2_build_deps_field_cb false - substvars "$(reduce_deps "${package_2_build_deps}" false \ + substvars "$(reduce_deps "${_package_2_build_deps}" false \ "${arch}" "${plat}")" return 0 diff --git a/src/profile.sh b/src/profile.sh index 2e1bff0..0af1935 100644 --- a/src/profile.sh +++ b/src/profile.sh @@ -18,15 +18,15 @@ # along with the ProteanOS Development Kit. If not, see # <http://www.gnu.org/licenses/>. -profiles=' ' -profile= +_profiles=' ' +_profile= register_profile() { local profile="${1}" shift 1 - profiles="${profiles}${profile} " + _profiles="${_profiles}${profile} " return 0 } @@ -35,7 +35,7 @@ is_profile() local prof="${1}" shift 1 - case "${profiles}" in *" ${prof} "*) return 0;; *) return 1;; esac + case "${_profiles}" in *" ${prof} "*) return 0;; *) return 1;; esac } profile_set() @@ -44,7 +44,7 @@ profile_set() shift 1 if is_profile "${prof}"; then - profile="${prof}" + _profile="${prof}" else error "$(get_msg 'profile_not_found')" "${prof}" return 1 @@ -58,9 +58,9 @@ profile_detect() local root="${1}" shift 1 - for prof in ${profiles}; do + for prof in ${_profiles}; do if "prof_${prof}_detect_root" "${root}"; then - profile="${prof}" + _profile="${prof}" return 0 fi done @@ -75,5 +75,5 @@ for func in normalize_suite detect_arch default_plat select_mirror \ file_systems_mounted bind_mount bind_umount \ configure_system_native configure_system_foreign find_kernel \ make_initramfs; do - eval "profile_${func}() { \"prof_\${profile}_${func}\" \"\${@}\"; }" + eval "profile_${func}() { \"prof_\${_profile}_${func}\" \"\${@}\"; }" done diff --git a/src/profile/proteanos.sh b/src/profile/proteanos.sh index 08916cd..3bed6c4 100644 --- a/src/profile/proteanos.sh +++ b/src/profile/proteanos.sh @@ -18,13 +18,13 @@ # along with the ProteanOS Development Kit. If not, see # <http://www.gnu.org/licenses/>. -prof_proteanos_fstab_linux="\ +_prof_proteanos_fstab_linux="\ proc /proc proc defaults sys /sys sysfs defaults /dev /dev none bind devpts /dev/pts devpts noexec,nosuid,gid=5,mode=0620 " -prof_proteanos_install_service=\ +_prof_proteanos_install_service=\ '#!/bin/sh /etc/rc.common start() @@ -36,7 +36,7 @@ start() rm -f "${SCRIPT}" } ' -prof_proteanos_manifest='' +_prof_proteanos_manifest='' prof_proteanos_detect_root() { @@ -118,8 +118,8 @@ prof_proteanos_validate_archplat() shift 4 local archplat= - [ -z "${prof_proteanos_manifest}" ] && \ - prof_proteanos_manifest="$(${WGET} -q -O - -- \ + [ -z "${_prof_proteanos_manifest}" ] && \ + _prof_proteanos_manifest="$(${WGET} -q -O - -- \ "${mirror}/feeds/${suite}/Manifest")" while read -r archplat; do @@ -130,7 +130,7 @@ prof_proteanos_validate_archplat() ;; esac done <<-EOF - ${prof_proteanos_manifest} + ${_prof_proteanos_manifest} EOF return 1 @@ -160,8 +160,8 @@ prof_proteanos_feeds() local p= local s= - [ -z "${prof_proteanos_manifest}" ] && \ - prof_proteanos_manifest="$(${WGET} -q -O - -- \ + [ -z "${_prof_proteanos_manifest}" ] && \ + _prof_proteanos_manifest="$(${WGET} -q -O - -- \ "${mirror}/feeds/${suite}/Manifest")" case "${plat}" in @@ -175,7 +175,7 @@ prof_proteanos_feeds() for a in "${arch}" 'all'; do for p in "${plat}" 'all'; do for s in ${sects}; do - case "${LF}${prof_proteanos_manifest}${LF}" in + case "${LF}${_prof_proteanos_manifest}${LF}" in *"${LF}${a}/${p}/${s}${LF}"*) ;; *) continue;; esac @@ -244,7 +244,7 @@ prof_proteanos_get_fstab() case "${arch}" in *-linux-*) - printf '%s\n' "${prof_proteanos_fstab_linux}" + printf '%s\n' "${_prof_proteanos_fstab_linux}" ;; esac } @@ -318,7 +318,7 @@ prof_proteanos_configure_system_foreign() local plat="${3}" shift 3 - printf '%s' "${prof_proteanos_install_service}" \ + printf '%s' "${_prof_proteanos_install_service}" \ >"${root}/etc/rc.d/S10install" chmod -- 0755 "${root}/etc/rc.d/S10install" printf 'proteanos\n' >"${root}/etc/hostname" diff --git a/src/substvars.sh b/src/substvars.sh index bc0b052..7c72ed5 100644 --- a/src/substvars.sh +++ b/src/substvars.sh @@ -18,8 +18,8 @@ # along with the ProteanOS Development Kit. If not, see # <http://www.gnu.org/licenses/>. -SUBSTVARS_MAX_DEPTH=50 -SUBSTVAR_TRIM_SED=' +_SUBSTVARS_MAX_DEPTH=50 +_SUBSTVAR_TRIM_SED=' H; # Store each input line in the hold space. ${ # At the last line of input: g; # restore the hold space into the pattern space, @@ -44,7 +44,7 @@ set_substvar() name="$(printf '%s' "${name}" | tr 'A-Z-' 'a-z_')" # Trim leading and trailing whitespace from value. - value="$(printf '%s' "${value}" | sed -n "${SUBSTVAR_TRIM_SED}")" + value="$(printf '%s' "${value}" | sed -n "${_SUBSTVAR_TRIM_SED}")" eval "substvar_${name}=\"\${value}\"" @@ -82,7 +82,7 @@ substvars() # side of the matched space. depth=0 fi - if [ ${depth} -ge ${SUBSTVARS_MAX_DEPTH} ]; then + if [ ${depth} -ge ${_SUBSTVARS_MAX_DEPTH} ]; then # Warn of possible recursion. warn "$(get_msg 'substvar_deep_nesting')" return 1 diff --git a/src/vardata.sh b/src/vardata.sh index 6c19077..24fc4c3 100644 --- a/src/vardata.sh +++ b/src/vardata.sh @@ -18,9 +18,9 @@ # along with the ProteanOS Development Kit. If not, see # <http://www.gnu.org/licenses/>. -VARDATA_DIRS='mount' +_VARDATA_DIRS='mount' -vardatadir= +_vardatadir= init_vardata() { @@ -34,15 +34,15 @@ init_vardata() fi rand - vardatadir="${tmpdir}/${PACKAGE}-$(printf '%010d' ${rand_x})" - if ! mkdir -- "${vardatadir}"; then - error "$(get_msg 'temp_mkdir_fail')" "${vardatadir}" + _vardatadir="${tmpdir}/${PACKAGE}-$(printf '%010d' ${rand_x})" + if ! mkdir -- "${_vardatadir}"; then + error "$(get_msg 'temp_mkdir_fail')" "${_vardatadir}" return 1 fi - for dir in ${VARDATA_DIRS}; do - if ! mkdir -- "${vardatadir}/${dir}"; then + for dir in ${_VARDATA_DIRS}; do + if ! mkdir -- "${_vardatadir}/${dir}"; then error "$(get_msg 'temp_mkdir_fail')" \ - "${vardatadir}/${dir}" + "${_vardatadir}/${dir}" return 1 fi done @@ -54,15 +54,15 @@ fini_vardata() { local dir='' - for dir in ${VARDATA_DIRS}; do - if ! rmdir -- "${vardatadir}/${dir}"; then + for dir in ${_VARDATA_DIRS}; do + if ! rmdir -- "${_vardatadir}/${dir}"; then error "$(get_msg 'temp_rmdir_fail')" \ - "${vardatadir}/${dir}" + "${_vardatadir}/${dir}" return 1 fi done - if ! rmdir -- "${vardatadir}"; then - error "$(get_msg 'temp_rmdir_fail')" "${vardatadir}" + if ! rmdir -- "${_vardatadir}"; then + error "$(get_msg 'temp_rmdir_fail')" "${_vardatadir}" return 1 fi @@ -74,9 +74,9 @@ get_vardata_dir() local dir="${1}" shift 1 - case " ${VARDATA_DIRS} " in + case " ${_VARDATA_DIRS} " in *" ${dir} "*) - printf '%s/%s' "${vardatadir}" "${dir}" + printf '%s/%s' "${_vardatadir}" "${dir}" ;; esac |