source: src-sh/warden/linux-installs/debian-6-squeeze @ 5ae7c8e

releng/10.0.1releng/10.0.2
Last change on this file since 5ae7c8e was 5ae7c8e, checked in by Kris Moore <kris@…>, 6 months ago

Fix bugs creating linux jails debian and gentoo via the Warden

This was a result of a merge with some FreeNAS changes which didn't apply to
our version of Warden

  • Property mode set to 100755
File size: 1.5 KB
Line 
1#!/bin/sh
2# Script to install debian 6 "squeeze" release into a jail
3# Author: Kris Moore <kris@pcbsd.org>
4
5SELF="debian-6-squeeze"
6SELFDIR="${JDIR}/.${SELF}"
7ERRORFILE="/tmp/.${SELF}.error"
8
9get_distfiles()
10{
11    rm -f "${ERRORFILE}"
12
13    if [ ! -d "${SELFDIR}" ] ; then
14      mkdir -p "${SELFDIR}"
15    fi
16}
17
18template_install()
19{
20    rm -f "${ERRORFILE}"
21
22    local TDIR="${1}"
23    if [ -z "${TDIR}" ] ; then
24      echo "TDIR is not defined"
25      touch "${ERRORFILE}"     
26      exit 1
27    fi
28
29    debootstrap squeeze ${TDIR}
30    if [ $? -ne 0 ] ; then
31      exit 1
32    fi
33
34    umount -f ${TDIR}/dev/fd >/dev/null 2>/dev/null
35    umount -f ${TDIR}/dev >/dev/null 2>/dev/null
36    umount -f ${TDIR}/sys >/dev/null 2>/dev/null
37    umount -f ${TDIR}/proc >/dev/null 2>/dev/null
38
39    # Fix log file
40    sed -i '' 's|/dev/xconsole|/var/log/xconsole|g' ${TDIR}/etc/rsyslog.conf
41
42    # Get rid of umount
43    mv ${TDIR}/sbin/umount ${TDIR}/sbin/umount.prev
44    ln -s /bin/true ${TDIR}/sbin/umount
45}
46
47jail_configure()
48{
49    rm -f "${ERRORFILE}"
50
51    local JMETADIR="${1}"
52    if [ -z "${JMETADIR}" ] ; then
53      echo "JMETADIR is not defined"
54      exit 1
55    fi
56
57    # Setup some custom start / stop stuff
58    echo "/etc/init.d/rc 3" > ${JMETADIR}/jail-start
59    echo "/etc/init.d/rc 0" > ${JMETADIR}/jail-stop
60}
61
62error()
63{
64    if [ -f "${ERRORFILE}" ] ; then
65        rm -f "${ERRORFILE}"
66        return 1
67    fi
68
69    return 0
70}
71
72main()
73{
74
75    template_install "$1"
76
77    jail_configure "$3"
78
79    exit 0
80}
81
82
83# Arg1 = Directory # Arg2 = IP # Arg3 = Meta File
84main "$@"
Note: See TracBrowser for help on using the repository browser.