Gentoo Logo
Gentoo Spaceship




Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gnap-dev
Navigation:
Lists: gnap-dev: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gnap-dev@g.o
From: "Philipp Riegger" <lists@...>
Subject: 02-split-gnap_overlay.patch
Date: Thu, 5 Jul 2007 16:04:46 +0300 (EEST)
Index: tools/gnap_shared.sh
===================================================================
--- tools/gnap_shared.sh	(revision 53)
+++ tools/gnap_shared.sh	(working copy)
@@ -1,15 +1,20 @@
 GNAPNAME=$(basename "$0")

 case ${GNAPNAME} in
-	gnap_make ) GNAPPRODUCT="Build";;
-	* )         GNAPPRODUCT="Something";;
+	gnap_make )    GNAPPRODUCT="Build";;
+	gnap_overlay ) GNAPPRODUCT="Overlay";;
+	* )            GNAPPRODUCT="Something";;
 esac

 GNAPLIBDIR='/usr/lib/gnap'
 STAGE3FILE="${GNAPLIBDIR}/gnap-stage3seed.tar.bz2"
 SNAPSHOTFILE="${GNAPLIBDIR}/gnap-portagesnapshot.tar.bz2"
 SPECS="${GNAPLIBDIR}/gnap-specs.tar.bz2"
+GNAPCORE="${GNAPLIBDIR}/gnap-core.tar"
+GNAPMBR="${GNAPLIBDIR}/mbr/mbr.bin"

+LOOP=''
+
 G=$'\e[32;01m'
 B=$'\e[31;01m'
 N=$'\e[0m'
@@ -67,6 +72,11 @@
 }

 cleanup() {
+	if [[ -n "${LOOP}" ]]; then
+		gbegin 'Unmounting loop filesystem'
+		umount "${LOOP}" && losetup -d "${LOOP}"
+		gtest $? "Failed to unmount ${LOOP}"
+	fi
 	gbegin 'Cleaning temporary directories'
 	if [[ -d "${TEMPDIR}" ]]; then
 		DIRTOREMOVE="${TEMPDIR}"
Index: tools/gnap_overlay
===================================================================
--- tools/gnap_overlay	(revision 52)
+++ tools/gnap_overlay	(working copy)
@@ -1,75 +1,11 @@
 #!/bin/bash
 VERSION='2.0'

-GNAPNAME=$(basename "$0")
+source "gnap_shared.sh"
 echo "GNAP overlay tool ${GNAPNAME} ${VERSION}"
-GNAPLIBDIR='/usr/lib/gnap'
-GNAPCORE="${GNAPLIBDIR}/gnap-core.tar"
-GNAPMBR="${GNAPLIBDIR}/mbr/mbr.bin"
-TEMPDIR=''
+
 IMG_SIZE=15

-G=$'\e[32;01m'
-B=$'\e[31;01m'
-N=$'\e[0m'
-W=$'\e[33;01m'
-K=$'\e[34;01m'
-C="$[$(set -- $(stty size 2>/dev/null); echo ${2}) - 7]"
-E=$'\e['${C}'G'
-
-gwarn() {
-	echo -e " ${W}*${N} ${*}"
-}
-
-ginfo() {
-	echo -e " ${G}*${N} ${*}"
-}
-
-gconfirm() {
-	if [[ "${FORCEYES}" -eq 1 ]]; then
-		gwarn "${*} forced to yes"
-	else
-		read -ep " ${W}*${N} ${*} [N]: " answer
-		if [[ "${answer}" != 'y' && "${answer}" != 'Y' ]]; then
-			if [[ -n "${TEMPDIR}" || -n "${LOOP}" ]]; then
-				cleanup
-			fi
-			echo 'Overlay aborted !'
-			exit 2
-		fi
-	fi
-}
-
-gbegin() {
-	echo -ne " ${G}*${N} ${*}..."
-}
-
-gtest() {
-	continued=0
-	if [[ "$#" -gt 0 && "${1}" == 'continued' ]]; then
-		shift
-		continued=1
-	fi
-
-	if [[ "${#}" -eq 0 || "${1}" -eq 0 ]]; then
-		if [[ "${continued}" -eq 0 ]]; then
-			echo -e "${E}  ${K}[ ${G}ok${K} ]${N}"
-		fi
-	else
-		echo -e "${E}  ${K}[ ${B}!!${K} ]${N}"
-		if [[ "$#" -ge 2 ]]; then
-			shift
-			echo -en " ${B}*${N} ${*}"
-			echo -e "${E}  ${K}[ ${B}!!${K} ]${N}"
-		fi
-		if [[ -n "${TEMPDIR}" || -n "${LOOP}" ]]; then
-			cleanup
-		fi
-		echo "Overlay failed, try ${GNAPNAME} -h for more help"
-		exit 1
-	fi
-}
-
 usage() {
 	echo
     echo 'Usage:'
@@ -102,23 +38,6 @@
     echo "Please man ${GNAPNAME} for more details."
 }

-cleanup() {
-	if [[ -n "${LOOP}" ]]; then
-		gbegin 'Unmounting loop filesystem'
-		umount "${LOOP}" && losetup -d "${LOOP}"
-		gtest $? "Failed to unmount ${LOOP}"
-	fi
-	gbegin 'Cleaning temporary directories'
-	if [[ -d "${TEMPDIR}" ]]; then
-		DIRTOREMOVE="${TEMPDIR}"
-		TEMPDIR=''
-		rm -rf "${DIRTOREMOVE}"
-		gtest $? "Failed to remove ${DIRTOREMOVE}"
-	else
-		gtest 0
-	fi
-}
-
 if [[ "$#" -eq 0 || "${1}" == '-h' ]]; then
 	usage
 	exit 0
Index: src/gnap_shared.sh
===================================================================
--- src/gnap_shared.sh	(revision 53)
+++ src/gnap_shared.sh	(working copy)
@@ -1,15 +1,20 @@
 GNAPNAME=$(basename "$0")

 case ${GNAPNAME} in
-	gnap_make ) GNAPPRODUCT="Build";;
-	* )         GNAPPRODUCT="Something";;
+	gnap_make )    GNAPPRODUCT="Build";;
+	gnap_overlay ) GNAPPRODUCT="Overlay";;
+	* )            GNAPPRODUCT="Something";;
 esac

 GNAPLIBDIR='/usr/lib/gnap'
 STAGE3FILE="${GNAPLIBDIR}/gnap-stage3seed.tar.bz2"
 SNAPSHOTFILE="${GNAPLIBDIR}/gnap-portagesnapshot.tar.bz2"
 SPECS="${GNAPLIBDIR}/gnap-specs.tar.bz2"
+GNAPCORE="${GNAPLIBDIR}/gnap-core.tar"
+GNAPMBR="${GNAPLIBDIR}/mbr/mbr.bin"

+LOOP=''
+
 G=$'\e[32;01m'
 B=$'\e[31;01m'
 N=$'\e[0m'
@@ -67,6 +72,11 @@
 }

 cleanup() {
+	if [[ -n "${LOOP}" ]]; then
+		gbegin 'Unmounting loop filesystem'
+		umount "${LOOP}" && losetup -d "${LOOP}"
+		gtest $? "Failed to unmount ${LOOP}"
+	fi
 	gbegin 'Cleaning temporary directories'
 	if [[ -d "${TEMPDIR}" ]]; then
 		DIRTOREMOVE="${TEMPDIR}"

-- 
gnap-dev@g.o mailing list


Navigation:
Lists: gnap-dev: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
Some patches for gnap
Next by thread:
Last meeting, current status of my project
Previous by date:
01-split-gnap_make.patch
Next by date:
03-split-gnap_remaster.patch


Updated Jun 17, 2009

Summary: Archive of the gnap-dev mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.