source: src-sh/warden/linux-installs/debian-6-squeeze @ 70427a2

9.2-releasereleng/10.0releng/10.0.1releng/10.0.2releng/10.0.3releng/10.1
Last change on this file since 70427a2 was 70427a2, checked in by Kris Moore <kris@…>, 17 months ago

Update the linux install scripts from here:

https://github.com/freenas/freenas/commit/0e003b142cb3e1d54262f6d175e74231b4429045

  • Property mode set to 100755
File size: 1.6 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
31    umount -f ${TDIR}/dev/fd >/dev/null 2>/dev/null
32    umount -f ${TDIR}/dev >/dev/null 2>/dev/null
33    umount -f ${TDIR}/sys >/dev/null 2>/dev/null
34    umount -f ${TDIR}/proc >/dev/null 2>/dev/null
35
36    # Fix log file
37    sed -i '' 's|/dev/xconsole|/var/log/xconsole|g' ${TDIR}/etc/rsyslog.conf
38
39    # Get rid of umount
40    mv ${TDIR}/sbin/umount ${TDIR}/sbin/umount.prev
41    ln -s /bin/true ${TDIR}/sbin/umount
42}
43
44jail_configure()
45{
46    rm -f "${ERRORFILE}"
47
48    local JMETADIR="${1}"
49    if [ -z "${JMETADIR}" ] ; then
50      echo "JMETADIR is not defined"
51      exit 1
52    fi
53
54    # Setup some custom start / stop stuff
55    echo "/etc/init.d/rc 3" > ${JMETADIR}/jail-start
56    echo "/etc/init.d/rc 0" > ${JMETADIR}/jail-stop
57}
58
59error()
60{
61    if [ -f "${ERRORFILE}" ] ; then
62        rm -f "${ERRORFILE}"
63        return 1
64    fi
65
66    return 0
67}
68
69main()
70{
71    case "${1}" in
72      get_distfiles) shift; get_distfiles "$@" ;;
73      template_install) shift; template_install "$@" ;;
74      jail_configure) shift; jail_configure "$@" ;;
75      error) shift; error "$@" ;;
76    esac
77
78    if [ "$?" != "0" ] ; then
79      touch "${ERRORFILE}"
80    fi
81}
82
83
84main "$@"
Note: See TracBrowser for help on using the repository browser.