diff options
Diffstat (limited to 'include/init.sh')
-rw-r--r-- | include/init.sh | 61 |
1 files changed, 47 insertions, 14 deletions
diff --git a/include/init.sh b/include/init.sh index f14fa5ab..72af26c3 100644 --- a/include/init.sh +++ b/include/init.sh @@ -12,21 +12,41 @@ projectname="libreboot" projectsite="https://libreboot.org/" if [ -z "${PATH+x}" ]; then -export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games" + export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games" fi -eval "`setvars "" board reinstall versiondate aur_notice configdir xbmkpath \ - datadir version xbmkpwd relname xbmkpwd xbtmp python pyver xbmklock \ - cvxbmk cvchk is_child basetmp`" +board="" +reinstall="" +version="" +versiondate="" +aur_notice="" +configdir="" +xbmkpath="" +datadir="" +xbmkpwd="" +relname="" +xbmkpwd="" +xbtmp="" +python="" +pyver="" +xbmklock="" +checkvarsxbmk="" +checkvarschk="" +is_child="" +basetmp="" + +sha512sum="util/sbase/sha512sum" xbmk_init() { xbmkpwd="`pwd || err "Cannot generate PWD"`" || err "!" xbmk_init "$@" xbmklock="$xbmkpwd/lock" basetmp="$xbmkpwd/xbmkwd" + sha512sum="$xbmkpwd/util/sbase/sha512sum" if [ $# -gt 0 ] && [ "$1" = "dependencies" ]; then x_ xbmkpkg "$@" + exit 0 fi @@ -55,9 +75,13 @@ xbmkpkg() reinstall="$3" fi - eval "`setcfg "config/dependencies/$2"`" + . "config/dependencies/$2" || \ + err "Can't read 'config/dependencies/$2'" "xbmkpkg" "$@" + + if [ -z "$pkg_add" ] || [ -z "$pkglist" ]; then + err "pkg_add/pkglist not both set" "xbmkpkg" "$@" + fi - chkvars pkg_add pkglist x_ $pkg_add $pkglist if [ -n "$aur_notice" ]; then @@ -76,11 +100,11 @@ xbmk_get_version() err "can't read versiondate" xbmk_get_version "$@" fi - if [ -f ".version" ]; then - chkvars version + if [ -f ".version" ] && [ -z "$version" ]; then + err "version not set" "xbmk_get_version" "$@" fi - if [ -f ".versiondate" ]; then - chkvars versiondate + if [ -f ".versiondate" ] && [ -z "$versiondate" ]; then + err "versiondate not set" "xbmk_get_version" "$@" fi if [ ! -e ".git" ] && [ ! -f ".version" ]; then @@ -279,7 +303,10 @@ xbmk_set_version() --pretty='%ct' HEAD)" || versiondate="$versiondate_" fi - chkvars version versiondate + if [ -z "$version" ] || [ -z "$versiondate" ]; then + err "version and/or versiondate unset" "xbmk_set_version" "$@" + fi + update_xbmkver "." relname="$projectname-$version" @@ -353,7 +380,9 @@ pybin() if [ -e "$pypath" ] && [ ! -d "$pypath" ] && \ [ -x "$pypath" ]; then + printf "%s\n" "$pypath" + return 0 fi fi @@ -363,7 +392,9 @@ pybin() [ $venv -gt 0 ] && for pypath in "/usr/local/bin" "/usr/bin"; do if [ -e "$pypath/$1" ] && [ ! -d "$pypath/$1" ] && \ [ -x "$pypath/$1" ]; then + printf "%s/%s\n" "$pypath" "$1" + return 0 fi done && return 1 @@ -377,9 +408,11 @@ pybin() xbmk_git_init() { for gitarg in "--global user.name" "--global user.email"; do - gitcmd="git config $gitarg"; $gitcmd 1>/dev/null 2>/dev/null \ - || err "Run this first: $gitcmd \"your ${gitcmd##*.}\"" \ - "xbmk_git_init" "$@" + gitcmd="git config $gitarg" + if ! $gitcmd 1>/dev/null 2>/dev/null; then + err "Run this first: $gitcmd \"your ${gitcmd##*.}\"" \ + "xbmk_git_init" "$@" + fi done if [ -L ".git" ]; then |