Compare commits

...

7 Commits

Author SHA1 Message Date
Leah Rowe ff83f69154 init.sh: remove unnecessary directory check
literally the point of -p in mkdir is to, you know,
check whether the directory already exists

unclear thinking = unclear code

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-13 14:58:31 +01:00
Leah Rowe 0363bcaa0f fix regression in version check
it occured to me that this style of check was bad. it
only works when checking if both variables are set

my bad

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-13 14:55:38 +01:00
Leah Rowe 1a9b211368 xbmk: remove xbmkdir()
pointless function. literally pointless. it is literally
the most pointless function ever written in the history
of functions. literally pointless in every possible way.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-13 14:50:41 +01:00
Leah Rowe e9e33d4b4d lib.sh: always sanitize xbmkver before writing
this removed the need to check it in xbmk_set_version
as it calls update_xbmkver, which in turn performs
the same check.

this increases the general reliability and safety of
xbmk when recording its own version after update.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-13 14:33:37 +01:00
Leah Rowe 3b37a0b17d lib.sh: simplify update_xbmkver
sanitization can be done with a single sed command

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-13 14:25:09 +01:00
Leah Rowe 77b0b448e2 more cleanup
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-12 19:37:57 +01:00
Leah Rowe c7fb6a2bc8 get.sh: remove redundant check
we don't pull anything from supermicro's site.
we did briefly, in an earlier port for that
one supermicro board.

don't maintain dead code. dead code has one purpose:
be deleted.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-12 18:12:36 +01:00
8 changed files with 34 additions and 80 deletions
+7 -14
View File
@@ -71,7 +71,7 @@ git_prep()
fi
[ "$_loc" != "${_loc%/*}" ] && \
x_ xbmkdir "${_loc%/*}"
x_ mkdir -p "${_loc%/*}"
x_ mv "$tmpgit" "$_loc"
}
@@ -138,7 +138,7 @@ try_fetch_git()
cached="$cached/${1#*://}"
cached="$XBMK_CACHE/$cached"
x_ xbmkdir "${5%/*}" "${cached%/*}"
x_ mkdir -p "${5%/*}" "${cached%/*}"
try_$2 "$cached" "$@" || \
return 1
@@ -164,7 +164,7 @@ try_fetch_curl()
cached="file/$6"
cached="$XBMK_CACHE/$cached"
x_ xbmkdir "${5%/*}" "${cached%/*}"
x_ mkdir -p "${5%/*}" "${cached%/*}"
if bad_checksum "$6" "$cached" 2>/dev/null; then
x_ rm -f "$cached"
@@ -199,17 +199,10 @@ try_fetch_curl()
try_curl()
{
_ua=""
ua="Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0"
case "$2" in
https://www.supermicro.com/*)
_ua="curl/8.6.0";;
*)
_ua="Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0";;
esac
( x_ curl --location --retry 3 -A "$_ua" "$2" -o "$1" ) \
|| ( x_ wget --tries 3 -U "$_ua" "$2" -O "$1" ) \
( x_ curl --location --retry 3 -A "$ua" "$2" -o "$1" ) \
|| ( x_ wget --tries 3 -U "$ua" "$2" -O "$1" ) \
|| return 1; :
}
@@ -233,7 +226,7 @@ try_git()
( x_ git clone "$2" "$tmpgitcache" ) || return 1
fi
x_ xbmkdir "${gitdest%/*}"
x_ mkdir -p "${gitdest%/*}"
x_ mv "$tmpgitcache" "$gitdest"
fi
+3 -17
View File
@@ -33,10 +33,7 @@ xbmk_init()
err "this command as root is not permitted" "xbmk_init" "$@"
export PWD="$xbmkpwd"
x_ xbmkdir "$basetmp"
[ ! -e "cache" ] && \
x_ xbmkdir "cache"
x_ mkdir -p "$basetmp" "cache"
for init_cmd in get_version set_env set_threads git_init child_exec; do
xbmk_$init_cmd "$@" || \
@@ -67,7 +64,6 @@ xbmkpkg()
printf "Updating package use...\n"
printf "Writing into %s" "$pkg_use_file..."
[ ! -d "`dirname $pkg_use_file`" ] && \
x_ mkdir -p "`dirname $pkg_use_file`"
printf "%s\n" "$pkg_use" >> "$pkg_use_file"
@@ -110,7 +106,6 @@ xbmk_get_version()
xbmk_set_env()
{
is_child="n"
xbmkpath="$PATH"
# unify all temporary files/directories in a single TMPDIR
@@ -126,10 +121,8 @@ xbmk_set_env()
if [ "$is_child" = "y" ]; then
xbmk_child_set_env
return 1 # child instance. discontinue initialisation.
else
xbmk_parent_set_env
return 0 # parent instance. continue initialisation.
fi
xbmk_parent_set_env
}
xbmk_child_set_env()
@@ -262,10 +255,6 @@ xbmk_set_version()
versiondate="$(git show --no-patch --no-notes \
--pretty='%ct' HEAD)" || versiondate="$versiondate_"
if [ -z "$version" ] || [ -z "$versiondate" ]; then
err "version and/or versiondate unset" "xbmk_set_version" "$@"
fi
update_xbmkver "."
relname="$projectname-$version"
@@ -298,15 +287,12 @@ xbmk_set_pyver()
err "Bad python version (must by 3.x)" "xbmk_set_pyver" "$@"
# set up python in PATH (environmental variable):
(
x_ cd "$xbtmp/xbmkpath"
x_ ln -s "`x_ pybin "$python"`" python || \
err "can't make symlink" "xbmk_set_pyver" "$@"
) || \
err "Can't link Python in $xbtmp/xbmkpath" "xbmk_set_pyver" "$@"; :
) || err "Can't link Python in $xbtmp/xbmkpath" xbmk_set_pyver "$@"; :
}
# Use direct path, to prevent a hang if Python is using a virtual environment,
+8 -21
View File
@@ -26,6 +26,10 @@ update_xbmkver()
{
xbmk_sanitize_version
if [ -z "${version-}" ] || [ -z "${versiondate-}" ]; then
err "version and/or versiondate unset" "update_xbmkver" "$@"
fi
printf "%s\n" "$version" > "$1/.version" || \
err "can't write '$1'" "update_xbmkver" "$@"; :
@@ -43,13 +47,8 @@ xbmk_sanitize_version()
[ -z "$version" ] && \
return 0
version="`printf "%s\n" "$version" | sed -e 's/\t//g'`"
version="`printf "%s\n" "$version" | sed -e 's/\ //g'`"
version="`printf "%s\n" "$version" | sed -e 's/\.\.//g'`"
version="`printf "%s\n" "$version" | sed -e 's/\.\///g'`"
version="`printf "%s\n" "$version" | sed -e 's/\//-/g'`"
version="${version#-}"
version="`printf '%s\n' "$version" | sed \
's/[[:space:]]//g; s/\.\.//g; s/\.\///g; s/\//-/g; s/^-//'`"
[ -z "$version" ] && \
err "'version' empty after sanitization" \
@@ -61,7 +60,7 @@ mktarball()
printf "Creating tar archive '%s' from directory '%s'\n" "$2" "$1"
[ "${2%/*}" != "$2" ] && \
x_ xbmkdir "${2%/*}"
x_ mkdir -p "${2%/*}"
x_ tar -c "$1" | xz -T$XBMK_THREADS -9e > "$2" || \
err "can't make tarball '$1'" "mktarball" "$@"
@@ -82,7 +81,6 @@ e()
fi
eval "$estr"
printf "%s %s\n" "$1" "$es2" 1>&2
}
@@ -109,7 +107,6 @@ findpath()
fi
printf "%s\n" "$found"
shift 1
done
}
@@ -149,17 +146,7 @@ build_sbase()
remkdir()
{
x_ rm -Rf "$@"
x_ xbmkdir "$@"
}
xbmkdir()
{
while [ $# -gt 0 ]; do
[ ! -d "$1" ] && \
x_ mkdir -p "$1"
shift 1
done
x_ mkdir -p "$@"
}
fx_()
+1 -1
View File
@@ -17,7 +17,7 @@ extract_refcode()
[ -z "$cbfstoolref" ] && \
err "cbfstoolref not set" "extract_refcode" "$@"
x_ xbmkdir "${_pre_dest%/*}"
x_ mkdir -p "${_pre_dest%/*}"
x_ "$cbfstoolref" "$appdir/bios.bin" extract \
-m x86 -n fallback/refcode -f "$appdir/ref" -r RO_SECTION
+6 -17
View File
@@ -1,32 +1,22 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright (c) 2023-2025 Leah Rowe <leah@libreboot.org>
# Copyright (c) 2023-2026 Leah Rowe <leah@libreboot.org>
reldest=""
reldir=""
relmode=""
rsrc=""
vdir=""
eval "`newvar reldest reldir relmode rsrc vdir`"
release()
{
export XBMK_RELEASE="y"
reldir="release"
while getopts m: option
do
[ -z "$OPTARG" ] && \
err "empty argument not allowed" "release" "$@"
case "$option" in
m)
relmode="$OPTARG"
;;
*)
[ "$option" != "m" ] && \
err "invalid option '-$option'" "release" "$@"
;;
esac
relmode="$OPTARG"
done
reldest="$reldir/$version"
@@ -36,7 +26,6 @@ release()
vdir="`mktemp -d || err "can't make vdir"`" || \
err "can't make tmp vdir" "release" "$@"
vdir="$vdir/$version"
rsrc="$vdir/${relname}_src"
remkdir "$vdir"
@@ -50,7 +39,7 @@ release()
x_ rm -Rf "$rsrc"
x_ xbmkdir "$reldir"
x_ mkdir -p "$reldir"
x_ mv "$vdir" "$reldir"
x_ rm -Rf "${vdir%"/$version"}"
+4 -5
View File
@@ -19,7 +19,7 @@ buildser()
x_ make -C "$sersrc" BOARD=$2
fi
x_ xbmkdir "bin/serprog_$1"
x_ mkdir -p "bin/serprog_$1"
x_ mv "$serx" "bin/serprog_$1/serprog_$2.${serx##*.}"
}
@@ -41,8 +41,7 @@ copyps1bios()
mkpayload_grub()
{
grub_modules=""
grub_install_modules=""
eval "`newvar grub_modules grub_install_modules`"
$if_dry_build \
return 0
@@ -110,7 +109,7 @@ check_coreboot_util()
return 0
fi
x_ xbmkdir "$utilelfdir"
x_ mkdir -p "$utilelfdir"
x_ cp "$utilsrcdir/$1" "$utilelfdir"
[ "$1" = "cbfstool" ] && \
@@ -423,7 +422,7 @@ cprom()
printf "Creating new %s image: '%s'\n" "$projectname" "$newrom"
x_ xbmkdir "bin/$target"
x_ mkdir -p "bin/$target"
x_ $cpcmd "$irom" "$newrom"
}
+3 -3
View File
@@ -333,7 +333,7 @@ project_up_to_date()
shift 3
x_ xbmkdir "$XBMK_CACHE/$hashdir"
x_ mkdir -p "$XBMK_CACHE/$hashdir"
if [ -f "$XBMK_CACHE/$hashdir/$project$hashname" ]; then
read -r old_hash < "$XBMK_CACHE/$hashdir/$project$hashname" \
@@ -382,7 +382,7 @@ check_cross_compiler()
xgccargs="crossgcc-$xfix UPDATED_SUBMODULES=1 CPUS=$XBMK_THREADS"
x_ ./mk -f coreboot "${cbdir#src/coreboot/}"
x_ xbmkdir "elf/coreboot/$tree" # TODO: is this needed?
x_ mkdir -p "elf/coreboot/$tree" # TODO: is this needed?
# tell build systems what cross-compiler to use
export PATH="$xbmkpwd/$cbdir/util/crossgcc/xgcc/bin:$PATH"
@@ -612,7 +612,7 @@ check_makefile()
copy_elf()
{
[ -f "$listfile" ] && \
x_ xbmkdir "$dest_dir"
x_ mkdir -p "$dest_dir"
if [ -f "$listfile" ]; then
while read -r f; do
+1 -1
View File
@@ -152,7 +152,7 @@ fetch()
[ -f "$_dest" ] && \
return 0
x_ xbmkdir "${_dest%/*}"
x_ mkdir -p "${_dest%/*}"
if [ "$dl_type" != "fsp" ]; then
extract_archive "$_dl" "$appdir" || \