source: scripts/chroot.bash @ 2797

Revision 2797, 1.3 KB checked in by alanbach-guest, 6 years ago (diff)
  • Updated compile-iso.bash
  • Added chroot.bash, chroot helper script
  • Added start-qemu.bash, to start qemu for iso testing
  • Property svn:executable set to *
Line 
1#!/bin/bash
2# Bash script to chroot into Parsix roots
3# Coyright 2005-2008 Alan Baghumian / GNU/GPL
4
5usage()
6{
7  echo "Usage: chroot <32|64>"
8  exit
9}
10
11if [ -z "${1}" ]; then
12   usage
13fi
14
15if [ "${1}" != "32" -a "${1}" != "64" ]; then
16    echo "Invalid arch. Usage: chroot <32|64>"
17    exit
18fi
19
20# mount needed file systems
21mount -o bind /proc source${1}/PARSIX/proc
22mount -o bind /dev/pts source${1}/PARSIX/dev/pts
23
24chroot source${1}/PARSIX/
25
26# clean-up
27to_purge=`chroot source${1}/PARSIX dpkg -l | grep ^rc | awk '{print $2}'`
28is_orphan=`chroot source${1}/PARSIX deborphan`
29
30if [ ! -z "${to_purge}" ]; then
31    chroot source${1}/PARSIX echo "${to_purge}" | xargs dpkg -P
32fi
33
34if [ ! -z "${is_orphan}" ]; then
35    chroot source${1}/PARSIX echo "${is_orphan}" | xargs dpkg -P
36fi
37
38# reset logs
39rm source${1}/PARSIX/var/log/dpkg.log &>/dev/null
40rm source${1}/PARSIX/var/log/scrollkeeper.log &>/dev/null
41
42touch source${1}/PARSIX/var/log/dpkg.log &>/dev/null
43touch source${1}/PARSIX/var/log/scrollkeeper.log &>/dev/null
44
45chroot source${1}/PARSIX chmod 640 /var/log/dpkg.log
46chroot source${1}/PARSIX chown root:adm /var/log/dpkg.log
47
48chroot source${1}/PARSIX chmod 644 /var/log/scrollkeeper.log
49chroot source${1}/PARSIX chown root:root /var/log/scrollkeeper.log
50
51# unmount needed file systems
52umount -f source${1}/PARSIX/proc
53umount -f source${1}/PARSIX/dev/pts
54
Note: See TracBrowser for help on using the repository browser.