Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- #Assumes installation to /path/to/chroot
- chroot_location=/path/to/chroot
- # set -e #Commenting this out for now as mount returns non-zero
- #due to a remount of /sys
- set -x
- if [ "$1" = "configure" ];
- then
- lenny_chroot_suffix=.lenny_chroot.old
- #Setup schroot.conf
- new_schroot_conf_file=/tmp/schroot.conf
- cat <<SCHROOT > $new_schroot_conf_file
- [lenny]
- description=Debian lenny for amd64
- aliases=debian_lenny_amd64
- location=$chroot_location
- root-users=root
- type=plain
- users=root
- groups=root
- SCHROOT
- schroot_conf_file=/etc/schroot/schroot.conf
- archived_schroot_conf_file="${schroot_conf_file}${lenny_chroot_suffix}"
- #Put entries in place
- if [ -f $schroot_conf_file ];
- then
- #Old conf file exists, copy to archived
- cp $schroot_conf_file $archived_schroot_conf_file
- #Append additions
- cat $archived_schroot_conf_file $new_schroot_conf_file > $schroot_conf_file
- else
- #No old file, copy over conf file
- cp $new_schroot_conf_file $schroot_conf_file
- fi
- rm -f $new_schroot_conf_file
- #Setup fstab
- fstab_additions_file=/tmp/fstab_entries
- cat <<FSTAB > $fstab_additions_file
- # fstab: static file system information for chroots.
- #
- # <file system> <mount point> <type> <options> <dump> <pass>
- /proc $chroot_location/proc none rw,bind 0 0
- /sys $chroot_location/sys none rw,bind 0 0
- /tmp $chroot_location/host/tmp none rw,bind 0 0
- /dev/pts $chroot_location/dev/pts none rw,bind 0 0
- tmpfs $chroot_location/dev/shm tmpfs defaults 0 0
- /usr/local/akamai $chroot_location/usr/local/akamai ext2 rw,bind 0 0
- /usr/local/akamai/logs $chroot_location/usr/local/akamai/logs ext2 rw,bind 0 0
- /usr/local/akamai/coredumps $chroot_location/usr/local/akamai/coredumps ext2 rw,bind 0 0
- FSTAB
- fstab_file=/etc/fstab
- archived_fstab_file="/etc/fstab${lenny_chroot_suffix}"
- #Append to fstab
- mv $fstab_file $archived_fstab_file
- cat $archived_fstab_file $fstab_additions_file > $fstab_file
- rm -f $fstab_additions_file
- #Assumes dpkg install as 'root'
- mount -a #Complains about re-mount of /sys
- exit 0
- fi
Advertisement
Add Comment
Please, Sign In to add comment