#!/bin/bash # # This script is licensed under GPL v3 or higher # # Author: Angel Berlanas Vicente # # Some usefull values SYSTEM_CONF_PATH="/etc/live/build.d" DEFAULT_BUILD_DIR="/graveyard/" DISTRIBUTION="1306" DESTINATION_BUILD_DIR="/graveyard_$(date +%Y%m%d)" prepare_destination_folder() { # Prepare destination logger -s "lliurex-factory - creation of ${DESTINATION_BUILD_DIR}" mkdir -p ${DESTINATION_BUILD_DIR} } test_user_root() { # Get the current id CURRENT_ID="$(id -u)" if [ ${CURRENT_ID} -ne 0 ] ; then echo "You must be root, my friend" exit 0 fi } # # Main TIME_OF_CREATION="$(date +%Y%m%d)" test_user_root prepare_destination_folder for f in $(ls -1 ${SYSTEM_CONF_PATH}/factory-platin*); do NAME_OF_THE_ISO="$(echo $(basename $f)| sed -e "s%factory-%%g")" NAME_FINAL="${NAME_OF_THE_ISO}_${DISTRIBUTION}_${TIME_OF_CREATION}.iso" logger -s "lliurex-factory - Working with : ${NAME_FINAL}" cd /graveyard/ logger -s "lliurex-factory - Cleaning " lliurex-maker clean logger -s "lliurex-factory - Build " lliurex-maker build "$(basename ${f})" logger -s "lliurex-factory - Copying iso " mv binary-hybrid.iso ${DESTINATION_BUILD_DIR}/${NAME_FINAL} logger -s "lliurex-factory - All is done! Next! " done