Add comments
This commit is contained in:
parent
cbaa419872
commit
15cc712253
1 changed files with 20 additions and 0 deletions
20
build.sh
20
build.sh
|
@ -122,6 +122,9 @@ unmount_image() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
##
|
||||||
|
# Prepare environment.
|
||||||
|
#
|
||||||
if [ "$(id -u)" != '0' ]; then
|
if [ "$(id -u)" != '0' ]; then
|
||||||
echo 'Please run as root' 1>&2
|
echo 'Please run as root' 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -134,6 +137,9 @@ mkdir -p "$MOUNT_DIR"
|
||||||
|
|
||||||
cd "$BASE_DIR"
|
cd "$BASE_DIR"
|
||||||
|
|
||||||
|
##
|
||||||
|
# Bootstrap a basic Debian system.
|
||||||
|
#
|
||||||
if [ ! -d "$ROOTFS_DIR" ]; then
|
if [ ! -d "$ROOTFS_DIR" ]; then
|
||||||
ARCH="$(dpkg --print-architecture)"
|
ARCH="$(dpkg --print-architecture)"
|
||||||
|
|
||||||
|
@ -152,17 +158,28 @@ if [ ! -d "$ROOTFS_DIR" ]; then
|
||||||
http://mirrordirector.raspbian.org/raspbian/" || rmdir "$ROOTFS_DIR/debootstrap"
|
http://mirrordirector.raspbian.org/raspbian/" || rmdir "$ROOTFS_DIR/debootstrap"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
##
|
||||||
|
# Mount virtual file systems.
|
||||||
|
#
|
||||||
unmount "$ROOTFS_DIR"
|
unmount "$ROOTFS_DIR"
|
||||||
mount --bind /dev "$ROOTFS_DIR/dev"
|
mount --bind /dev "$ROOTFS_DIR/dev"
|
||||||
mount --bind /dev/pts "$ROOTFS_DIR/dev/pts"
|
mount --bind /dev/pts "$ROOTFS_DIR/dev/pts"
|
||||||
mount -t proc /proc "$ROOTFS_DIR/proc"
|
mount -t proc /proc "$ROOTFS_DIR/proc"
|
||||||
mount --bind /sys "$ROOTFS_DIR/sys"
|
mount --bind /sys "$ROOTFS_DIR/sys"
|
||||||
|
|
||||||
|
##
|
||||||
# Prevent services to start after package installation in chroot environment.
|
# Prevent services to start after package installation in chroot environment.
|
||||||
|
#
|
||||||
install -m 744 files/policy-rc.d "$ROOTFS_DIR/usr/sbin/policy-rc.d"
|
install -m 744 files/policy-rc.d "$ROOTFS_DIR/usr/sbin/policy-rc.d"
|
||||||
|
|
||||||
|
##
|
||||||
|
# This script is executed at the end of each multiuser runlevel.
|
||||||
|
#
|
||||||
install -m 755 files/rc.local "$ROOTFS_DIR/etc/rc.local"
|
install -m 755 files/rc.local "$ROOTFS_DIR/etc/rc.local"
|
||||||
|
|
||||||
|
##
|
||||||
|
# Prepare package manager.
|
||||||
|
#
|
||||||
install -m 644 files/sources.list "$ROOTFS_DIR/etc/apt/"
|
install -m 644 files/sources.list "$ROOTFS_DIR/etc/apt/"
|
||||||
install -m 644 files/raspi.list "$ROOTFS_DIR/etc/apt/sources.list.d/"
|
install -m 644 files/raspi.list "$ROOTFS_DIR/etc/apt/sources.list.d/"
|
||||||
|
|
||||||
|
@ -173,6 +190,9 @@ apt-get update
|
||||||
apt-get dist-upgrade -y
|
apt-get dist-upgrade -y
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
##
|
||||||
|
# Common system configuration.
|
||||||
|
#
|
||||||
chroot_rootfs << EOF
|
chroot_rootfs << EOF
|
||||||
debconf-set-selections <<SELEOF
|
debconf-set-selections <<SELEOF
|
||||||
locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8
|
locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8
|
||||||
|
|
Reference in a new issue