SF.net SVN: morphix: [2384] trunk/morph-scripts

[email protected] Tue, 15 Aug 2006 14:26:56 -0700
Newsgroups gmane.linux.morphix.cvs
Message-ID <[email protected]>
Revision: 2384
Author:   bmsleight
Date:     2006-08-15 14:26:43 -0700 (Tue, 15 Aug 2006)
ViewCVS:  http://svn.sourceforge.net/morphix/?rev=2384&view=rev

Log Message:
-----------
Added morphix-chroot tool (And tested that the debina package actually builds)

Modified Paths:
--------------
    trunk/morph-scripts/Makefile
    trunk/morph-scripts/debian/changelog
    trunk/morph-scripts/debian/control
    trunk/morph-scripts/debian/rules
    trunk/morph-scripts/mmorphix/morphing-morphix-gui.sh

Added Paths:
-----------
    trunk/morph-scripts/debian/morphix-chroot.1
    trunk/morph-scripts/morphix-chroot.sh
Modified: trunk/morph-scripts/Makefile
===================================================================
--- trunk/morph-scripts/Makefile	2006-08-10 20:37:32 UTC (rev 2383)
+++ trunk/morph-scripts/Makefile	2006-08-15 21:26:43 UTC (rev 2384)
@@ -1,7 +1,7 @@
 
 all: install
 
-install: i2mainmod isomorph modulebuilder changekernel minimodgen debget moduleextractor moduleloader add_to_iso convert_to_bootimg morphing-morphix morphix-morphmini morphix-rebrand
+install: i2mainmod isomorph modulebuilder changekernel minimodgen debget moduleextractor moduleloader add_to_iso convert_to_bootimg morphing-morphix morphix-morphmini morphix-rebrand morphix-chroot
 
 build_minimod:
 	mkdir -p $(DESTDIR)/usr/sbin
@@ -74,6 +74,11 @@
 	cp ./mmorphix/morphing-morphix.messages $(DESTDIR)/usr/share/doc/morphing-morphix/morphing-morphix.messages
 	chmod a+x $(DESTDIR)/usr/sbin/morphing-morphix 	
 
+morphix-chroot:
+	mkdir -p $(DESTDIR)/usr/sbin
+	cp ./morphix-chroot.sh $(DESTDIR)/usr/sbin/morphix-chroot
+	chmod a+x $(DESTDIR)/usr/sbin/morphix-chroot
+	
 morphix-rebrand:
 	mkdir -p $(DESTDIR)/usr/sbin
 	mkdir -p $(DESTDIR)/usr/share/morphix-rebrand/
@@ -108,4 +113,5 @@
 	rm $(DESTDIR)/usr/share/doc/morphing-morphix/morphing-morphix.messages
 	rm $(DESTDIR)/usr/sbin/morphmini
 	rm $(DESTDIR)/usr/sbin/morphix-rebrand
+	rm $(DESTDIR)/usr/sbin/morphix-chroot
 	rm $(DESTDIR)/usr/share/morphix-rebrand/morphix-iso-grubtheme_0.1-4.tar.gz

Modified: trunk/morph-scripts/debian/changelog
===================================================================
--- trunk/morph-scripts/debian/changelog	2006-08-10 20:37:32 UTC (rev 2383)
+++ trunk/morph-scripts/debian/changelog	2006-08-15 21:26:43 UTC (rev 2384)
@@ -1,8 +1,14 @@
+morph-scripts (0.2-31) unstable; urgency=low
+
+  * added morphix-chroot
+
+ -- bmsleight <[email protected]>  Tue, 15 Aug 2006 22:00:00 +0100
+
 morph-scripts (0.2-30) unstable; urgency=low
 
- * morphix-rebrand minor update
+  * morphix-rebrand minor update
 
- -- bmsleight <[email protected]>  Thu, 10 Aug 2006 21:30:00 +0100
+ -- bmsleight <[email protected]>  Thu, 10 Aug 2006 19:45:00 +0100
 
 morph-scripts (0.2-29) unstable; urgency=low
 

Modified: trunk/morph-scripts/debian/control
===================================================================
--- trunk/morph-scripts/debian/control	2006-08-10 20:37:32 UTC (rev 2383)
+++ trunk/morph-scripts/debian/control	2006-08-15 21:26:43 UTC (rev 2384)
@@ -118,3 +118,8 @@
 Architecture: any
 Depends: morphix-make-iso, make, imagemagick, gfxboot
 Description: Rebrands a Morphix LiveCD, using a single graphics file.
+
+Package: morphix-chroot
+Architecture: any
+Depends: coreutils, morphix-modulebuilder, morphix-moduleextractor 
+Description: chroot into a Morphix MainModule.

Added: trunk/morph-scripts/debian/morphix-chroot.1
===================================================================
--- trunk/morph-scripts/debian/morphix-chroot.1	                        (rev 0)
+++ trunk/morph-scripts/debian/morphix-chroot.1	2006-08-15 21:26:43 UTC (rev 2384)
@@ -0,0 +1,69 @@
+.\"Generated by db2man.xsl. Don't modify this, modify the source.
+.de Sh \" Subsection
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Ip \" List item
+.br
+.ie \\n(.$>=3 .ne \\$3
+.el .ne 3
+.IP "\\$1" \\$2
+..
+.TH "MORPHIX_CHROOT" 1 "" "" ""
+.SH NAME
+morphix-chroot \- chroot into a Morphix MainModule
+.SH "SYNOPSIS"
+
+
+\fImorphix\-chroot\fR MainModule\&.mod
+
+.SH "DESCRIPTION"
+
+
+This script extracts a MainModule, then drops you into the root of the file system We can make any changes we need to the MainModule, it is just like you are running the compressed file system, rather than the current filesystem\&. Once finished we re\-compresses the MainModule
+
+
+The MainModule must be on a partition that has been mounted with the option dev, (\-o dev)
+
+.SH "EXAMPLES"
+
+.TP
+Rebrand
+morphix\-rebrand /tmp/morphing\-morphix\&.mod
+
+.SH "SECURITY"
+
+
+Needs to be run as root or via sudo\&. So has security implications\&.
+
+.SH "NOTES"
+
+
+Morphix is a modular\-based liveCD, designed to be easy to modify\&. The package morphing\-tools and morphix\-mmaker contains tools to help modify and build morphix\-based LiveCDs\&.
+
+.SH "BUGS"
+
+
+Dont panic\&. If you find one, report it to us, but please make sure you have read all of the documentation first\&. We have assumed that you have cloop device and have installed the packages morphing\-tools and morphix\-mmaker\&.
+
+.SH "AUTHORS"
+
+
+Written by Alex de Landgraaf and other Morphix developers\&. Morphix web site: \fIhttp://www.morphix.org/\fR\&. Browse cvs repository[http://sourceforge\&.net/projects/morphix] and cvs mailing lists for full list of developers and patches submitted\&.
+
+
+This man page was written by Brendan Sleight using asciidoc: \fIhttp://www.methods.co.nz/asciidoc/\fR
+
+.SH "SEE ALSO"
+
+
+\fIaddtoiso, install2mainmod, isomaker, isomorph, make\-iso, make\-mini, minimod\-gen, mmaker, module\-builder, module\-extractor, morphmini\fR
+

Modified: trunk/morph-scripts/debian/rules
===================================================================
--- trunk/morph-scripts/debian/rules	2006-08-10 20:37:32 UTC (rev 2383)
+++ trunk/morph-scripts/debian/rules	2006-08-15 21:26:43 UTC (rev 2384)
@@ -66,6 +66,7 @@
 	$(MAKE) morphing-morphix DESTDIR=$(CURDIR)/debian/morphing-morphix
 	$(MAKE) morphmini DESTDIR=$(CURDIR)/debian/morphix-morphmini
 	$(MAKE) morphix-rebrand DESTDIR=$(CURDIR)/debian/morphix-rebrand
+	$(MAKE) morphix-chroot DESTDIR=$(CURDIR)/debian/morphix-chroot
 	dh_install -s
 
 # Must not depend on anything. This is to be called by

Modified: trunk/morph-scripts/mmorphix/morphing-morphix-gui.sh
===================================================================
--- trunk/morph-scripts/mmorphix/morphing-morphix-gui.sh	2006-08-10 20:37:32 UTC (rev 2383)
+++ trunk/morph-scripts/mmorphix/morphing-morphix-gui.sh	2006-08-15 21:26:43 UTC (rev 2384)
@@ -63,6 +63,7 @@
  SETTING_LOG_FILE=~/mmorphix.log
  SETTING_LOG_COMMANDS=~/mmscript.sh
  SETTING_MYMORPH="MyMorph.iso"
+ SETTING_MYMORPH_MAIN="morphing-morphix.mod"
  TMP_FILE=/tmp/mmorphix.$$
  TMP_FILE_2=/tmp/mmorphix_.$$
  TMP_SCRIPT=/tmp/mmorphix.$$.sh
@@ -354,7 +355,50 @@
 mv ./tmp.iso ./MyMorph.iso
 "
 ###########################################################
+MESSAGE_REBRAND="Rebrand an ISO
 
+This  script  Re-brands  a Morphix CD image using a graphic
+file. 
+
+The following will be changed:-
+ * Boot Menu
+ <insert from online manual>
+"
+MESSAGE_REBRAND_2="Rebrand an ISO
+
+Any Graphic file will do. Rebrand.png, Rebrand.jpg or 
+Rebrand.gif The  name of  the  graphics  file is important 
+as the script takes Rebrand as the new title for the 
+LiveCD.
+
+We will use these commands:-
+morphix-rebrand ./MyMorph.iso ./tmp.iso Rebrand.jpg
+mv ./tmp.iso ./MyMorph.iso
+
+Now we shall select the base graphics file to be used for
+rebranding
+"
+MESSAGE_REBRAND_3="Select a Graphic for rebranding"
+###########################################################
+MESSAGE_QEMU="Testing an ISO using Qemu
+
+The next Morph is not really a Morph. It is used to test 
+other morphs. It is a common tool for Morphers to use.
+
+Qemu is a generic and open source processor emulator which
+achieves a good emulation speed by using dynamic 
+translation.
+
+In short: Boot you LiveCD inside your current operating
+system. A little slower but faster than burning a cd and 
+rebooting. Good for testing.
+"
+MESSAGE_QEMU_2="Testing an ISO using Qemu
+
+Do you want to use the local machine's network connection ? 
+(qemu -user-net) "
+###########################################################
+
 }
 
 
@@ -814,7 +858,7 @@
 		0)
 		  log_and_do_command_progress "sudo mmaker 
 		  /usr/share/morphing-morphix/morphing-morphix.xml 
-		  /tmp/morphing-morphix.mod"
+		  /tmp/$SETTING_MYMORPH_MAIN"
 		  log_and_do_command_progress "sudo isomorph --add main  
 		  /tmp/morphing-morphix.mod  
 		  $MNT_POINT/mmorphix/iso/$SETTING_MYMORPH /tmp/tmp.iso"
@@ -844,6 +888,40 @@
  if [ "$?" = "1" ]
  then
 	log_file "inside_mainmodule"
+	#MESSAGE_CHROOT_
+	xdialog_message "$MESSAGE_CHROOT"
+	xdialog_message "$MESSAGE_CHROOT_1"
+	SKIP=0
+	if [ -e "$MNT_POINT/mmorphix/morphing/bin" ]
+	then
+		xdialog_yes_no "$MESSAGE_CHROOT_2"
+		case $? in
+			0)
+			log_file "Skip extracting";
+			SKIP=1;;
+			1)
+			log_file "Do not skip extracting";;
+			255)
+			closing_mmorphix "morphing_main_module";;
+		esac
+	fi 
+	if [ "$SKIP" = "1" ]
+	then
+		log_and_do_not_do_command "sudo isomorph --get main   
+			$MNT_POINT/mmorphix/iso/$SETTING_MYMORPH 
+			$MNT_POINT/mmorphix/morphed/"
+		log_and_do_not_do_command "sudo module-extractor 
+			$MNT_POINT/mmorphix/morphed/$SETTING_MYMORPH_MAIN 
+			$MNT_POINT/mmorphix/morphing/"
+	else
+		log_and_do_command_progress "sudo isomorph --get main   
+			$MNT_POINT/mmorphix/iso/$SETTING_MYMORPH 
+			$MNT_POINT/mmorphix/morphed/"
+		log_and_do_command_progress "sudo module-extractor 
+			$MNT_POINT/mmorphix/morphed/$SETTING_MYMORPH_MAIN 
+			$MNT_POINT/mmorphix/morphing/"
+	fi
+	
  fi
  main_menu
 }
@@ -861,6 +939,14 @@
  if [ "$?" = "1" ]
  then
 	log_file "inside_mainmodule"
+	xdialog_message "$MESSAGE_REBRAND"
+	xdialog_message "$MESSAGE_REBRAND_2"
+	xdialog_file_select "$MESSAGE_REBRAND_3" "$MNT_POINT"
+	log_and_do_command_progress "sudo morphix-rebrand  
+		$MNT_POINT/mmorphix/iso/$SETTING_MYMORPH
+		/tmp/tmp.iso
+		$RETURN_VALUE"
+	log_and_do_command "mv -f /tmp/tmp.iso $MNT_POINT/mmorphix/iso/$SETTING_MYMORPH" 
  fi
  main_menu
 }
@@ -897,6 +983,18 @@
  if [ "$?" = "1" ]
  then
 	log_file "test_qemu"
+	xdialog_message "$MESSAGE_QEMU"
+	xdialog_yes_no "$MESSAGE_QEMU_2"
+	case $? in
+		0)
+		TMP_NET="-user-net";;
+		1)
+		TMP_NET="";;
+		255)
+		closing_mmorphix "morphing_test_qemu";;
+	esac
+	log_and_do_command "sudo qemu -boot d $TMP_NET 
+		-cdrom $MNT_POINT/mmorphix/iso/$SETTING_MYMORPH"
  fi
  main_menu
 }

Added: trunk/morph-scripts/morphix-chroot.sh
===================================================================
--- trunk/morph-scripts/morphix-chroot.sh	                        (rev 0)
+++ trunk/morph-scripts/morphix-chroot.sh	2006-08-15 21:26:43 UTC (rev 2384)
@@ -0,0 +1,106 @@
+#!/bin/bash
+#
+# morphix-chroot
+#
+# I knocked it up very quickly heck it may even work......
+#
+# Copyleft (c) 2006 Brendan M. Sleight                    #
+#              <bmsleight@barwap._REMOVE_SPAM_TRAP.com>   # 
+#                                                         #
+# This script is licensed under the GNU GPL v2 or later.  #
+#                                                         #
+# On Debian systems, this license can be obtained via     #
+# /usr/share/common-licenses/GPL                          #
+#
+
+get_global_variables ()
+{
+ TMP_DIR=/tmp/morphix-chroot.$$
+ TMP_FILE=/tmp/morphix-chroot.$$.tmp
+ mkdir -p $TMP_DIR
+ TMP=$(basename "${GRAPHIC}")
+}
+
+am_i_root_exit_if_not ()
+{
+if [ `id -u` -ne 0 ]; then
+ echo "Need to have be able to run the mount command, i.e. must be root"
+ exit
+fi
+}
+
+full_path ()
+{
+BASENAME=$(basename "${1}")
+DIRNAME=$(cd $(dirname "${1}") && pwd)
+FULL_PATH="${DIRNAME}/${BASENAME}"
+}
+
+cleanup ()
+{
+echo "Cleaning up ..."
+rm $TMP_DIR -R		2>/dev/null
+rm $TMP_FILE 		2>/dev/null
+}
+
+extract_mm ()
+{
+echo "Extracting the MainModule ..."
+module-extractor $MAINMODULE $TMP_DIR
+}
+
+prepare_chroot ()
+{
+echo "Preparing chroot ..."
+cp /etc/resolv.conf $TMP_DIR/etc/resolv.conf
+chroot $TMP_DIR/ mount -t proc /proc proc 
+
+}
+
+chroot_mm ()
+{
+clear
+echo "Entering root of MainModule filesystem. To exit type:-"
+echo "exit"
+chroot $TMP_DIR/ sh
+
+}
+
+unprepare_chroot ()
+{
+chroot $TMP_DIR/ umount -lf /proc 
+}
+
+build_mm ()
+{
+echo "Building the MainModule ..."
+module-builder $TMP_DIR $MAINMODULE 
+}
+
+
+#Main loop
+
+#Confirm parameters
+if [ -z "$1" ]; then
+    echo "Usage: $0 MainModule.mod"
+    echo
+    echo " This script extracts a MainModule, then drops you into the root of the file system "
+    echo " We can make any changes we need to the MainModule,  it is just like you are running the compressed file system, rather than the current filesystem. "
+    echo " Once finished we re-compresses the MainModule"
+    echo
+    echo " The MainModule must be on a partition that has been mounted with the option dev, (-o dev)"  
+    exit
+fi
+
+am_i_root_exit_if_not
+full_path $1
+MAINMODULE=$FULL_PATH
+
+get_global_variables
+extract_mm
+prepare_chroot
+chroot_mm
+unprepare_chroot
+build_mm
+
+cleanup


Property changes on: trunk/morph-scripts/morphix-chroot.sh
___________________________________________________________________
Name: svn:executable
   + *


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642