diff --git a/x230/.gitignore b/x230/.gitignore index 4c5628a..66798e0 100644 --- a/x230/.gitignore +++ b/x230/.gitignore @@ -1,3 +1,4 @@ output x230_coreboot_seabios_*rom* build +/config-* diff --git a/x230/README.md b/x230/README.md index c090be9..e796eb3 100644 --- a/x230/README.md +++ b/x230/README.md @@ -262,5 +262,5 @@ Mainly a tiny binary used by the Ethernet card and the Intel Management Engine. ## how to reproduce the release images * `git clone https://github.com/merge/skulls` -* rename one of the included config files to `config-xxxxxxxxxx`. -* The x230 directory's `./build.sh` should produce the exact corresponding release image file. +* `cd skulls/x230` +* `./build.sh` and choose the configuration you want to build diff --git a/x230/build.sh b/x230/build.sh index dfa5a21..1a9e62c 100755 --- a/x230/build.sh +++ b/x230/build.sh @@ -1,8 +1,79 @@ #!/bin/bash -ls -1 config* || exit 0 . skulls_common.sh warn_not_root +have_config=0 + +usage() +{ + echo "Skulls for the X230" + echo " Run this script to rebuild a released image" + echo "" + echo "Usage: $0 [-c ]" + echo "" + echo " -c to use for flashrom" +} + +args=$(getopt -o c:h -- "$@") +if [ $? -ne 0 ] ; then + usage + exit 1 +fi + +eval set -- "$args" +while [ $# -gt 0 ] +do + case "$1" in + -c) + CONFIGFILE=$2 + have_config=1 + shift + ;; + -h) + usage + exit 1 + ;; + --) + shift + break + ;; + *) + echo "Invalid option: $1" + exit 1 + ;; + esac + shift +done + +if [ ! "$have_config" -gt 0 ] ; then + configs_available=$(ls -1 | grep config || true) + if [ -z "${configs_available}" ] ; then + echo "No config file found. Please add -c " + echo "" + usage + exit 1 + fi + + prompt="Please select a configuration to use for building or start with the -c option to use a different one:" + options=( $(find -maxdepth 1 -name "*config*" -print0 | xargs -0) ) + + PS3="$prompt " + select CONFIGFILE in "${options[@]}" "Quit" ; do + if (( REPLY == 1 + ${#options[@]} )) ; then + exit + + elif (( REPLY > 0 && REPLY <= ${#options[@]} )) ; then + break + + else + echo "Invalid option. Try another one." + fi + done +fi + +CONFIGFILE_READY=$(echo $CONFIGFILE | cut -d'-' -f2-) +cp $CONFIGFILE $CONFIGFILE_READY + cd .. ./build.sh --clean-slate --commit $(ls -1 x230/config-* | cut -c 13-22) x230