hello i have a doubt about chroot scripts. what are them for? are them chroot executed in the target filesystem mounted under /var/adm or whatever? could someone post any interesting or useful application case? thanks in advance. Pablo Gomez
Hello Pablo, You wrote:
hello
i have a doubt about chroot scripts. what are them for? are them chroot executed in the target filesystem mounted under /var/adm or whatever?
could someone post any interesting or useful application case? I use chroot-/postinstall-scripts to cleanup installed machines.
chroot-script: <chroot-scripts config:type="list"> <script> <filename>cleanup-setup.sh</filename> <interpreter>shell</interpreter> <source><![CDATA[#!/bin/sh installserver=$(mount | grep "/var/adm/mount" | head -1 | cut -f1 -d:) echo "$installserver" >"/var/adm/autoinstall/files/installserver" ]]></source> </script> </chroot-scripts> postinstall-script: <post-scripts config:type="list" > <script> <filename>cleanup.sh</filename> <interpreter>shell</interpreter> <source><![CDATA[#!/bin/sh installserver=$([ -r "/var/adm/autoinstall/files/installserver" ] \ && cat "/var/adm/autoinstall/files/installserver" | grep -v '^#' | head -1) do_cleanup() { mkdir -p "/tmp/logs" mount -o rw "${installserver}:/exports/logs" "/tmp/logs" if [ $? -ne 0 ] ; then echo 1>&2 "unable to mount log-target" exit 1 fi mkdir -p "/tmp/logs/$(hostname)" ( cd "/var/adm" tar -zcpf "/tmp/logs/$(hostname)/`date +\"%Y%m%d-%H%M\"`.tar.gz" "autoinstall" ) umount "/tmp/logs" rm -rf "/var/adm/autoinstall" } do_cleanup reboot ]]></source> </script> </post-scripts> chroot-scripts are executed before first reboot (install-server is mounted). post-scripts are executed after reboot. I force a reboot in postinstall to bring up the installed machine w/ all configurations in place and all activated services running. Ciao, Carsten
participants (2)
-
Carsten Dumke
-
Pablo Gomez