aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbuild_all.sh129
-rw-r--r--mageia4arm.conf.json21
2 files changed, 150 insertions, 0 deletions
diff --git a/build_all.sh b/build_all.sh
new file mode 100755
index 0000000..c6e0a48
--- /dev/null
+++ b/build_all.sh
@@ -0,0 +1,129 @@
+#!/usr/bin/bash
+
+# Copyright (C) 2020 Jean-Baptiste Biernacki <j.biernacki@free.fr>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License,dnf or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+#Change the local to the most global
+export LC_ALL=C
+
+CMD_LINE="${@}"
+CMDNAME="$(/usr/bin/basename "${0}")"
+PROG_DIR="$(/usr/bin/dirname "$(readlink -f ${0})")"
+
+source "${PROG_DIR}/functions.sh"
+source "${PROG_DIR}/build_all.cfg"
+CONFIG_FILE="/etc/mageia4arm.conf.json"
+
+CONFIG_FILE_NOT_FOUND=-1
+CONFIG_FILE_ERROR=-1
+
+unset exit
+
+function help() {
+ echo -e "${CMDNAME} [option]"
+ echo -e "Options:"
+ echo -e "--config file Specify a config file, by default /etc/mageia4arm.conf.json"
+}
+
+function help() {
+ echo -e "${CMDNAME}"
+ echo -e "Generates Mageia images for all SBC defined in the mageia4arm.conf.json file."
+}
+
+case $(hostname) in
+ *.mageia.org) sudo_root="sudo -u draklive sudo"; sudo_bcd="sudo -u bcd";;
+ *) sudo_root="su -c"; sudo_bcd="su -c";;
+esac
+
+print_info ${0}
+
+# parsing commandline
+TEMP=$(getopt -o c:,h --long config:,help -n ${CMDNAME} -- "${@}")
+if [ ${?} -ne 0 ] ; then error "line ${LINENO} Failed parsing options." >&2 ; exit ${ERR_1} ; fi
+eval set -- "${TEMP}"
+
+
+# echo "${TEMP}"
+while true; do
+ case "${1}" in
+ -c|--config)
+ if [ "x" != "x${2}" ]; then
+ #check file in cmdline
+ if [ -e ${2} ]; then
+ #check if exists
+ CONFIG_FILE="${2}"
+ fi
+ fi
+ shift 2
+ ;;
+ -h|--help)
+ help
+ exit 0
+ ;;
+ --)
+ shift
+ break;;
+ *)
+ error "Parameter ${1} does not exists "
+ exit ${ERR_1};;
+ esac
+done
+
+
+if [ ! -e "${CONFIG_FILE}" ]; then
+ error "Config file (${CONFIG_FILE}) not found !"
+ exit ${CONFIG_FILE_NOT_FOUND}
+fi
+
+
+# If SBCs is not defined in the config file, take ALL board in the platforms directory.
+SBCs="$(cat ${CONFIG_FILE} | jq -c ".SBCs[]")"
+if [ 0 -ne "${?}" ]; then
+ error "Config file (${CONFIG_FILE}) is not json or contains syntax error!"
+ exit ${CONFIG_FILE_ERROR}
+fi
+
+vendor="$(cat ${CONFIG_FILE} | jq -c ".vendor")"
+distro="$(cat ${CONFIG_FILE} | jq -c ".distro")"
+release="$(cat ${CONFIG_FILE} | jq -c ".release")"
+region="$(cat ${CONFIG_FILE} | jq -c ".region")"
+repository="$(cat ${CONFIG_FILE} | jq -c ".repository")"
+workdir="$(cat ${CONFIG_FILE} | jq -c ".workdir")"
+destdir="$(cat ${CONFIG_FILE} | jq -c ".destdir")"
+
+
+for SBC_config in ${SBCs}; do
+ SBC="$(echo ${SBC_config} | jq -r '.board')"
+ DESKTOP_STEP="$(echo ${SBC_config} | jq '.desktop')"
+ if [ "null" != "${DESKTOP_STEP}" ]; then
+ DESKTOP="--desktop $(echo ${SBC_config} | jq '.desktop')"
+ else
+ unset DESKTOP
+ fi
+ NONFREE_STEP="$(echo ${SBC_config} | jq '.nonfree')"
+ if [ "true" = "${NONFREE_STEP}" ]; then
+ NONFREE="--nonfree"
+ else
+ unset NONFREE
+ fi
+ SBC="$(echo ${SBC_config} | jq -r '.board')"
+ print_info "Start build for ${SBC}"
+ $sudo_root "${PROG_DIR}/create_arm_image.sh --all --build-path ${workdir} --config ${SBC} ${DESKTOP} ${NONFREE} --compress --add-checksum 2>&1 | tee -a ${workdir}/$(date "+%Y-%m-%d_%H:%M")-${SBC}.log"
+ $sudo_bcd "mkdir -p ${destdir}/${SBC}"
+ $sudo_bcd "mv ${workdir}/* ${destdir}/${SBC}/"
+ # not enough space on rabbit's RAM disk for all four variants, so delete as we go
+ $sudo_root "${PROG_DIR}/create_arm_image.sh --clean --build-path ${workdir} --config ${SBC}"
+done
+exit 0
diff --git a/mageia4arm.conf.json b/mageia4arm.conf.json
new file mode 100644
index 0000000..422b0c1
--- /dev/null
+++ b/mageia4arm.conf.json
@@ -0,0 +1,21 @@
+{
+ "vendor":"Mageia.Org",
+ "distro":"Mageia",
+ "release":"8-beta1",
+ "region":"all",
+ "repository":"/home/bcd/build_bcd/pieces/cauldron",
+ "workdir":"/home/mageia4arm/var-data",
+ "destdir":"/home/bcd/public_html/isos/trial-builds",
+ "Available_desktoplist":[ "cinnamon","cinnamon-minimal","enlightenment","enlightenment-minimal","fvwm2","gnome","gnome-minimal","lxde","lxde-minimal","lxqt","lxqt-minimal","mate","mate-minimal","plasma5","plasma5-minimal","sugar","windowmaker","xfce","xfce-minimal"],
+
+ "SBCs": [
+ { "board":"bananaPro", "desktop":null, "extra_packages":null, "nonfree":true }
+ ],
+
+ "Available_SBCs": [
+ { "board":"bananaPro", "desktop":null, "extra_packages":null, "nonfree":true },
+ { "board":"generic_aarch64", "desktop":null, "extra_packages":null, "nonfree":false },
+ { "board":"rpi2", "desktop":null, "extra_packages":null, "nonfree":false },
+ { "board":"rpi3+64", "desktop":"lxde", "extra_packages":null, "nonfree":false }
+ ]
+}