From 4f17415f31a3d37b97fbcd42623533e1548d7cf3 Mon Sep 17 00:00:00 2001
From: James Meyer <jams@linhes.org>
Date: Sun, 5 Dec 2010 00:49:02 +0000
Subject: larch8: fix pacman.conf.repos so that it's unique to each profile.

---
 build_tools/bin/sync_profiles.py                   |  2 +-
 .../linhes-local-disk-testing-i686/addedpacks      |  2 +-
 .../pacman.conf.repos                              |  8 +-
 .../rootoverlay/etc/rc.d/functions.d/larch-hooks   | 90 ++++++++++++++++++++++
 .../pacman.conf.repos                              |  4 +-
 .../linhes-local-mirror-testing-i686/addedpacks    |  2 +-
 .../pacman.conf.repos                              |  8 +-
 .../rootoverlay/etc/rc.d/functions.d/larch-hooks   | 90 ++++++++++++++++++++++
 .../linhes-remote-stable-i686/pacman.conf.repos    |  4 +-
 .../profiles/linhes-remote-testing-i686/addedpacks |  2 +-
 .../linhes-remote-testing-i686/pacman.conf.repos   |  4 +-
 .../rootoverlay/etc/rc.d/functions.d/larch-hooks   | 90 ++++++++++++++++++++++
 12 files changed, 288 insertions(+), 18 deletions(-)
 create mode 100644 build_tools/larch8/larch0/profiles/linhes-local-disk-testing-i686/rootoverlay/etc/rc.d/functions.d/larch-hooks
 create mode 100644 build_tools/larch8/larch0/profiles/linhes-local-mirror-testing-i686/rootoverlay/etc/rc.d/functions.d/larch-hooks
 create mode 100644 build_tools/larch8/larch0/profiles/linhes-remote-testing-i686/rootoverlay/etc/rc.d/functions.d/larch-hooks

diff --git a/build_tools/bin/sync_profiles.py b/build_tools/bin/sync_profiles.py
index 57f6410..6bc7d8f 100755
--- a/build_tools/bin/sync_profiles.py
+++ b/build_tools/bin/sync_profiles.py
@@ -41,7 +41,7 @@ srcprofile=profilelist[choice]
 for i in profilelist:
   if i == srcprofile:
     continue
-  cmd = 'rsync   --exclude splash.xpm.gz --exclude splash.xpm --exclude vbg.jpg --exclude=pacman.conf --delete -apv %s/%s/  %s/%s/' %(profiledir,srcprofile,profiledir,i)
+  cmd = 'rsync   --exclude pacman.conf.repos  --exclude splash.xpm.gz --exclude splash.xpm --exclude vbg.jpg --exclude=pacman.conf --delete -apv %s/%s/  %s/%s/' %(profiledir,srcprofile,profiledir,i)
   print cmd
   os.system(cmd)
 
diff --git a/build_tools/larch8/larch0/profiles/linhes-local-disk-testing-i686/addedpacks b/build_tools/larch8/larch0/profiles/linhes-local-disk-testing-i686/addedpacks
index 3972964..49986ae 100755
--- a/build_tools/larch8/larch0/profiles/linhes-local-disk-testing-i686/addedpacks
+++ b/build_tools/larch8/larch0/profiles/linhes-local-disk-testing-i686/addedpacks
@@ -53,7 +53,7 @@ unzip
 ttf-ms-fonts
 
 #xorg-video-drivers
-xf86-video-amd
+#xf86-video-amd
 xf86-video-apm
 xf86-video-ark
 xf86-video-ati
diff --git a/build_tools/larch8/larch0/profiles/linhes-local-disk-testing-i686/pacman.conf.repos b/build_tools/larch8/larch0/profiles/linhes-local-disk-testing-i686/pacman.conf.repos
index 0aa3c75..71a9aec 100755
--- a/build_tools/larch8/larch0/profiles/linhes-local-disk-testing-i686/pacman.conf.repos
+++ b/build_tools/larch8/larch0/profiles/linhes-local-disk-testing-i686/pacman.conf.repos
@@ -9,7 +9,7 @@
 #larch: 		Server = ftp://ftp.berlios.de/pub/larch/larch7.2/*platform*
 larch: 		Server = http://linhes.org/repo//larch/larch8/i686
 
-core-testing:       Server = http://localmirror/repo/i686/core-testing
-extra-testing:      Server = http://localmirror/repo/i686/extra-testing
-#core-testing:       Server = file:///data/pkg_repo/i686/core-testing
-#extra-testing:      Server = file:///data/pkg_repo/i686/extra-testing
+#core-testing:       Server = http://localmirror/repo/i686/core-testing
+#extra-testing:      Server = http://localmirror/repo/i686/extra-testing
+core-testing:       Server = file:///data/pkg_repo/i686/core-testing
+extra-testing:      Server = file:///data/pkg_repo/i686/extra-testing
diff --git a/build_tools/larch8/larch0/profiles/linhes-local-disk-testing-i686/rootoverlay/etc/rc.d/functions.d/larch-hooks b/build_tools/larch8/larch0/profiles/linhes-local-disk-testing-i686/rootoverlay/etc/rc.d/functions.d/larch-hooks
new file mode 100644
index 0000000..b43b5c5
--- /dev/null
+++ b/build_tools/larch8/larch0/profiles/linhes-local-disk-testing-i686/rootoverlay/etc/rc.d/functions.d/larch-hooks
@@ -0,0 +1,90 @@
+# larch handlers for rc. script hooks
+# 2010.10.14
+
+
+sysinit_premount_larch() {
+#    status "larch sysinit_premount hook"
+#    # Rebuild /etc/mtab
+#    grep "^aufs */ " /proc/mounts               >/etc/mtab.new
+#    grep "^tmpfs */.livesys " /proc/mounts      >>/etc/mtab.new
+#    if [ -d /.livesys/medium/larch ]; then
+#        grep " /.livesys/medium " /proc/mounts  >>/etc/mtab.new
+#    fi
+#    grep -v "^rootfs " /etc/mtab                >>/etc/mtab.new
+#    mv /etc/mtab.new /etc/mtab
+
+    # Add disk partitions to /etc/fstab
+    x10d_fstab
+}
+add_hook sysinit_premount sysinit_premount_larch
+
+
+sysinit_end_larch() {
+    # Allow setting up of xorg.conf before xorg is started
+    #status "larch sysinit_end hook"
+    [ -x /etc/X11/xinit/xorg.conf.set ] && /etc/X11/xinit/xorg.conf.set
+}
+add_hook sysinit_end sysinit_end_larch
+
+
+shutdown_postkillall_larch() {
+    #status "larch shutdown_postkillall hook"
+    if ! [ -f /.livesys/saveclock ]; then
+        # This will prevent the hardware clock from being set
+        HARDWARECLOCK='LIVE'
+    fi
+}
+add_hook shutdown_postkillall shutdown_postkillall_larch
+
+
+shutdown_poweroff_larch() {
+    #status "larch shutdown_poweroff hook"
+
+    # This shouldn't be needed, but better safe than sorry?
+    sync
+
+    # Eject CD/DVD
+    ############################# Deal with ejecting
+    # See if boot device still mounted and ejectable (CD/DVD)
+    bootdev=$( cat /.livesys/bootdevice )
+    if [ -f /proc/sys/dev/cdrom/info ]; then
+        cdroms=$( cat /proc/sys/dev/cdrom/info | { while read a b c; do
+                if [ "${a}" = "drive" -a "${b}" = "name:" ]; then
+                    echo "${c}"
+                    break
+                fi
+            done
+        } )
+        for d in ${cdroms}; do
+            if [ "/dev/${d}" = "${bootdev}" ]; then
+                # booted from CD/DVD
+                if grep "^${bootdev} " /proc/mounts &>/dev/null; then
+                    # it needs to be ejected
+                    doeject ${bootdev}
+                fi
+                break
+            fi
+        done
+    fi
+}
+add_hook shutdown_poweroff shutdown_poweroff_larch
+
+doeject ()
+{
+    echo "Ejecting live CD"
+    mount -n -o remount,rw /
+    # Remove the boot medium from /etc/mtab so that eject works
+    sed "/ \/.livesys\/medium / d" -i /etc/mtab
+    eject $1
+    mount -n -o remount,ro /
+#    echo "========================================"
+#    echo "It's safe to switch the computer off now"
+#    echo -ne "Press Enter to continue"
+#    read junk
+     for i in 10 9 8 7 6 5 4 3 2 1
+     do
+        sleep 1
+        printf "\r%02d" $i
+     done
+    eject -t $1
+}
diff --git a/build_tools/larch8/larch0/profiles/linhes-local-mirror-stable-i686/pacman.conf.repos b/build_tools/larch8/larch0/profiles/linhes-local-mirror-stable-i686/pacman.conf.repos
index 0aa3c75..3440bc9 100755
--- a/build_tools/larch8/larch0/profiles/linhes-local-mirror-stable-i686/pacman.conf.repos
+++ b/build_tools/larch8/larch0/profiles/linhes-local-mirror-stable-i686/pacman.conf.repos
@@ -9,7 +9,7 @@
 #larch: 		Server = ftp://ftp.berlios.de/pub/larch/larch7.2/*platform*
 larch: 		Server = http://linhes.org/repo//larch/larch8/i686
 
-core-testing:       Server = http://localmirror/repo/i686/core-testing
-extra-testing:      Server = http://localmirror/repo/i686/extra-testing
+core:       Server = http://localmirror/repo/i686/core
+extra:      Server = http://localmirror/repo/i686/extra
 #core-testing:       Server = file:///data/pkg_repo/i686/core-testing
 #extra-testing:      Server = file:///data/pkg_repo/i686/extra-testing
diff --git a/build_tools/larch8/larch0/profiles/linhes-local-mirror-testing-i686/addedpacks b/build_tools/larch8/larch0/profiles/linhes-local-mirror-testing-i686/addedpacks
index 3972964..49986ae 100755
--- a/build_tools/larch8/larch0/profiles/linhes-local-mirror-testing-i686/addedpacks
+++ b/build_tools/larch8/larch0/profiles/linhes-local-mirror-testing-i686/addedpacks
@@ -53,7 +53,7 @@ unzip
 ttf-ms-fonts
 
 #xorg-video-drivers
-xf86-video-amd
+#xf86-video-amd
 xf86-video-apm
 xf86-video-ark
 xf86-video-ati
diff --git a/build_tools/larch8/larch0/profiles/linhes-local-mirror-testing-i686/pacman.conf.repos b/build_tools/larch8/larch0/profiles/linhes-local-mirror-testing-i686/pacman.conf.repos
index 0aa3c75..71a9aec 100755
--- a/build_tools/larch8/larch0/profiles/linhes-local-mirror-testing-i686/pacman.conf.repos
+++ b/build_tools/larch8/larch0/profiles/linhes-local-mirror-testing-i686/pacman.conf.repos
@@ -9,7 +9,7 @@
 #larch: 		Server = ftp://ftp.berlios.de/pub/larch/larch7.2/*platform*
 larch: 		Server = http://linhes.org/repo//larch/larch8/i686
 
-core-testing:       Server = http://localmirror/repo/i686/core-testing
-extra-testing:      Server = http://localmirror/repo/i686/extra-testing
-#core-testing:       Server = file:///data/pkg_repo/i686/core-testing
-#extra-testing:      Server = file:///data/pkg_repo/i686/extra-testing
+#core-testing:       Server = http://localmirror/repo/i686/core-testing
+#extra-testing:      Server = http://localmirror/repo/i686/extra-testing
+core-testing:       Server = file:///data/pkg_repo/i686/core-testing
+extra-testing:      Server = file:///data/pkg_repo/i686/extra-testing
diff --git a/build_tools/larch8/larch0/profiles/linhes-local-mirror-testing-i686/rootoverlay/etc/rc.d/functions.d/larch-hooks b/build_tools/larch8/larch0/profiles/linhes-local-mirror-testing-i686/rootoverlay/etc/rc.d/functions.d/larch-hooks
new file mode 100644
index 0000000..b43b5c5
--- /dev/null
+++ b/build_tools/larch8/larch0/profiles/linhes-local-mirror-testing-i686/rootoverlay/etc/rc.d/functions.d/larch-hooks
@@ -0,0 +1,90 @@
+# larch handlers for rc. script hooks
+# 2010.10.14
+
+
+sysinit_premount_larch() {
+#    status "larch sysinit_premount hook"
+#    # Rebuild /etc/mtab
+#    grep "^aufs */ " /proc/mounts               >/etc/mtab.new
+#    grep "^tmpfs */.livesys " /proc/mounts      >>/etc/mtab.new
+#    if [ -d /.livesys/medium/larch ]; then
+#        grep " /.livesys/medium " /proc/mounts  >>/etc/mtab.new
+#    fi
+#    grep -v "^rootfs " /etc/mtab                >>/etc/mtab.new
+#    mv /etc/mtab.new /etc/mtab
+
+    # Add disk partitions to /etc/fstab
+    x10d_fstab
+}
+add_hook sysinit_premount sysinit_premount_larch
+
+
+sysinit_end_larch() {
+    # Allow setting up of xorg.conf before xorg is started
+    #status "larch sysinit_end hook"
+    [ -x /etc/X11/xinit/xorg.conf.set ] && /etc/X11/xinit/xorg.conf.set
+}
+add_hook sysinit_end sysinit_end_larch
+
+
+shutdown_postkillall_larch() {
+    #status "larch shutdown_postkillall hook"
+    if ! [ -f /.livesys/saveclock ]; then
+        # This will prevent the hardware clock from being set
+        HARDWARECLOCK='LIVE'
+    fi
+}
+add_hook shutdown_postkillall shutdown_postkillall_larch
+
+
+shutdown_poweroff_larch() {
+    #status "larch shutdown_poweroff hook"
+
+    # This shouldn't be needed, but better safe than sorry?
+    sync
+
+    # Eject CD/DVD
+    ############################# Deal with ejecting
+    # See if boot device still mounted and ejectable (CD/DVD)
+    bootdev=$( cat /.livesys/bootdevice )
+    if [ -f /proc/sys/dev/cdrom/info ]; then
+        cdroms=$( cat /proc/sys/dev/cdrom/info | { while read a b c; do
+                if [ "${a}" = "drive" -a "${b}" = "name:" ]; then
+                    echo "${c}"
+                    break
+                fi
+            done
+        } )
+        for d in ${cdroms}; do
+            if [ "/dev/${d}" = "${bootdev}" ]; then
+                # booted from CD/DVD
+                if grep "^${bootdev} " /proc/mounts &>/dev/null; then
+                    # it needs to be ejected
+                    doeject ${bootdev}
+                fi
+                break
+            fi
+        done
+    fi
+}
+add_hook shutdown_poweroff shutdown_poweroff_larch
+
+doeject ()
+{
+    echo "Ejecting live CD"
+    mount -n -o remount,rw /
+    # Remove the boot medium from /etc/mtab so that eject works
+    sed "/ \/.livesys\/medium / d" -i /etc/mtab
+    eject $1
+    mount -n -o remount,ro /
+#    echo "========================================"
+#    echo "It's safe to switch the computer off now"
+#    echo -ne "Press Enter to continue"
+#    read junk
+     for i in 10 9 8 7 6 5 4 3 2 1
+     do
+        sleep 1
+        printf "\r%02d" $i
+     done
+    eject -t $1
+}
diff --git a/build_tools/larch8/larch0/profiles/linhes-remote-stable-i686/pacman.conf.repos b/build_tools/larch8/larch0/profiles/linhes-remote-stable-i686/pacman.conf.repos
index 0aa3c75..9003451 100755
--- a/build_tools/larch8/larch0/profiles/linhes-remote-stable-i686/pacman.conf.repos
+++ b/build_tools/larch8/larch0/profiles/linhes-remote-stable-i686/pacman.conf.repos
@@ -9,7 +9,7 @@
 #larch: 		Server = ftp://ftp.berlios.de/pub/larch/larch7.2/*platform*
 larch: 		Server = http://linhes.org/repo//larch/larch8/i686
 
-core-testing:       Server = http://localmirror/repo/i686/core-testing
-extra-testing:      Server = http://localmirror/repo/i686/extra-testing
+core:       Server = http://linhes.org/repo/i686/core
+extra:      Server = http://linhes.org/repo/i686/extra
 #core-testing:       Server = file:///data/pkg_repo/i686/core-testing
 #extra-testing:      Server = file:///data/pkg_repo/i686/extra-testing
diff --git a/build_tools/larch8/larch0/profiles/linhes-remote-testing-i686/addedpacks b/build_tools/larch8/larch0/profiles/linhes-remote-testing-i686/addedpacks
index 3972964..49986ae 100755
--- a/build_tools/larch8/larch0/profiles/linhes-remote-testing-i686/addedpacks
+++ b/build_tools/larch8/larch0/profiles/linhes-remote-testing-i686/addedpacks
@@ -53,7 +53,7 @@ unzip
 ttf-ms-fonts
 
 #xorg-video-drivers
-xf86-video-amd
+#xf86-video-amd
 xf86-video-apm
 xf86-video-ark
 xf86-video-ati
diff --git a/build_tools/larch8/larch0/profiles/linhes-remote-testing-i686/pacman.conf.repos b/build_tools/larch8/larch0/profiles/linhes-remote-testing-i686/pacman.conf.repos
index 0aa3c75..af78276 100755
--- a/build_tools/larch8/larch0/profiles/linhes-remote-testing-i686/pacman.conf.repos
+++ b/build_tools/larch8/larch0/profiles/linhes-remote-testing-i686/pacman.conf.repos
@@ -9,7 +9,7 @@
 #larch: 		Server = ftp://ftp.berlios.de/pub/larch/larch7.2/*platform*
 larch: 		Server = http://linhes.org/repo//larch/larch8/i686
 
-core-testing:       Server = http://localmirror/repo/i686/core-testing
-extra-testing:      Server = http://localmirror/repo/i686/extra-testing
+core-testing:       Server = http://linhes.org/repo/i686/core-testing
+extra-testing:      Server = http://linhes.org/repo/i686/extra-testing
 #core-testing:       Server = file:///data/pkg_repo/i686/core-testing
 #extra-testing:      Server = file:///data/pkg_repo/i686/extra-testing
diff --git a/build_tools/larch8/larch0/profiles/linhes-remote-testing-i686/rootoverlay/etc/rc.d/functions.d/larch-hooks b/build_tools/larch8/larch0/profiles/linhes-remote-testing-i686/rootoverlay/etc/rc.d/functions.d/larch-hooks
new file mode 100644
index 0000000..b43b5c5
--- /dev/null
+++ b/build_tools/larch8/larch0/profiles/linhes-remote-testing-i686/rootoverlay/etc/rc.d/functions.d/larch-hooks
@@ -0,0 +1,90 @@
+# larch handlers for rc. script hooks
+# 2010.10.14
+
+
+sysinit_premount_larch() {
+#    status "larch sysinit_premount hook"
+#    # Rebuild /etc/mtab
+#    grep "^aufs */ " /proc/mounts               >/etc/mtab.new
+#    grep "^tmpfs */.livesys " /proc/mounts      >>/etc/mtab.new
+#    if [ -d /.livesys/medium/larch ]; then
+#        grep " /.livesys/medium " /proc/mounts  >>/etc/mtab.new
+#    fi
+#    grep -v "^rootfs " /etc/mtab                >>/etc/mtab.new
+#    mv /etc/mtab.new /etc/mtab
+
+    # Add disk partitions to /etc/fstab
+    x10d_fstab
+}
+add_hook sysinit_premount sysinit_premount_larch
+
+
+sysinit_end_larch() {
+    # Allow setting up of xorg.conf before xorg is started
+    #status "larch sysinit_end hook"
+    [ -x /etc/X11/xinit/xorg.conf.set ] && /etc/X11/xinit/xorg.conf.set
+}
+add_hook sysinit_end sysinit_end_larch
+
+
+shutdown_postkillall_larch() {
+    #status "larch shutdown_postkillall hook"
+    if ! [ -f /.livesys/saveclock ]; then
+        # This will prevent the hardware clock from being set
+        HARDWARECLOCK='LIVE'
+    fi
+}
+add_hook shutdown_postkillall shutdown_postkillall_larch
+
+
+shutdown_poweroff_larch() {
+    #status "larch shutdown_poweroff hook"
+
+    # This shouldn't be needed, but better safe than sorry?
+    sync
+
+    # Eject CD/DVD
+    ############################# Deal with ejecting
+    # See if boot device still mounted and ejectable (CD/DVD)
+    bootdev=$( cat /.livesys/bootdevice )
+    if [ -f /proc/sys/dev/cdrom/info ]; then
+        cdroms=$( cat /proc/sys/dev/cdrom/info | { while read a b c; do
+                if [ "${a}" = "drive" -a "${b}" = "name:" ]; then
+                    echo "${c}"
+                    break
+                fi
+            done
+        } )
+        for d in ${cdroms}; do
+            if [ "/dev/${d}" = "${bootdev}" ]; then
+                # booted from CD/DVD
+                if grep "^${bootdev} " /proc/mounts &>/dev/null; then
+                    # it needs to be ejected
+                    doeject ${bootdev}
+                fi
+                break
+            fi
+        done
+    fi
+}
+add_hook shutdown_poweroff shutdown_poweroff_larch
+
+doeject ()
+{
+    echo "Ejecting live CD"
+    mount -n -o remount,rw /
+    # Remove the boot medium from /etc/mtab so that eject works
+    sed "/ \/.livesys\/medium / d" -i /etc/mtab
+    eject $1
+    mount -n -o remount,ro /
+#    echo "========================================"
+#    echo "It's safe to switch the computer off now"
+#    echo -ne "Press Enter to continue"
+#    read junk
+     for i in 10 9 8 7 6 5 4 3 2 1
+     do
+        sleep 1
+        printf "\r%02d" $i
+     done
+    eject -t $1
+}
-- 
cgit v0.12