From 6ffd4540e0eb39f75211a0703e9d3c119de23103 Mon Sep 17 00:00:00 2001
From: Robert Nelson <robertcnelson@gmail.com>
Date: Tue, 20 May 2014 12:47:00 -0500
Subject: [PATCH] convert: eewiki_base_image.sh to --config xyz

Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
---
 RootStock-NG.sh                              |  24 +-
 config/eewiki_minfs_debian_stable_armel.conf |  19 ++
 config/eewiki_minfs_debian_stable_armhf.conf |  19 ++
 config/eewiki_minfs_ubuntu_stable_armhf.conf |  19 ++
 eewiki_base_image.sh                         | 331 -------------------
 readme.md                                    |   6 +-
 6 files changed, 84 insertions(+), 334 deletions(-)
 create mode 100644 config/eewiki_minfs_debian_stable_armel.conf
 create mode 100644 config/eewiki_minfs_debian_stable_armhf.conf
 create mode 100644 config/eewiki_minfs_ubuntu_stable_armhf.conf
 delete mode 100755 eewiki_base_image.sh

diff --git a/RootStock-NG.sh b/RootStock-NG.sh
index a73915c4c..ab0252259 100755
--- a/RootStock-NG.sh
+++ b/RootStock-NG.sh
@@ -66,6 +66,11 @@ run_roostock_ng () {
 	if [ ! -f ${DIR}/.project ] ; then
 		echo "error: [.project] file not defined"
 		exit 1
+	else
+		echo "Debug: .project"
+		echo "-----------------------------"
+		cat ${DIR}/.project
+		echo "-----------------------------"
 	fi
 
 	if [ ! "${tempdir}" ] ; then
@@ -105,10 +110,15 @@ check_project_config () {
 	#${project_config}.conf
 	project_config=$(echo ${project_config} | awk -F ".conf" '{print $1}')
 	if [ -f ${DIR}/config/${project_config}.conf ] ; then
-		echo "" > ${DIR}/.project
-		echo "tempdir=\"${tempdir}\"" >> ${DIR}/.project
+		. ${DIR}/config/${project_config}.conf
+		export_filename="${deb_distribution}-${release}-${image_type}-${deb_arch}-${time}"
+
+		echo "tempdir=\"${tempdir}\"" > ${DIR}/.project
 		echo "time=\"${time}\"" >> ${DIR}/.project
+		echo "export_filename=\"${export_filename}\"" >> ${DIR}/.project
+		echo "#" >> ${DIR}/.project
 		cat ${DIR}/config/${project_config}.conf >> ${DIR}/.project
+		need_to_compress_rootfs="enable"
 	else
 		echo "Invalid *.conf"
 		exit
@@ -119,6 +129,7 @@ git_trees
 
 cd ${DIR}/
 
+unset need_to_compress_rootfs
 # parse commandline options
 while [ ! -z "$1" ] ; do
 	case $1 in
@@ -136,4 +147,13 @@ done
 
 run_roostock_ng
 
+if [ "x${need_to_compress_rootfs}" = "xenable" ] ; then
+	echo "Starting Compression"
+	cd ${DIR}/deploy/
+
+	tar cvf ${export_filename}.tar ./${export_filename}
+
+	cd ${DIR}/
+fi
+
 #
diff --git a/config/eewiki_minfs_debian_stable_armel.conf b/config/eewiki_minfs_debian_stable_armel.conf
new file mode 100644
index 000000000..3d86d5299
--- /dev/null
+++ b/config/eewiki_minfs_debian_stable_armel.conf
@@ -0,0 +1,19 @@
+#
+release="7.5"
+image_type="minimal"
+#
+deb_distribution="debian"
+deb_codename="wheezy"
+deb_arch="armel"
+deb_include="initramfs-tools locales sudo mtd-utils git-core ca-certificates nano pastebinit file lsb-release bsdmainutils i2c-tools fbset hexedit hdparm memtester read-edid u-boot-tools acpid dosfstools btrfs-tools cpufrequtils ntpdate ppp usb-modeswitch usbutils apache2 openssh-server udhcpd avahi-daemon wireless-tools wpasupplicant lowpan-tools wvdial lshw hostapd rsync systemd python-dbus atmel-firmware firmware-ralink firmware-realtek libertas-firmware zd1211-firmware"
+deb_exclude=""
+deb_components="main contrib non-free"
+#
+rfs_username="debian"
+rfs_fullname="Demo User"
+rfs_password="temppwd"
+rfs_hostname="arm"
+rfs_startup_scripts="enable"
+rfs_startup_scripts_rcnee="enable"
+rfs_strip_locales="enable"
+#
diff --git a/config/eewiki_minfs_debian_stable_armhf.conf b/config/eewiki_minfs_debian_stable_armhf.conf
new file mode 100644
index 000000000..8e658672e
--- /dev/null
+++ b/config/eewiki_minfs_debian_stable_armhf.conf
@@ -0,0 +1,19 @@
+#
+release="7.5"
+image_type="minimal"
+#
+deb_distribution="debian"
+deb_codename="wheezy"
+deb_arch="armhf"
+deb_include="initramfs-tools locales sudo mtd-utils git-core ca-certificates nano pastebinit file lsb-release bsdmainutils i2c-tools fbset hexedit hdparm memtester read-edid u-boot-tools acpid dosfstools btrfs-tools cpufrequtils ntpdate ppp usb-modeswitch usbutils apache2 openssh-server udhcpd avahi-daemon wireless-tools wpasupplicant lowpan-tools wvdial lshw hostapd rsync systemd python-dbus atmel-firmware firmware-ralink firmware-realtek libertas-firmware zd1211-firmware"
+deb_exclude=""
+deb_components="main contrib non-free"
+#
+rfs_username="debian"
+rfs_fullname="Demo User"
+rfs_password="temppwd"
+rfs_hostname="arm"
+rfs_startup_scripts="enable"
+rfs_startup_scripts_rcnee="enable"
+rfs_strip_locales="enable"
+#
diff --git a/config/eewiki_minfs_ubuntu_stable_armhf.conf b/config/eewiki_minfs_ubuntu_stable_armhf.conf
new file mode 100644
index 000000000..b5c390eed
--- /dev/null
+++ b/config/eewiki_minfs_ubuntu_stable_armhf.conf
@@ -0,0 +1,19 @@
+#
+release="14.04"
+image_type="minimal"
+#
+deb_distribution="ubuntu"
+deb_codename="trusty"
+deb_arch="armhf"
+deb_include="initramfs-tools locales sudo mtd-utils git-core ca-certificates nano pastebinit file lsb-release bsdmainutils i2c-tools fbset hexedit hdparm memtester read-edid u-boot-tools acpid dosfstools btrfs-tools cpufrequtils ntpdate ppp usb-modeswitch usbutils apache2 openssh-server udhcpd avahi-daemon wireless-tools wpasupplicant lowpan-tools wvdial lshw hostapd rsync devmem2 python-software-properties linux-firmware"
+deb_exclude=""
+deb_components="main universe multiverse"
+#
+rfs_username="ubuntu"
+rfs_fullname="Demo User"
+rfs_password="temppwd"
+rfs_hostname="arm"
+rfs_startup_scripts="enable"
+rfs_startup_scripts_rcnee="enable"
+rfs_strip_locales="enable"
+#
diff --git a/eewiki_base_image.sh b/eewiki_base_image.sh
deleted file mode 100755
index 35ab248ad..000000000
--- a/eewiki_base_image.sh
+++ /dev/null
@@ -1,331 +0,0 @@
-#!/bin/sh -e
-#
-# Copyright (c) 2009-2014 Robert Nelson <robertcnelson@gmail.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-SYST=$(uname -n)
-time=$(date +%Y-%m-%d)
-
-DIR=$PWD
-if [ ! -d ${DIR}/ignore ] ; then
-	mkdir -p ${DIR}/ignore
-fi
-tempdir=$(mktemp -d -p ${DIR}/ignore)
-
-image_type="minimal"
-
-. ${DIR}/lib/distro.sh
-
-minimal_armel () {
-	rm -f "${DIR}/.project" || true
-
-	#Actual Releases will use version numbers..
-	case "${deb_codename}" in
-	wheezy)
-		#https://www.debian.org/releases/wheezy/
-		export_filename="${deb_distribution}-${wheezy_release}-${image_type}-${deb_arch}-${time}"
-		;;
-	saucy)
-		export_filename="${deb_distribution}-${saucy_release}-${image_type}-${deb_arch}-${time}"
-		;;
-	trusty)
-		export_filename="${deb_distribution}-${trusty_release}-${image_type}-${deb_arch}-${time}"
-		;;
-	*)
-		export_filename="${deb_distribution}-${deb_codename}-${image_type}-${deb_arch}-${time}"
-		;;
-	esac
-
-	tempdir=$(mktemp -d -p ${DIR}/ignore)
-
-	cat > ${DIR}/.project <<-__EOF__
-		tempdir="${tempdir}"
-		export_filename="${export_filename}"
-
-		deb_distribution="${deb_distribution}"
-		deb_codename="${deb_codename}"
-		deb_arch="${deb_arch}"
-		deb_include="${deb_include}"
-		deb_exclude="${deb_exclude}"
-		deb_components="${deb_components}"
-
-		time="${time}"
-
-		deb_mirror="${deb_mirror}"
-
-		apt_proxy="${apt_proxy}"
-
-		base_pkg_list=""
-		chroot_multiarch_armel="${chroot_multiarch_armel}"
-
-		rfs_username="${rfs_username}"
-		rfs_fullname="${rfs_fullname}"
-		rfs_password="${rfs_password}"
-
-		rfs_hostname="${rfs_hostname}"
-		rfs_startup_scripts="${rfs_startup_scripts}"
-		rfs_startup_scripts_rcnee="${rfs_startup_scripts_rcnee}"
-
-		rfs_strip_locales="${rfs_strip_locales}"
-
-		include_firmware="${include_firmware}"
-
-		chroot_very_small_image="${chroot_very_small_image}"
-		chroot_ENABLE_DEB_SRC="${chroot_ENABLE_DEB_SRC}"
-		chroot_KERNEL_HTTP_DIR="${chroot_KERNEL_HTTP_DIR}"
-
-		repo_external="${repo_external}"
-		repo_external_arch="${repo_external_arch}"
-		repo_external_server="${repo_external_server}"
-		repo_external_dist="${repo_external_dist}"
-		repo_external_components="${repo_external_components}"
-		repo_external_key="${repo_external_key}"
-
-		chroot_COPY_SETUP_SDCARD="${chroot_COPY_SETUP_SDCARD}"
-
-		chroot_hook="${chroot_hook}"
-		chroot_script="${chroot_script}"
-		chroot_uenv_txt="${chroot_uenv_txt}"
-
-		chroot_enable_debian_backports="${chroot_enable_debian_backports}"
-		chroot_debian_backports_pkg_list="${chroot_debian_backports_pkg_list}"
-
-	__EOF__
-
-	cat ${DIR}/.project
-
-	/bin/sh -e "${DIR}/RootStock-NG.sh" || { exit 1 ; }
-}
-
-compression () {
-	echo "Starting Compression"
-	cd ${DIR}/deploy/
-
-	tar cvf ${export_filename}.tar ./${export_filename}
-
-	if [ -f ${DIR}/release ] ; then
-		if [ "x${SYST}" = "x${RELEASE_HOST}" ] ; then
-			if [ -d /mnt/farm/testing/pending/ ] ; then
-				cp -v ${export_filename}.tar /mnt/farm/testing/pending/${export_filename}.tar
-			fi
-		fi
-	fi
-	cd ${DIR}/
-}
-
-production () {
-	echo "Starting Production Stage"
-	cd ${DIR}/deploy/
-
-	unset actual_dir
-	if [ -f ${DIR}/release ] ; then
-		if [ "x${SYST}" = "x${RELEASE_HOST}" ] ; then
-			if [ -d /mnt/farm/testing/pending/ ] ; then
-				cp -v arm*.tar /mnt/farm/images/ || true
-				actual_dir="/mnt/farm/testing/pending"
-			fi
-		fi
-	fi
-
-	cat > ${DIR}/deploy/gift_wrap_final_images.sh <<-__EOF__
-	#!/bin/bash
-	#This script's only purpose is to remember a mundane task from release to release for the release manager.
-
-	xz -z -7 -v debian-${wheezy_release}-${image_type}-armel-${time}.tar
-	xz -z -7 -v debian-${wheezy_release}-${image_type}-armhf-${time}.tar
-
-	xz -z -7 -v ubuntu-14.04-${image_type}-armhf-${time}.tar
-
-	__EOF__
-
-	chmod +x ${DIR}/deploy/gift_wrap_final_images.sh
-
-	if [ ! "x${actual_dir}" = "x" ] ; then
-		cp ${DIR}/deploy/gift_wrap_final_images.sh ${actual_dir}/gift_wrap_final_images.sh
-		chmod +x ${actual_dir}/gift_wrap_final_images.sh
-	fi
-
-	cd ${DIR}/
-}
-
-pkg_list () {
-	deb_include=""
-	if [ ! "x${no_pkgs}" = "xenable" ] ; then
-		. ${DIR}/var/pkg_list.sh
-
-		required="initramfs-tools,locales,sudo,mtd-utils,git-core"
-
-		if [ "x${include_firmware}" = "xenable" ] ; then
-			deb_include="${required} ${base_pkgs} ${extra_pkgs} ${firmware_pkgs}"
-		else
-			deb_include="${required} ${base_pkgs} ${extra_pkgs}"
-		fi
-		deb_include=$(echo ${deb_include} | sed 's/  / /g')
-	fi
-}
-
-is_ubuntu () {
-	deb_distribution="ubuntu"
-
-	rfs_hostname="arm"
-	rfs_username="ubuntu"
-	rfs_password="temppwd"
-	rfs_fullname="Demo User"
-
-	deb_mirror="ports.ubuntu.com/ubuntu-ports/"
-
-	pkg_list
-	deb_exclude=""
-	deb_components="main universe multiverse"
-}
-
-is_debian () {
-	deb_distribution="debian"
-
-	rfs_hostname="arm"
-	rfs_username="debian"
-	rfs_password="temppwd"
-	rfs_fullname="Demo User"
-
-	deb_mirror="ftp.us.debian.org/debian/"
-
-	pkg_list
-	deb_exclude=""
-	deb_components="main contrib non-free"
-#	chroot_very_small_image="enable"
-}
-
-#13.10
-saucy_release () {
-	extra_pkgs="devmem2 python-software-properties"
-	firmware_pkgs="linux-firmware"
-	is_ubuntu
-	deb_codename="saucy"
-
-	minimal_armel
-	compression
-}
-
-#14.04 (lts)
-trusty_release () {
-	extra_pkgs="devmem2 python-software-properties"
-	firmware_pkgs="linux-firmware"
-	is_ubuntu
-	deb_codename="trusty"
-
-	minimal_armel
-	compression
-}
-
-#14.10
-utopic_release () {
-	extra_pkgs="devmem2 python-software-properties"
-	firmware_pkgs="linux-firmware"
-	is_ubuntu
-	deb_codename="utopic"
-
-	minimal_armel
-	compression
-}
-
-wheezy_release () {
-	extra_pkgs="systemd python-dbus"
-	firmware_pkgs="atmel-firmware firmware-ralink firmware-realtek libertas-firmware zd1211-firmware"
-	is_debian
-	deb_codename="wheezy"
-
-	minimal_armel
-	compression
-}
-
-jessie_release () {
-	extra_pkgs="systemd python-dbus"
-	firmware_pkgs="atmel-firmware firmware-ralink firmware-realtek libertas-firmware zd1211-firmware"
-	is_debian
-	deb_codename="jessie"
-
-	minimal_armel
-	compression
-}
-
-sid_release () {
-	extra_pkgs="systemd python-dbus"
-	firmware_pkgs="atmel-firmware firmware-ralink firmware-realtek libertas-firmware zd1211-firmware"
-	is_debian
-	deb_codename="sid"
-
-	minimal_armel
-	compression
-}
-
-if [ ! "${apt_proxy}" ] ; then
-	apt_proxy=""
-fi
-if [ ! "${mirror}" ] ; then
-	mirror="https://rcn-ee.net/deb"
-fi
-if [ -f ${DIR}/rcn-ee.host ] ; then
-	. ${DIR}/host/rcn-ee-host.sh
-fi
-
-mkdir -p ${DIR}/deploy/
-
-if [ -f ${DIR}/release ] ; then
-	chroot_ENABLE_DEB_SRC="enable"
-fi
-
-#chroot_COPY_SETUP_SDCARD="enable"
-
-#FIXME: things to add to .config:
-include_firmware="enable"
-rfs_startup_scripts="enable"
-rfs_startup_scripts_rcnee="enable"
-#chroot_script=""
-
-rfs_strip_locales="${rfs_strip_locales:-enable}"
-
-#repo_external=""
-#repo_external_arch=""
-#repo_external_server=""
-#repo_external_dist=""
-#repo_external_components=""
-#repo_external_key=""
-
-#no_pkgs="enable"
-
-#chroot_multiarch_armel=""
-
-#chroot_enable_debian_backports=""
-#chroot_debian_backports_pkg_list=""
-
-deb_arch="armel"
-wheezy_release
-#jessie_release
-
-deb_arch="armhf"
-wheezy_release
-#jessie_release
-trusty_release
-
-production
-
-rm -rf ${tempdir} || true
-
-echo "done"
diff --git a/readme.md b/readme.md
index d0cbaf9b7..00d34943b 100644
--- a/readme.md
+++ b/readme.md
@@ -42,7 +42,11 @@ Master branch:
 
 Images:
 
-    ./eewiki_base_image.sh
+    ./RootStock-NG.sh -c eewiki_minfs_debian_stable_armel
+    ./RootStock-NG.sh -c eewiki_minfs_debian_stable_armhf
+    ./RootStock-NG.sh -c eewiki_minfs_ubuntu_stable_armhf
+    http://eewiki.net/display/linuxonarm/Home
+
     ./eewiki_barefs_image.sh
     http://eewiki.net/display/linuxonarm/Home
 
-- 
GitLab