diff options
| -rw-r--r-- | include/chromebook.sh | 2 | ||||
| -rw-r--r-- | include/get.sh | 4 | ||||
| -rw-r--r-- | include/init.sh | 9 | ||||
| -rw-r--r-- | include/lib.sh | 32 | ||||
| -rw-r--r-- | include/release.sh | 2 | ||||
| -rw-r--r-- | include/rom.sh | 2 | ||||
| -rw-r--r-- | include/tree.sh | 2 | ||||
| -rw-r--r-- | include/vendor.sh | 4 | ||||
| -rw-r--r-- | util/libreboot-utils/Makefile | 2 | ||||
| -rw-r--r-- | util/libreboot-utils/mkhtemp.c | 8 |
10 files changed, 50 insertions, 17 deletions
diff --git a/include/chromebook.sh b/include/chromebook.sh index 0b8b50f1..ce1bcd5c 100644 --- a/include/chromebook.sh +++ b/include/chromebook.sh @@ -35,7 +35,7 @@ prep_mr_import() err "Project import disabled on releases" "prep_mr_import" "$@" fi - mr_tmpdir="`mktemp -d || err "can't make mrtmpdir"`" || \ + mr_tmpdir="`"$mkhtemp" -d || err "can't make mrtmpdir"`" || \ err "can't make mrtmpdir" "prep_mr_coreboot" "$@" x_ remkdir "$mr_tmpdir" diff --git a/include/get.sh b/include/get.sh index 3e25ea3f..5f932b07 100644 --- a/include/get.sh +++ b/include/get.sh @@ -334,7 +334,7 @@ bad_checksum() return 0 fi - build_sbase + bootstrap_utils csum="$(x_ "$sha512sum" "$2" | awk '{print $1}')" || \ err "!sha512 '$2' $1" bad_checksum "$@" @@ -355,7 +355,7 @@ tmpclone() return 0 fi - tmpclone_patchlist="`mktemp || err "Can't create tmp patch list"`" || \ + tmpclone_patchlist="`"$mkhtemp" || err "Can't create tmp patch list"`" || \ err "Can't create tmp patch list" "tmpclone" "$@" x_ find "$4" -type f | sort > "$tmpclone_patchlist" || \ diff --git a/include/init.sh b/include/init.sh index cde489dd..d2ee4e32 100644 --- a/include/init.sh +++ b/include/init.sh @@ -17,6 +17,7 @@ if [ -z "${PATH+x}" ]; then fi sha512sum="util/sbase/sha512sum" +mkhtemp="util/libreboot-utils/mkhtemp" aur_notice="" basetmp="" @@ -231,7 +232,9 @@ xbmk_parent_check_tmp() { export TMPDIR="$basetmp" - xbmklist="`mktemp || err "can't make tmplist"`" || \ + bootstrap_mkhtemp + + xbmklist="`"$mkhtemp" || err "can't make tmplist"`" || \ err "can't make tmplist" xbmk_parent_check_tmp "$@" x_ rm -f "$xbmklist" @@ -246,7 +249,7 @@ xbmk_parent_check_tmp() done # set up a unified temporary directory, for common deletion later: - export TMPDIR="`x_ mktemp -d -t xbmk_XXXXXXXX`" || \ + export TMPDIR="`x_ "$mkhtemp" -d -t xbmk_XXXXXXXX`" || \ err "can't export TMPDIR" "xbmk_parent_check_tmp" "$@" xbtmp="$TMPDIR" @@ -269,7 +272,7 @@ xbmk_parent_set_export() "xbmk_parent_set_export" "$@" fi - export PATH="$xbtmp/xbmkpath:$xbtmp/gnupath:$PATH" + export PATH="$xbmkpwd/util/libreboot-utils:$xbtmp/xbmkpath:$xbtmp/gnupath:$PATH" xbmkpath="$PATH" # if "y": a coreboot target won't be built if target.cfg says release=n diff --git a/include/lib.sh b/include/lib.sh index 812341f4..9526dfc7 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -128,7 +128,7 @@ findpath() pad_one_byte() { - paddedfile="`mktemp || err "mktemp pad_one_byte"`" || \ + paddedfile="`"$mkhtemp" || err ""$mkhtemp" pad_one_byte"`" || \ err "can't make tmp file" "pad_one_byte" "$@" x_ cat "$1" config/data/coreboot/0 > "$paddedfile" || \ @@ -146,17 +146,39 @@ unpad_one_byte() err "too small, $xromsize: $1" "unpad_one_byte" "$@" fi - unpaddedfile="`mktemp || err "mktemp unpad_one_byte"`" || \ + unpaddedfile="`"$mkhtemp" || err ""$mkhtemp" unpad_one_byte"`" || \ err "can't make tmp file" "unpad_one_byte" "$@" x_ dd if="$1" of="$unpaddedfile" bs=$xromsize count=1 x_ mv "$unpaddedfile" "$1" } -build_sbase() +# certain utils in lbmk are needed +# BEFORE sha512sum-based verification +# can be done, and before TMPDIR +# generation can be done. these are: +# sha512sum and "$mkhtemp". we will use: +# libreboot's own mkhtemp and: +# suckless sbase's sha512sum +# +bootstrap_utils() +{ + bootstrap_sbase + bootstrap_mkhtemp +} +bootstrap_sbase() { if [ ! -f "$sha512sum" ]; then - x_ make -C "$xbmkpwd/util/sbase" + ( x_ make -C "$xbmkpwd/util/sbase" 1>/dev/null 2>/dev/null ) || \ + err "can't build sbase" + fi +} +bootstrap_mkhtemp() +{ + if [ ! -f "$mkhtemp" ]; then + ( x_ make -C "$xbmkpwd/util/libreboot-utils" 1>/dev/null \ + 2>/dev/null) || \ + err "could not build mkhtemp" fi } @@ -183,7 +205,7 @@ fx_() xchk fx_ "$@" xcmd="$1" - xfile="`mktemp || err "can't create tmpfile"`" || \ + xfile="`"$mkhtemp" || err "can't create tmpfile"`" || \ err "can't make tmpfile" "fx_" "$@" x_ rm -f "$xfile" diff --git a/include/release.sh b/include/release.sh index e9017a05..079afdf6 100644 --- a/include/release.sh +++ b/include/release.sh @@ -35,7 +35,7 @@ release() err "already exists: \"$reldest\"" "release" "$@" fi - vdir="`mktemp -d || err "can't make vdir"`" || \ + vdir="`"$mkhtemp" -d || err "can't make vdir"`" || \ err "can't make tmp vdir" "release" "$@" vdir="$vdir/$version" diff --git a/include/rom.sh b/include/rom.sh index 6f0e3529..afeba7d9 100644 --- a/include/rom.sh +++ b/include/rom.sh @@ -463,7 +463,7 @@ cprom() irom="$tmprom" if [ $# -gt 0 ]; then - irom="$(mktemp || err "!mk irom, $(echo "$@")")" || \ + irom="$("$mkhtemp" || err "!mk irom, $(echo "$@")")" || \ err "can't copy rom" "cprom" "$@" x_ cp "$tmprom" "$irom" && cpcmd="mv" diff --git a/include/tree.sh b/include/tree.sh index 8496a49a..0bcb9208 100644 --- a/include/tree.sh +++ b/include/tree.sh @@ -444,7 +444,7 @@ project_up_to_date() "$@" fi - build_sbase + bootstrap_utils fx_ "x_ util/sbase/sha512sum" find "$@" -type f -not -path \ "*/.git*/*" | awk '{print $1}' > "$xbtmp/tmp.hash" || \ err "!h $project $hashdir" \ diff --git a/include/vendor.sh b/include/vendor.sh index 8076d9ab..4c472b13 100644 --- a/include/vendor.sh +++ b/include/vendor.sh @@ -633,7 +633,7 @@ prep() mksha512() { - build_sbase + bootstrap_utils if [ "${1%/*}" != "$1" ]; then x_ cd "${1%/*}" @@ -746,7 +746,7 @@ vfile() # must be called from a subshell check_vendor_hashes() { - build_sbase + bootstrap_utils x_ cd "$tmpromdir" diff --git a/util/libreboot-utils/Makefile b/util/libreboot-utils/Makefile index 07b3a727..5ebc9b93 100644 --- a/util/libreboot-utils/Makefile +++ b/util/libreboot-utils/Makefile @@ -68,6 +68,8 @@ $(PROG): $(OBJS_NVMUTIL) $(PROGMKH): $(OBJS_MKHTEMP) $(CC_MODE) $(OBJS_MKHTEMP) -o $(PROGMKH) $(LDFLAGS) + cp -r mkhtemp mktemp + chmod 755 mktemp $(PROGLOT): $(OBJS_LOTTERY) $(CC_MODE) $(OBJS_LOTTERY) -o $(PROGLOT) $(LDFLAGS) diff --git a/util/libreboot-utils/mkhtemp.c b/util/libreboot-utils/mkhtemp.c index de86a2bf..c9315b0c 100644 --- a/util/libreboot-utils/mkhtemp.c +++ b/util/libreboot-utils/mkhtemp.c @@ -68,7 +68,7 @@ main(int argc, char *argv[]) xpledgex("stdio flock rpath wpath cpath", NULL); while ((c = - getopt(argc, argv, "qdp:")) != -1) { + getopt(argc, argv, "qdp:t")) != -1) { switch (c) { case 'd': @@ -83,6 +83,12 @@ main(int argc, char *argv[]) /* (exit status unchanged) */ break; + case 't': + break; /* not supported yet. TODO */ + /* configured above without optarg, + * so that it is treated as a normal + * template string */ + default: goto err_usage; } |
