Verified Commit 7004b050 authored by Karel Koci's avatar Karel Koci 🤘

medkit generation: generate also for Turris

Also thanks to new updater version we can now use --model and --board
options instead of /tmp hack
parent 8062cbc1
......@@ -148,28 +148,29 @@ fi
if [ "$TARGET_BOARD" = "omnia" ]; then
rm -f $PUB_BIN_DIR/*.ext4 $PUB_BIN_DIR/*sums
if [ -n "$BUILD_ALL" ]; then
# Compile host tools
make package/curl/host/install package/libevent2/host/install package/lua/host/install
make package/updater-ng/host/install
# Generate medkit
BASE_PATH="`pwd`"
MED_PATH="bin-nand/mvebu-musl/medkit"
MED_TAR="omnia-medkit-$(date -d "$COMMIT_DATE" +%Y%m%d%H%M).tar.gz"
mkdir -p "$MED_PATH"
fakeroot ./scripts/updater-medkit.sh $MED_ARGS bin-nand/mvebu-musl "$MED_PATH/$MED_TAR"
pushd "$MED_PATH"
ln -s "$MED_TAR" omnia-medkit-latest.tar.gz
if [ -f "$HOME"/mime.key ]; then
"$BASE_PATH"/staging_dir/host/bin/usign -S -m "$MED_TAR" -s "$HOME"/mime.key
ln -s "$MED_TAR".sig omnia-medkit-latest.tar.gz.sig
fi
md5sum "$MED_TAR" > "$MED_TAR".md5
ln -s "$MED_TAR".md5 omnia-medkit-latest.tar.gz.md5
sha256sum "$MED_TAR" > "$MED_TAR".sha256
ln -s "$MED_TAR".sha256 omnia-medkit-latest.tar.gz.sha256
popd
fi
if [ -n "$BUILD_ALL" ]; then
# Compile host tools
make package/curl/host/install package/libevent2/host/install package/lua/host/install
make package/updater-ng/host/install
# Generate medkit
BASE_PATH="`pwd`"
MED_PATH="bin-nand/mvebu-musl/medkit"
MED_TAR="$TARGET_BOARD-medkit-$(date -d "$COMMIT_DATE" +%Y%m%d%H%M).tar.gz"
mkdir -p "$MED_PATH"
fakeroot ./scripts/updater-medkit.sh --model "$TARGET_BOARD" $MED_ARGS bin-nand/mvebu-musl "$MED_PATH/$MED_TAR"
pushd "$MED_PATH"
ln -s "$MED_TAR" "$TARGET_BOARD"-medkit-latest.tar.gz
if [ -f "$HOME"/mime.key ]; then
"$BASE_PATH"/staging_dir/host/bin/usign -S -m "$MED_TAR" -s "$HOME"/mime.key
ln -s "$MED_TAR".sig "$TARGET_BOARD"-medkit-latest.tar.gz.sig
fi
md5sum "$MED_TAR" > "$MED_TAR".md5
ln -s "$MED_TAR".md5 "$TARGET_BOARD"-medkit-latest.tar.gz.md5
sha256sum "$MED_TAR" > "$MED_TAR".sha256
ln -s "$MED_TAR".sha256 "$TARGET_BOARD"-medkit-latest.tar.gz.sha256
popd
fi
if [ "$TARGET_BOARD" = omnia ]; then
......
......@@ -11,6 +11,14 @@ while [ $# -gt 0 ]; do
echo " Note that this script is expected to be run in openwrt sdk root"
exit 0
;;
--model)
shift
if [ "$1" = "omnia" ]; then
MODEL="Turris Omnia"
elif [ "$1" = "turris" ]; then
MODEL="Turris"
fi
;;
*)
if [ -z "$OPENWRT_BIN" ]; then
OPENWRT_BIN="$1"
......@@ -38,6 +46,10 @@ done
echo "Directory staging_dir is missing from current working one!" >&2
exit 1
}
[ -n "$MODEL" ] || {
echo "Missing --model value" >&2
exit 1
}
# Insert staging path to environment so we can use tools from staging
export PATH="staging_dir/host/bin:staging_dir/host/usr/bin:$PATH"
......@@ -69,13 +81,6 @@ echo Reboot faked!" > $BUILD_DIR/bin/reboot
chmod +x $BUILD_DIR/bin/reboot
export PATH="$(readlink -f $BUILD_DIR/bin):$PATH"
# Create /tmp/sysinfo files
# TODO we should use some internal option of updater it self
mkdir -p /tmp/sysinfo
echo "Turris Omnia" > /tmp/sysinfo/model
# We are only using board_name anyway atm.
echo "rtunknown" > /tmp/sysinfo/board_name
ABSOUT="$(readlink -f $ROOT)"
export PATH="$PATH:$ABSOUT/usr/bin:$ABSOUT/usr/sbin:$ABSOUT/bin:$ABSOUT/sbin"
# First install base files before anything else
......@@ -103,7 +108,7 @@ for USRL in cacerts luci-controls nas netutils; do
echo "Script('$USRL', 'file://$OPENWRT_BIN/lists/$USRL.lua')" >> "$UPDATER_CONF"
done
# Run updater to pull in packages from base list
pkgupdate --out-of-root --usign=staging_dir/host/bin/usign -R $ABSOUT --batch file://$UPDATER_CONF
pkgupdate --model="$MODEL" --board=rtunknown --out-of-root --usign=staging_dir/host/bin/usign -R $ABSOUT --batch file://$UPDATER_CONF
# Run all postinst scripts because as we are bootstrapping environment some
# packages on beginning might have failed to be settled correctly (for example rc
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment