summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorRoger Leigh <rleigh@debian.org>2013-01-04 23:02:26 +0000
committerRoger Leigh <rleigh@debian.org>2013-01-05 00:06:39 +0000
commita98b7ebd60032800901163fac9228721868157f8 (patch)
tree4c63c701a5ed6e1da0cd1bce130bdaa606dd2d8c /etc
parent883f5504e19302a51d474a94efebc3bb7f824ac4 (diff)
downloadschroot-a98b7ebd60032800901163fac9228721868157f8.tar.gz
Replace tabs with spaces in all source code
Diffstat (limited to 'etc')
-rw-r--r--etc/bash_completion/schroot4
-rwxr-xr-xetc/genprofile14
-rw-r--r--etc/profile-templates/all/all/fstab2
-rw-r--r--etc/profile-templates/all/freebsd/fstab2
-rw-r--r--etc/profile-templates/all/linux/fstab4
-rw-r--r--etc/profile-templates/buildd/freebsd/fstab6
-rw-r--r--etc/profile-templates/buildd/linux/fstab6
-rw-r--r--etc/profile-templates/default/freebsd/fstab12
-rw-r--r--etc/profile-templates/default/linux/fstab14
-rw-r--r--etc/profile-templates/desktop/freebsd/fstab14
-rw-r--r--etc/profile-templates/desktop/linux/fstab18
-rw-r--r--etc/profile-templates/sbuild/freebsd/fstab6
-rw-r--r--etc/profile-templates/sbuild/linux/fstab6
-rwxr-xr-xetc/setup.d/05btrfs52
-rwxr-xr-xetc/setup.d/05file82
-rwxr-xr-xetc/setup.d/05lvm48
-rwxr-xr-xetc/setup.d/05union48
-rwxr-xr-xetc/setup.d/10mount266
-rw-r--r--etc/setup.d/15binfmt8
-rwxr-xr-xetc/setup.d/15killprocs40
-rwxr-xr-xetc/setup.d/20copyfiles88
-rwxr-xr-xetc/setup.d/20nssdatabases40
-rwxr-xr-xetc/setup.d/60unshare4
-rwxr-xr-xetc/setup.d/70services4
-rw-r--r--etc/setup.d/common-config4
-rw-r--r--etc/setup.d/common-data8
-rw-r--r--etc/setup.d/common-functions2
27 files changed, 401 insertions, 401 deletions
diff --git a/etc/bash_completion/schroot b/etc/bash_completion/schroot
index 035f0b39..7e948f6c 100644
--- a/etc/bash_completion/schroot
+++ b/etc/bash_completion/schroot
@@ -28,9 +28,9 @@ _schroot()
options=$(schroot --help | sed 's/\(^\|[[:space:]]\)[^[:space:]-][^[:space:]]*//g')
if [ "$prev" = "-c" ] || [ "$prev" = "--chroot" ]; then
- COMPREPLY=( $(compgen -W "$(schroot -a -l)" -- $cur) )
+ COMPREPLY=( $(compgen -W "$(schroot -a -l)" -- $cur) )
else
- COMPREPLY=( $(compgen -W "$options" -- $cur) )
+ COMPREPLY=( $(compgen -W "$options" -- $cur) )
fi
return 0
}
diff --git a/etc/genprofile b/etc/genprofile
index 438e65cd..f6dff029 100755
--- a/etc/genprofile
+++ b/etc/genprofile
@@ -32,13 +32,13 @@ mkdir "$DESTDIR"
for file in copyfiles fstab nssdatabases; do
for profile in all "$PROFILE"; do
- for arch in all "$PLATFORM"; do
- FILE="${SRCDIR}/${profile}/${arch}/${file}"
- if [ -f "$FILE" ]; then
- echo "Including $FILE"
- cat $FILE >> "${DESTDIR}/${file}"
- fi
- done
+ for arch in all "$PLATFORM"; do
+ FILE="${SRCDIR}/${profile}/${arch}/${file}"
+ if [ -f "$FILE" ]; then
+ echo "Including $FILE"
+ cat $FILE >> "${DESTDIR}/${file}"
+ fi
+ done
done
echo "Wrote ${DESTDIR}/${file}"
done
diff --git a/etc/profile-templates/all/all/fstab b/etc/profile-templates/all/all/fstab
index fa974aa8..55a9f9a0 100644
--- a/etc/profile-templates/all/all/fstab
+++ b/etc/profile-templates/all/all/fstab
@@ -2,4 +2,4 @@
# Note that the mount point will be prefixed by the chroot path
# (CHROOT_PATH)
#
-# <file system> <mount point> <type> <options> <dump> <pass>
+# <file system> <mount point> <type> <options> <dump> <pass>
diff --git a/etc/profile-templates/all/freebsd/fstab b/etc/profile-templates/all/freebsd/fstab
index 7d3f803d..d1283f40 100644
--- a/etc/profile-templates/all/freebsd/fstab
+++ b/etc/profile-templates/all/freebsd/fstab
@@ -1 +1 @@
-proc /proc linprocfs defaults 0 0
+proc /proc linprocfs defaults 0 0
diff --git a/etc/profile-templates/all/linux/fstab b/etc/profile-templates/all/linux/fstab
index e40e8817..d2684ef6 100644
--- a/etc/profile-templates/all/linux/fstab
+++ b/etc/profile-templates/all/linux/fstab
@@ -1,2 +1,2 @@
-/proc /proc none rw,bind 0 0
-/sys /sys none rw,bind 0 0
+/proc /proc none rw,bind 0 0
+/sys /sys none rw,bind 0 0
diff --git a/etc/profile-templates/buildd/freebsd/fstab b/etc/profile-templates/buildd/freebsd/fstab
index 164925d1..3aa8403c 100644
--- a/etc/profile-templates/buildd/freebsd/fstab
+++ b/etc/profile-templates/buildd/freebsd/fstab
@@ -1,3 +1,3 @@
-dev /dev devfs rw,bind 0 0
-dev /dev/fd fdescfs rw,bind 0 0
-/home/buildd/build-trees /build nullfs rw 0 0
+dev /dev devfs rw,bind 0 0
+dev /dev/fd fdescfs rw,bind 0 0
+/home/buildd/build-trees /build nullfs rw 0 0
diff --git a/etc/profile-templates/buildd/linux/fstab b/etc/profile-templates/buildd/linux/fstab
index ce334648..26efe88b 100644
--- a/etc/profile-templates/buildd/linux/fstab
+++ b/etc/profile-templates/buildd/linux/fstab
@@ -1,5 +1,5 @@
-/dev/pts /dev/pts none rw,bind 0 0
-tmpfs /dev/shm tmpfs defaults 0 0
+/dev/pts /dev/pts none rw,bind 0 0
+tmpfs /dev/shm tmpfs defaults 0 0
# Mount a large scratch space for the build, so we don't use up
# space on an LVM snapshot of the chroot itself.
-/var/lib/sbuild/build /build none rw,bind 0 0
+/var/lib/sbuild/build /build none rw,bind 0 0
diff --git a/etc/profile-templates/default/freebsd/fstab b/etc/profile-templates/default/freebsd/fstab
index 5f372f3a..7d37f7cc 100644
--- a/etc/profile-templates/default/freebsd/fstab
+++ b/etc/profile-templates/default/freebsd/fstab
@@ -1,11 +1,11 @@
-dev /dev devfs rw,bind 0 0
-dev /dev/fd fdescfs rw,bind 0 0
-/home /home nullfs rw 0 0
-/tmp /tmp nullfs rw 0 0
+dev /dev devfs rw,bind 0 0
+dev /dev/fd fdescfs rw,bind 0 0
+/home /home nullfs rw 0 0
+/tmp /tmp nullfs rw 0 0
# It may be desirable to have access to /run, especially if you wish
# to run additional services in the chroot. However, note that this
# may potentially cause undesirable behaviour on upgrades, such as
# killing services on the host.
-#/run /run nullfs rw 0 0
-#/run/lock /run/lock nullfs rw 0 0
+#/run /run nullfs rw 0 0
+#/run/lock /run/lock nullfs rw 0 0
diff --git a/etc/profile-templates/default/linux/fstab b/etc/profile-templates/default/linux/fstab
index e77dd4c3..777f0ed8 100644
--- a/etc/profile-templates/default/linux/fstab
+++ b/etc/profile-templates/default/linux/fstab
@@ -1,13 +1,13 @@
/dev /dev none rw,bind 0 0
-/dev/pts /dev/pts none rw,bind 0 0
-/home /home none rw,bind 0 0
-/tmp /tmp none rw,bind 0 0
+/dev/pts /dev/pts none rw,bind 0 0
+/home /home none rw,bind 0 0
+/tmp /tmp none rw,bind 0 0
# It may be desirable to have access to /run, especially if you wish
# to run additional services in the chroot. However, note that this
# may potentially cause undesirable behaviour on upgrades, such as
# killing services on the host.
-#/run /run none rw,bind 0 0
-#/run/lock /run/lock none rw,bind 0 0
-#/dev/shm /dev/shm none rw,bind 0 0
-#/run/shm /run/shm none rw,bind 0 0
+#/run /run none rw,bind 0 0
+#/run/lock /run/lock none rw,bind 0 0
+#/dev/shm /dev/shm none rw,bind 0 0
+#/run/shm /run/shm none rw,bind 0 0
diff --git a/etc/profile-templates/desktop/freebsd/fstab b/etc/profile-templates/desktop/freebsd/fstab
index 3af03cf5..6272537b 100644
--- a/etc/profile-templates/desktop/freebsd/fstab
+++ b/etc/profile-templates/desktop/freebsd/fstab
@@ -1,14 +1,14 @@
-dev /dev devfs rw,bind 0 0
-dev /dev/fd fdescfs rw,bind 0 0
-/home /home nullfs rw 0 0
-/tmp /tmp nullfs rw 0 0
+dev /dev devfs rw,bind 0 0
+dev /dev/fd fdescfs rw,bind 0 0
+/home /home nullfs rw 0 0
+/tmp /tmp nullfs rw 0 0
# For PulseAudio and other desktop-related things
-/var/lib/dbus /var/lib/dbus none rw,bind 0 0
+/var/lib/dbus /var/lib/dbus none rw,bind 0 0
# It may be desirable to have access to /run, especially if you wish
# to run additional services in the chroot. However, note that this
# may potentially cause undesirable behaviour on upgrades, such as
# killing services on the host.
-#/run /run nullfs rw 0 0
-#/run/lock /run/lock nullfs rw 0 0
+#/run /run nullfs rw 0 0
+#/run/lock /run/lock nullfs rw 0 0
diff --git a/etc/profile-templates/desktop/linux/fstab b/etc/profile-templates/desktop/linux/fstab
index be8a3afb..7f61d8d4 100644
--- a/etc/profile-templates/desktop/linux/fstab
+++ b/etc/profile-templates/desktop/linux/fstab
@@ -1,18 +1,18 @@
/dev /dev none rw,bind 0 0
-/dev/pts /dev/pts none rw,bind 0 0
-/home /home none rw,bind 0 0
-/tmp /tmp none rw,bind 0 0
+/dev/pts /dev/pts none rw,bind 0 0
+/home /home none rw,bind 0 0
+/tmp /tmp none rw,bind 0 0
# If you use gdm3, uncomment this line to allow Xauth to work
-#/var/run/gdm3 /var/run/gdm3 none rw,bind 0 0
+#/var/run/gdm3 /var/run/gdm3 none rw,bind 0 0
# For PulseAudio and other desktop-related things
-/var/lib/dbus /var/lib/dbus none rw,bind 0 0
+/var/lib/dbus /var/lib/dbus none rw,bind 0 0
# It may be desirable to have access to /run, especially if you wish
# to run additional services in the chroot. However, note that this
# may potentially cause undesirable behaviour on upgrades, such as
# killing services on the host.
-#/run /run none rw,bind 0 0
-#/run/lock /run/lock none rw,bind 0 0
-#/dev/shm /dev/shm none rw,bind 0 0
-#/run/shm /run/shm none rw,bind 0 0
+#/run /run none rw,bind 0 0
+#/run/lock /run/lock none rw,bind 0 0
+#/dev/shm /dev/shm none rw,bind 0 0
+#/run/shm /run/shm none rw,bind 0 0
diff --git a/etc/profile-templates/sbuild/freebsd/fstab b/etc/profile-templates/sbuild/freebsd/fstab
index 778bd428..862b890d 100644
--- a/etc/profile-templates/sbuild/freebsd/fstab
+++ b/etc/profile-templates/sbuild/freebsd/fstab
@@ -1,5 +1,5 @@
-dev /dev devfs rw,bind 0 0
-dev /dev/fd fdescfs rw,bind 0 0
+dev /dev devfs rw,bind 0 0
+dev /dev/fd fdescfs rw,bind 0 0
# Mount a large scratch space for the build, so we don't use up
# space on an LVM snapshot of the chroot itself.
-/var/lib/sbuild/build /build nullfs rw 0 0
+/var/lib/sbuild/build /build nullfs rw 0 0
diff --git a/etc/profile-templates/sbuild/linux/fstab b/etc/profile-templates/sbuild/linux/fstab
index ce334648..26efe88b 100644
--- a/etc/profile-templates/sbuild/linux/fstab
+++ b/etc/profile-templates/sbuild/linux/fstab
@@ -1,5 +1,5 @@
-/dev/pts /dev/pts none rw,bind 0 0
-tmpfs /dev/shm tmpfs defaults 0 0
+/dev/pts /dev/pts none rw,bind 0 0
+tmpfs /dev/shm tmpfs defaults 0 0
# Mount a large scratch space for the build, so we don't use up
# space on an LVM snapshot of the chroot itself.
-/var/lib/sbuild/build /build none rw,bind 0 0
+/var/lib/sbuild/build /build none rw,bind 0 0
diff --git a/etc/setup.d/05btrfs b/etc/setup.d/05btrfs
index bfc62f45..4700fae7 100755
--- a/etc/setup.d/05btrfs
+++ b/etc/setup.d/05btrfs
@@ -27,40 +27,40 @@ if [ "$CHROOT_TYPE" = "btrfs-snapshot" ]; then
if [ $STAGE = "setup-start" ]; then
- if [ ! -d "$CHROOT_BTRFS_SOURCE_SUBVOLUME" ]; then
- fatal "Btrfs source subvolume directory '$CHROOT_BTRFS_SOURCE_SUBVOLUME' does not exist"
- fi
- if [ ! -d "$CHROOT_BTRFS_SNAPSHOT_DIRECTORY" ]; then
- fatal "Btrfs snapshot directory '$CHROOT_BTRFS_SNAPSHOT_DIRECTORY' does not exist"
- fi
+ if [ ! -d "$CHROOT_BTRFS_SOURCE_SUBVOLUME" ]; then
+ fatal "Btrfs source subvolume directory '$CHROOT_BTRFS_SOURCE_SUBVOLUME' does not exist"
+ fi
+ if [ ! -d "$CHROOT_BTRFS_SNAPSHOT_DIRECTORY" ]; then
+ fatal "Btrfs snapshot directory '$CHROOT_BTRFS_SNAPSHOT_DIRECTORY' does not exist"
+ fi
- info "Creating snapshot $CHROOT_BTRFS_SNAPSHOT_NAME from subvolume $CHROOT_BTRFS_SOURCE_SUBVOLUME"
+ info "Creating snapshot $CHROOT_BTRFS_SNAPSHOT_NAME from subvolume $CHROOT_BTRFS_SOURCE_SUBVOLUME"
- if [ "$VERBOSE" = "verbose" ]; then
- btrfs subvolume snapshot "$CHROOT_BTRFS_SOURCE_SUBVOLUME" \
- "$CHROOT_BTRFS_SNAPSHOT_NAME"
- else
- btrfs subvolume snapshot "$CHROOT_BTRFS_SOURCE_SUBVOLUME" \
- "$CHROOT_BTRFS_SNAPSHOT_NAME" > /dev/null
- fi
+ if [ "$VERBOSE" = "verbose" ]; then
+ btrfs subvolume snapshot "$CHROOT_BTRFS_SOURCE_SUBVOLUME" \
+ "$CHROOT_BTRFS_SNAPSHOT_NAME"
+ else
+ btrfs subvolume snapshot "$CHROOT_BTRFS_SOURCE_SUBVOLUME" \
+ "$CHROOT_BTRFS_SNAPSHOT_NAME" > /dev/null
+ fi
elif [ $STAGE = "setup-stop" ]; then
- if [ -d "$CHROOT_BTRFS_SNAPSHOT_NAME" ]; then
+ if [ -d "$CHROOT_BTRFS_SNAPSHOT_NAME" ]; then
- info "Deleting snapshot $CHROOT_BTRFS_SNAPSHOT_NAME"
+ info "Deleting snapshot $CHROOT_BTRFS_SNAPSHOT_NAME"
- if [ "$VERBOSE" = "verbose" ]; then
- btrfs subvolume delete "$CHROOT_BTRFS_SNAPSHOT_NAME" || true
- else
- btrfs subvolume delete "$CHROOT_BTRFS_SNAPSHOT_NAME" > /dev/null || true
- fi
+ if [ "$VERBOSE" = "verbose" ]; then
+ btrfs subvolume delete "$CHROOT_BTRFS_SNAPSHOT_NAME" || true
+ else
+ btrfs subvolume delete "$CHROOT_BTRFS_SNAPSHOT_NAME" > /dev/null || true
+ fi
- else
- # The block device no longer exists, or was never created,
- # for example on lvcreate failure.
- warn "$CHROOT_BTRFS_SNAPSHOT_NAME does not exist (it may have been removed previously)"
- fi
+ else
+ # The block device no longer exists, or was never created,
+ # for example on lvcreate failure.
+ warn "$CHROOT_BTRFS_SNAPSHOT_NAME does not exist (it may have been removed previously)"
+ fi
fi
diff --git a/etc/setup.d/05file b/etc/setup.d/05file
index 13cca7c2..87ab4c9e 100755
--- a/etc/setup.d/05file
+++ b/etc/setup.d/05file
@@ -27,13 +27,13 @@ set -e
check_filetype()
{
if echo "$CHROOT_FILE" | grep -q '\.tar$'; then
- filetype="tar"
+ filetype="tar"
elif echo "$CHROOT_FILE" | egrep -q '(\.tar\.gz|\.tgz)$'; then
- filetype="tgz"
+ filetype="tgz"
elif echo "$CHROOT_FILE" | egrep -q '(\.tar\.bz2|\.tbz)$'; then
- filetype="tbz"
+ filetype="tbz"
else
- fatal "Unsupported filetype for $CHROOT_FILE"
+ fatal "Unsupported filetype for $CHROOT_FILE"
fi
}
@@ -41,17 +41,17 @@ check_filetype()
unpack_file()
{
if [ ! -f "$CHROOT_FILE" ]; then
- fatal "File '$CHROOT_FILE' does not exist"
+ fatal "File '$CHROOT_FILE' does not exist"
fi
if [ "$filetype" = "tar" ]; then
- tar $TAR_VERBOSE -xf "$CHROOT_FILE"
+ tar $TAR_VERBOSE -xf "$CHROOT_FILE"
elif [ "$filetype" = "tgz" ]; then
- tar $TAR_VERBOSE -xzf "$CHROOT_FILE"
+ tar $TAR_VERBOSE -xzf "$CHROOT_FILE"
elif [ "$filetype" = "tbz" ]; then
- tar $TAR_VERBOSE -xjf "$CHROOT_FILE"
+ tar $TAR_VERBOSE -xjf "$CHROOT_FILE"
else
- fatal "Unsupported filetype for $CHROOT_FILE"
+ fatal "Unsupported filetype for $CHROOT_FILE"
fi
}
@@ -63,24 +63,24 @@ repack_file()
trap "if [ -f \"$NEWFILE\" ]; then rm -f \"$NEWFILE\"; fi" 0
if [ "$filetype" = "tar" ]; then
- tar $TAR_VERBOSE -cf "$NEWFILE" .
+ tar $TAR_VERBOSE -cf "$NEWFILE" .
elif [ "$filetype" = "tgz" ]; then
- tar $TAR_VERBOSE -czf "$NEWFILE" .
+ tar $TAR_VERBOSE -czf "$NEWFILE" .
elif [ "$filetype" = "tbz" ]; then
- tar $TAR_VERBOSE -cjf "$NEWFILE" .
+ tar $TAR_VERBOSE -cjf "$NEWFILE" .
else
- fatal "Unsupported filetype for $CHROOT_FILE"
+ fatal "Unsupported filetype for $CHROOT_FILE"
fi
if [ -f "$CHROOT_FILE" ]; then
- info "Setting ownership and permissions from old archive"
- chown --reference="$CHROOT_FILE" "$NEWFILE"
- chmod --reference="$CHROOT_FILE" "$NEWFILE"
+ info "Setting ownership and permissions from old archive"
+ chown --reference="$CHROOT_FILE" "$NEWFILE"
+ chmod --reference="$CHROOT_FILE" "$NEWFILE"
else
- warn "Old archive no longer exists"
- warn "Setting ownership and permissions to root:root 0600"
- chown root:root "$NEWFILE"
- chmod 0600 "$NEWFILE"
+ warn "Old archive no longer exists"
+ warn "Setting ownership and permissions to root:root 0600"
+ chown root:root "$NEWFILE"
+ chmod 0600 "$NEWFILE"
fi
mv "$NEWFILE" "$CHROOT_FILE"
@@ -99,34 +99,34 @@ if [ "$CHROOT_TYPE" = "file" ]; then
if [ $STAGE = "setup-start" ]; then
- info "File unpack directory: $UNPACK_LOCATION"
+ info "File unpack directory: $UNPACK_LOCATION"
if [ ! -d "$UNPACK_LOCATION" ]; then
- mkdir -p "$UNPACK_LOCATION"
- info "Created file unpack directory: $UNPACK_LOCATION"
+ mkdir -p "$UNPACK_LOCATION"
+ info "Created file unpack directory: $UNPACK_LOCATION"
fi
- cd "$UNPACK_LOCATION"
- info "Changed CWD to $UNPACK_LOCATION"
+ cd "$UNPACK_LOCATION"
+ info "Changed CWD to $UNPACK_LOCATION"
- unpack_file
+ unpack_file
elif [ "$STAGE" = "setup-stop" ]; then
- if [ "$STATUS" = "ok" ] && [ "$CHROOT_FILE_REPACK" = "true" ]; then
- if [ -d "$UNPACK_LOCATION" ]; then
- info "Repacking chroot archive file $CHROOT_FILE from $UNPACK_LOCATION"
- cd "$UNPACK_LOCATION" && repack_file
- else
- warn "Not repacking chroot archive file: $UNPACK_LOCATION does not exist (it may have been removed previously)"
- fi
- fi
-
- if [ "$CHROOT_SESSION_PURGE" = "true" ]; then
- info "Purging $UNPACK_LOCATION"
- if [ -d "$UNPACK_LOCATION" ]; then
- rm -rf "$UNPACK_LOCATION"
- fi
- fi
+ if [ "$STATUS" = "ok" ] && [ "$CHROOT_FILE_REPACK" = "true" ]; then
+ if [ -d "$UNPACK_LOCATION" ]; then
+ info "Repacking chroot archive file $CHROOT_FILE from $UNPACK_LOCATION"
+ cd "$UNPACK_LOCATION" && repack_file
+ else
+ warn "Not repacking chroot archive file: $UNPACK_LOCATION does not exist (it may have been removed previously)"
+ fi
+ fi
+
+ if [ "$CHROOT_SESSION_PURGE" = "true" ]; then
+ info "Purging $UNPACK_LOCATION"
+ if [ -d "$UNPACK_LOCATION" ]; then
+ rm -rf "$UNPACK_LOCATION"
+ fi
+ fi
fi
diff --git a/etc/setup.d/05lvm b/etc/setup.d/05lvm
index 2ae7bd14..ff85c542 100755
--- a/etc/setup.d/05lvm
+++ b/etc/setup.d/05lvm
@@ -31,40 +31,40 @@ if [ "$CHROOT_TYPE" = "lvm-snapshot" ]; then
if [ $STAGE = "setup-start" ]; then
- if [ ! "$DEVTYPE" "$CHROOT_DEVICE" ]; then
- fatal "Device '$CHROOT_DEVICE' does not exist"
- fi
+ if [ ! "$DEVTYPE" "$CHROOT_DEVICE" ]; then
+ fatal "Device '$CHROOT_DEVICE' does not exist"
+ fi
- if [ "$VERBOSE" = "verbose" ]; then
- lvcreate $LVM_VERBOSE --snapshot --name "$CHROOT_LVM_SNAPSHOT_NAME" \
- "$CHROOT_DEVICE" $CHROOT_LVM_SNAPSHOT_OPTIONS
- else
- lvcreate $LVM_VERBOSE --snapshot --name "$CHROOT_LVM_SNAPSHOT_NAME" \
- "$CHROOT_DEVICE" $CHROOT_LVM_SNAPSHOT_OPTIONS > /dev/null
- fi
+ if [ "$VERBOSE" = "verbose" ]; then
+ lvcreate $LVM_VERBOSE --snapshot --name "$CHROOT_LVM_SNAPSHOT_NAME" \
+ "$CHROOT_DEVICE" $CHROOT_LVM_SNAPSHOT_OPTIONS
+ else
+ lvcreate $LVM_VERBOSE --snapshot --name "$CHROOT_LVM_SNAPSHOT_NAME" \
+ "$CHROOT_DEVICE" $CHROOT_LVM_SNAPSHOT_OPTIONS > /dev/null
+ fi
elif [ $STAGE = "setup-stop" ]; then
- if [ "$DEVTYPE" "$CHROOT_LVM_SNAPSHOT_DEVICE" ]; then
+ if [ "$DEVTYPE" "$CHROOT_LVM_SNAPSHOT_DEVICE" ]; then
# The lock needs to be dropped immediately before
# destroying the device. There is a small race here, but
# the lock can't be dropped once the device has been
# removed.
- info "Removing device lock for $CHROOT_LVM_SNAPSHOT_DEVICE, owned by pid $PID"
+ info "Removing device lock for $CHROOT_LVM_SNAPSHOT_DEVICE, owned by pid $PID"
"$LIBEXEC_DIR/schroot-releaselock" \
- --device="$CHROOT_LVM_SNAPSHOT_DEVICE" \
- --pid=$PID || true
+ --device="$CHROOT_LVM_SNAPSHOT_DEVICE" \
+ --pid=$PID || true
- if [ "$VERBOSE" = "verbose" ]; then
- lvremove $LVM_VERBOSE -f "$CHROOT_LVM_SNAPSHOT_DEVICE" || true
- else
- lvremove $LVM_VERBOSE -f "$CHROOT_LVM_SNAPSHOT_DEVICE" > /dev/null || true
- fi
- else
- # The block device no longer exists, or was never created,
- # for example on lvcreate failure.
- warn "$CHROOT_LVM_SNAPSHOT_DEVICE does not exist (it may have been removed previously)"
- fi
+ if [ "$VERBOSE" = "verbose" ]; then
+ lvremove $LVM_VERBOSE -f "$CHROOT_LVM_SNAPSHOT_DEVICE" || true
+ else
+ lvremove $LVM_VERBOSE -f "$CHROOT_LVM_SNAPSHOT_DEVICE" > /dev/null || true
+ fi
+ else
+ # The block device no longer exists, or was never created,
+ # for example on lvcreate failure.
+ warn "$CHROOT_LVM_SNAPSHOT_DEVICE does not exist (it may have been removed previously)"
+ fi
fi
diff --git a/etc/setup.d/05union b/etc/setup.d/05union
index 89199afb..0b38aeec 100755
--- a/etc/setup.d/05union
+++ b/etc/setup.d/05union
@@ -26,41 +26,41 @@ set -e
if [ -n "${CHROOT_UNION_TYPE}" ] && [ "${CHROOT_UNION_TYPE}" != 'none' ]; then
if [ $STAGE = "setup-start" ]; then
- mkdir "${CHROOT_UNION_OVERLAY_DIRECTORY}"
- if [ ! -d "$CHROOT_UNION_OVERLAY_DIRECTORY" ]; then
- fatal "$CHROOT_UNION_OVERLAY_DIRECTORY does not exist, and could not be created"
- fi
+ mkdir "${CHROOT_UNION_OVERLAY_DIRECTORY}"
+ if [ ! -d "$CHROOT_UNION_OVERLAY_DIRECTORY" ]; then
+ fatal "$CHROOT_UNION_OVERLAY_DIRECTORY does not exist, and could not be created"
+ fi
- mkdir "${CHROOT_UNION_UNDERLAY_DIRECTORY}"
- if [ ! -d "$CHROOT_UNION_UNDERLAY_DIRECTORY" ]; then
- fatal "$CHROOT_UNION_UNDERLAY_DIRECTORY does not exist, and could not be created"
- fi
+ mkdir "${CHROOT_UNION_UNDERLAY_DIRECTORY}"
+ if [ ! -d "$CHROOT_UNION_UNDERLAY_DIRECTORY" ]; then
+ fatal "$CHROOT_UNION_UNDERLAY_DIRECTORY does not exist, and could not be created"
+ fi
elif [ $STAGE = "setup-recover" ]; then
if [ ! -d "${CHROOT_UNION_OVERLAY_DIRECTORY}" ]; then
- fatal "Missing overlay directory for session: can't recover"
+ fatal "Missing overlay directory for session: can't recover"
fi
if [ ! -d "${CHROOT_UNION_UNDERLAY_DIRECTORY}" ]; then
- fatal "Missing underlay directory for session: can't recover"
+ fatal "Missing underlay directory for session: can't recover"
fi
elif [ $STAGE = "setup-stop" ]; then
if [ "$CHROOT_SESSION_PURGE" = "true" ]; then
- info "Purging $CHROOT_UNION_OVERLAY_DIRECTORY"
- if [ -d "${CHROOT_UNION_OVERLAY_DIRECTORY}" ]; then
- rm -rf "${CHROOT_UNION_OVERLAY_DIRECTORY}"
- fi
+ info "Purging $CHROOT_UNION_OVERLAY_DIRECTORY"
+ if [ -d "${CHROOT_UNION_OVERLAY_DIRECTORY}" ]; then
+ rm -rf "${CHROOT_UNION_OVERLAY_DIRECTORY}"
+ fi
- # For safety, use rmdir rather than rm -rf in case
- # umount failed.
- info "Removing $CHROOT_UNION_UNDERLAY_DIRECTORY"
- if [ -d "${CHROOT_UNION_UNDERLAY_DIRECTORY}" ]; then
- if ! rmdir "${CHROOT_UNION_UNDERLAY_DIRECTORY}"; then
- warn "Please unmount any filesystems and remove any files under $CHROOT_UNION_UNDERLAY_DIRECTORY"
- fatal "Failed to remove $CHROOT_UNION_UNDERLAY_DIRECTORY (directory not empty)."
- fi
- fi
- fi
+ # For safety, use rmdir rather than rm -rf in case
+ # umount failed.
+ info "Removing $CHROOT_UNION_UNDERLAY_DIRECTORY"
+ if [ -d "${CHROOT_UNION_UNDERLAY_DIRECTORY}" ]; then
+ if ! rmdir "${CHROOT_UNION_UNDERLAY_DIRECTORY}"; then
+ warn "Please unmount any filesystems and remove any files under $CHROOT_UNION_UNDERLAY_DIRECTORY"
+ fatal "Failed to remove $CHROOT_UNION_UNDERLAY_DIRECTORY (directory not empty)."
+ fi
+ fi
+ fi
fi
fi
diff --git a/etc/setup.d/10mount b/etc/setup.d/10mount
index 3294b0a3..34666bf3 100755
--- a/etc/setup.d/10mount
+++ b/etc/setup.d/10mount
@@ -33,13 +33,13 @@ do_mount()
info "Mounting $2 on $3"
if [ -h "$3" ]; then
- fatal "$3 is a symbolic link, not usable as a mountpoint"
+ fatal "$3 is a symbolic link, not usable as a mountpoint"
fi
if [ ! -d "$3" ]; then
- mkdir -p "$3"
+ mkdir -p "$3"
fi
if [ ! -d "$3" ]; then
- fatal "$3 does not exist, and could not be created"
+ fatal "$3 does not exist, and could not be created"
fi
info "$MOUNT_VERBOSE $1 $2 $3"
@@ -51,43 +51,43 @@ do_mount()
do_umount_all()
{
if [ -d "$1" ]; then
- # Note that flock is used here to prevent races reading
- # /proc/mounts, which on current (Linux 2.6.32) kernels is
- # racy. If other processes are mounting or unmounting
- # filesystems as we read it, we can miss mount entries due to
- # the file changing as we read it. This needs fixing in the
- # kernel, but an exclusive lock surrounding the
- # schroot-listmounts invocation is a partial fix. This
- # prevents racing when multiple schroot processes are running.
- # Note that this does not prevent the problem when programs
- # other than schroot mount and unmount filesystems (since they
- # don't create the lock).
- if [ -e /var/lock/schroot ]; then
- if [ ! -d /var/lock/schroot ]; then
- error "/var/lock/schroot is not a directory"
- exit 1
- fi
- else
- mkdir -m 0700 /var/lock/schroot
- fi
-
- if [ "$(stat -c "%u %g %a" /var/lock/schroot)" != "0 0 700" ]; then
- error "/var/lock/schroot is not owned by root:root, or lacks 0700 permissions"
- exit 1
- fi
-
- ( flock 9
- mounts="$("$LIBEXEC_DIR/schroot-listmounts" -m "$1")"
- if [ "x$mounts" != 'x' ]; then
- echo "$mounts" |
- while read mountloc; do
+ # Note that flock is used here to prevent races reading
+ # /proc/mounts, which on current (Linux 2.6.32) kernels is
+ # racy. If other processes are mounting or unmounting
+ # filesystems as we read it, we can miss mount entries due to
+ # the file changing as we read it. This needs fixing in the
+ # kernel, but an exclusive lock surrounding the
+ # schroot-listmounts invocation is a partial fix. This
+ # prevents racing when multiple schroot processes are running.
+ # Note that this does not prevent the problem when programs
+ # other than schroot mount and unmount filesystems (since they
+ # don't create the lock).
+ if [ -e /var/lock/schroot ]; then
+ if [ ! -d /var/lock/schroot ]; then
+ error "/var/lock/schroot is not a directory"
+ exit 1
+ fi
+ else
+ mkdir -m 0700 /var/lock/schroot
+ fi
+
+ if [ "$(stat -c "%u %g %a" /var/lock/schroot)" != "0 0 700" ]; then
+ error "/var/lock/schroot is not owned by root:root, or lacks 0700 permissions"
+ exit 1
+ fi
+
+ ( flock 9
+ mounts="$("$LIBEXEC_DIR/schroot-listmounts" -m "$1")"
+ if [ "x$mounts" != 'x' ]; then
+ echo "$mounts" |
+ while read mountloc; do
info "Unmounting $mountloc"
- umount "$mountloc" || exit 1
- done || exit 1
- fi
- ) 9>"/var/lock/schroot/umount"
+ umount "$mountloc" || exit 1
+ done || exit 1
+ fi
+ ) 9>"/var/lock/schroot/umount"
else
- warn "Mount location $1 no longer exists; skipping unmount"
+ warn "Mount location $1 no longer exists; skipping unmount"
fi
}
@@ -97,17 +97,17 @@ do_mount_fs_union()
{
# Prepare mount options (branch config) for union type
if [ -z "$CHROOT_UNION_MOUNT_OPTIONS" ]; then
- case $CHROOT_UNION_TYPE in
- unionfs)
- CHROOT_UNION_MOUNT_OPTIONS="dirs=${CHROOT_UNION_OVERLAY_DIRECTORY}=rw,${CHROOT_UNION_UNDERLAY_DIRECTORY}=ro"
- ;;
- aufs)
- CHROOT_UNION_MOUNT_OPTIONS="br:${CHROOT_UNION_OVERLAY_DIRECTORY}:${CHROOT_UNION_UNDERLAY_DIRECTORY}=ro"
- ;;
- overlayfs)
+ case $CHROOT_UNION_TYPE in
+ unionfs)
+ CHROOT_UNION_MOUNT_OPTIONS="dirs=${CHROOT_UNION_OVERLAY_DIRECTORY}=rw,${CHROOT_UNION_UNDERLAY_DIRECTORY}=ro"
+ ;;
+ aufs)
+ CHROOT_UNION_MOUNT_OPTIONS="br:${CHROOT_UNION_OVERLAY_DIRECTORY}:${CHROOT_UNION_UNDERLAY_DIRECTORY}=ro"
+ ;;
+ overlayfs)
CHROOT_UNION_MOUNT_OPTIONS="lowerdir=${CHROOT_UNION_UNDERLAY_DIRECTORY},upperdir=${CHROOT_UNION_OVERLAY_DIRECTORY}"
;;
- esac
+ esac
fi
info "Using '$CHROOT_UNION_TYPE' for filesystem union"
@@ -129,98 +129,98 @@ if [ "$CHROOT_TYPE" = "directory" ] \
|| [ "$CHROOT_TYPE" = "btrfs-snapshot" ]; then
if [ "${CHROOT_UNION_TYPE:-none}" != "none" ]; then
- CREATE_UNION="yes"
+ CREATE_UNION="yes"
else
- CREATE_UNION="no"
+ CREATE_UNION="no"
fi
if [ $STAGE = "setup-start" ] || [ $STAGE = "setup-recover" ]; then
- case "$HOST_OS" in
- freebsd* | k*bsd*-gnu) :
- BINDOPT="-t nullfs"
- ;;
- *):
- BINDOPT="--bind"
- ;;
- esac
-
- if [ "$CHROOT_TYPE" = "directory" ]; then
- CHROOT_MOUNT_OPTIONS="$BINDOPT $CHROOT_MOUNT_OPTIONS"
- CHROOT_MOUNT_DEVICE="$CHROOT_DIRECTORY"
- if [ ! -d "$CHROOT_DIRECTORY" ]; then
- fatal "Directory '$CHROOT_DIRECTORY' does not exist"
- fi
- elif [ "$CHROOT_TYPE" = "file" ]; then
- CHROOT_MOUNT_OPTIONS="$BINDOPT $CHROOT_MOUNT_OPTIONS"
- CHROOT_MOUNT_DEVICE="${CHROOT_FILE_UNPACK_DIR}/${SESSION_ID}"
- elif [ "$CHROOT_TYPE" = "block-device" ]; then
- if [ ! "$DEVTYPE" "$CHROOT_DEVICE" ]; then
- fatal "Device '$CHROOT_DEVICE' does not exist"
- fi
- elif [ "$CHROOT_TYPE" = "btrfs-snapshot" ]; then
- CHROOT_MOUNT_OPTIONS="$BINDOPT $CHROOT_MOUNT_OPTIONS"
- CHROOT_MOUNT_DEVICE="$CHROOT_BTRFS_SNAPSHOT_NAME"
- elif [ "$CHROOT_TYPE" = "loopback" ]; then
- if [ ! -f "$CHROOT_FILE" ]; then
- fatal "File '$CHROOT_FILE' does not exist"
- fi
-
- case "$HOST_OS" in
- freebsd* | k*bsd*-gnu):
- LOOP_DEVICE="/dev/$(/sbin/mdconfig -a -t vnode -f "$CHROOT_FILE")"
- CHROOT_MOUNT_DEVICE="$LOOP_DEVICE"
- ;;
- *):
- LOOP_DEVICE="$(/sbin/losetup -j "$CHROOT_FILE" | sed -e 's/:.*$//')"
- if [ -z "$LOOP_DEVICE" ]; then
- CHROOT_MOUNT_DEVICE="$CHROOT_FILE"
- CHROOT_MOUNT_OPTIONS="-o loop $CHROOT_MOUNT_OPTIONS"
- else
- CHROOT_MOUNT_DEVICE="$LOOP_DEVICE"
- fi
- ;;
- esac
- fi
+ case "$HOST_OS" in
+ freebsd* | k*bsd*-gnu) :
+ BINDOPT="-t nullfs"
+ ;;
+ *):
+ BINDOPT="--bind"
+ ;;
+ esac
+
+ if [ "$CHROOT_TYPE" = "directory" ]; then
+ CHROOT_MOUNT_OPTIONS="$BINDOPT $CHROOT_MOUNT_OPTIONS"
+ CHROOT_MOUNT_DEVICE="$CHROOT_DIRECTORY"
+ if [ ! -d "$CHROOT_DIRECTORY" ]; then
+ fatal "Directory '$CHROOT_DIRECTORY' does not exist"
+ fi
+ elif [ "$CHROOT_TYPE" = "file" ]; then
+ CHROOT_MOUNT_OPTIONS="$BINDOPT $CHROOT_MOUNT_OPTIONS"
+ CHROOT_MOUNT_DEVICE="${CHROOT_FILE_UNPACK_DIR}/${SESSION_ID}"
+ elif [ "$CHROOT_TYPE" = "block-device" ]; then
+ if [ ! "$DEVTYPE" "$CHROOT_DEVICE" ]; then
+ fatal "Device '$CHROOT_DEVICE' does not exist"
+ fi
+ elif [ "$CHROOT_TYPE" = "btrfs-snapshot" ]; then
+ CHROOT_MOUNT_OPTIONS="$BINDOPT $CHROOT_MOUNT_OPTIONS"
+ CHROOT_MOUNT_DEVICE="$CHROOT_BTRFS_SNAPSHOT_NAME"
+ elif [ "$CHROOT_TYPE" = "loopback" ]; then
+ if [ ! -f "$CHROOT_FILE" ]; then
+ fatal "File '$CHROOT_FILE' does not exist"
+ fi
+
+ case "$HOST_OS" in
+ freebsd* | k*bsd*-gnu):
+ LOOP_DEVICE="/dev/$(/sbin/mdconfig -a -t vnode -f "$CHROOT_FILE")"
+ CHROOT_MOUNT_DEVICE="$LOOP_DEVICE"
+ ;;
+ *):
+ LOOP_DEVICE="$(/sbin/losetup -j "$CHROOT_FILE" | sed -e 's/:.*$//')"
+ if [ -z "$LOOP_DEVICE" ]; then
+ CHROOT_MOUNT_DEVICE="$CHROOT_FILE"
+ CHROOT_MOUNT_OPTIONS="-o loop $CHROOT_MOUNT_OPTIONS"
+ else
+ CHROOT_MOUNT_DEVICE="$LOOP_DEVICE"
+ fi
+ ;;
+ esac
+ fi
if [ ! -d "$CHROOT_MOUNT_LOCATION" ]; then
- mkdir -p "$CHROOT_MOUNT_LOCATION"
+ mkdir -p "$CHROOT_MOUNT_LOCATION"
+ fi
+ if [ ! -d "$CHROOT_MOUNT_LOCATION" ]; then
+ fatal "$CHROOT_MOUNT_LOCATION does not exist, and could not be created"
+ fi
+
+ # If recovering, we want to remount all filesystems to ensure
+ # a sane state.
+ if [ $STAGE = "setup-recover" ]; then
+ if [ "$CREATE_UNION" = "yes" ]; then
+ do_umount_all "$CHROOT_UNION_UNDERLAY_DIRECTORY"
+ fi
+ do_umount_all "$CHROOT_MOUNT_LOCATION"
+ fi
+
+ if [ "$CREATE_UNION" = "yes" ]; then
+ do_mount "$CHROOT_MOUNT_OPTIONS" "$CHROOT_MOUNT_DEVICE" "$CHROOT_UNION_UNDERLAY_DIRECTORY"
+ do_mount_fs_union "$CHROOT_MOUNT_LOCATION"
+ else
+ do_mount "$CHROOT_MOUNT_OPTIONS" "$CHROOT_MOUNT_DEVICE" "$CHROOT_MOUNT_LOCATION"
fi
- if [ ! -d "$CHROOT_MOUNT_LOCATION" ]; then
- fatal "$CHROOT_MOUNT_LOCATION does not exist, and could not be created"
- fi
-
- # If recovering, we want to remount all filesystems to ensure
- # a sane state.
- if [ $STAGE = "setup-recover" ]; then
- if [ "$CREATE_UNION" = "yes" ]; then
- do_umount_all "$CHROOT_UNION_UNDERLAY_DIRECTORY"
- fi
- do_umount_all "$CHROOT_MOUNT_LOCATION"
- fi
-
- if [ "$CREATE_UNION" = "yes" ]; then
- do_mount "$CHROOT_MOUNT_OPTIONS" "$CHROOT_MOUNT_DEVICE" "$CHROOT_UNION_UNDERLAY_DIRECTORY"
- do_mount_fs_union "$CHROOT_MOUNT_LOCATION"
- else
- do_mount "$CHROOT_MOUNT_OPTIONS" "$CHROOT_MOUNT_DEVICE" "$CHROOT_MOUNT_LOCATION"
- fi
elif [ $STAGE = "setup-stop" ]; then
- do_umount_all "$CHROOT_MOUNT_LOCATION"
- if [ "$CREATE_UNION" = "yes" ]; then
- do_umount_all "$CHROOT_UNION_UNDERLAY_DIRECTORY"
- fi
+ do_umount_all "$CHROOT_MOUNT_LOCATION"
+ if [ "$CREATE_UNION" = "yes" ]; then
+ do_umount_all "$CHROOT_UNION_UNDERLAY_DIRECTORY"
+ fi
- # Purge mount location.
- # The contents of file chroots are purged separately, because
- # we might want to repack the contents.
- if echo "$CHROOT_MOUNT_LOCATION" | grep -q "^$MOUNT_DIR/"; then
- if [ -d "$CHROOT_MOUNT_LOCATION" ]; then
- rmdir "$CHROOT_MOUNT_LOCATION"
- fi
- fi
+ # Purge mount location.
+ # The contents of file chroots are purged separately, because
+ # we might want to repack the contents.
+ if echo "$CHROOT_MOUNT_LOCATION" | grep -q "^$MOUNT_DIR/"; then
+ if [ -d "$CHROOT_MOUNT_LOCATION" ]; then
+ rmdir "$CHROOT_MOUNT_LOCATION"
+ fi
+ fi
fi
@@ -230,12 +230,12 @@ fi
if [ $STAGE = "setup-start" ] || [ $STAGE = "setup-recover" ]; then
if [ -n "$SETUP_FSTAB" ]; then
- if [ -f "$SETUP_FSTAB" ]; then
- "$LIBEXEC_DIR/schroot-mount" $MOUNT_VERBOSE \
- -f "$SETUP_FSTAB" -m "$CHROOT_PATH"
- else
- fatal "setup_fstab file '$SETUP_FSTAB' does not exist"
- fi
+ if [ -f "$SETUP_FSTAB" ]; then
+ "$LIBEXEC_DIR/schroot-mount" $MOUNT_VERBOSE \
+ -f "$SETUP_FSTAB" -m "$CHROOT_PATH"
+ else
+ fatal "setup_fstab file '$SETUP_FSTAB' does not exist"
+ fi
fi
fi
diff --git a/etc/setup.d/15binfmt b/etc/setup.d/15binfmt
index 400acc9b..ad1776b2 100644
--- a/etc/setup.d/15binfmt
+++ b/etc/setup.d/15binfmt
@@ -38,10 +38,10 @@ shell="${CHROOT_PATH}/bin/sh"
for emulator in $(update-binfmts --find "$shell"); do
dst="${CHROOT_PATH}$emulator"
if [ ! -e "$emulator" ]; then
- info "Missing emulator: $emulator; not enabling binfmt support"
+ info "Missing emulator: $emulator; not enabling binfmt support"
else
- [ -e "$dst" ] || touch "$dst"
- mount --bind "$emulator" "$dst"
- mount -o remount,ro,bind "$dst"
+ [ -e "$dst" ] || touch "$dst"
+ mount --bind "$emulator" "$dst"
+ mount -o remount,ro,bind "$dst"
fi
done
diff --git a/etc/setup.d/15killprocs b/etc/setup.d/15killprocs
index c7bc34fd..8630e89a 100755
--- a/etc/setup.d/15killprocs
+++ b/etc/setup.d/15killprocs
@@ -40,41 +40,41 @@ kill_proc()
do_kill_all()
{
if [ -z "$1" ]; then
- fatal "No path for finding stray processes: not reaping processes in chroot"
+ fatal "No path for finding stray processes: not reaping processes in chroot"
fi
info "Killing processes run inside $1"
ls /proc | egrep '^[[:digit:]]+$' |
while read pid; do
- # Check if process root are the same device/inode as chroot
- # root (for efficiency)
+ # Check if process root are the same device/inode as chroot
+ # root (for efficiency)
if [ /proc/"$pid"/root -ef "$1" ]; then
- # Check if process and chroot root are the same (may be
- # different even if device/inode match).
- root=$(readlink /proc/"$pid"/root || true)
- if [ "$root" = "$1" ]; then
- exe=$(readlink /proc/"$pid"/exe || true)
- info "Killing left-over pid $pid (${exe##$1})"
- info " Sending SIGTERM to pid $pid"
+ # Check if process and chroot root are the same (may be
+ # different even if device/inode match).
+ root=$(readlink /proc/"$pid"/root || true)
+ if [ "$root" = "$1" ]; then
+ exe=$(readlink /proc/"$pid"/exe || true)
+ info "Killing left-over pid $pid (${exe##$1})"
+ info " Sending SIGTERM to pid $pid"
- kill_proc -TERM "$pid"
+ kill_proc -TERM "$pid"
- count=0
- max=5
- while [ -d /proc/"$pid" ]; do
+ count=0
+ max=5
+ while [ -d /proc/"$pid" ]; do
count=$(( $count + 1 ))
info " Waiting for pid $pid to shut down... ($count/$max)"
sleep 1
# Wait for $max seconds for process to die before -9'ing it
if [ "$count" -eq "$max" ]; then
- info " Sending SIGKILL to pid $pid"
- kill_proc -KILL "$pid"
- sleep 1
- break
+ info " Sending SIGKILL to pid $pid"
+ kill_proc -KILL "$pid"
+ sleep 1
+ break
fi
- done
+ done
fi
- fi
+ fi
done
}
diff --git a/etc/setup.d/20copyfiles b/etc/setup.d/20copyfiles
index bbeb2482..2c01af9e 100755
--- a/etc/setup.d/20copyfiles
+++ b/etc/setup.d/20copyfiles
@@ -34,64 +34,64 @@ copy_file()
{
if [ -e "$1" ]; then
- COPY="true"
+ COPY="true"
- if [ -e "$2" ]; then
+ if [ -e "$2" ]; then
# Device and inode
- da=$(/usr/bin/stat --format="%d %i" "$1")
- # This one can fail since it might not exist yet
- db=$(/usr/bin/stat --format="%d %i" "$2" 2>/dev/null || :)
+ da=$(/usr/bin/stat --format="%d %i" "$1")
+ # This one can fail since it might not exist yet
+ db=$(/usr/bin/stat --format="%d %i" "$2" 2>/dev/null || :)
- if [ "$da" = "$db" ]; then
- COPY="false"
- elif [ -L "$2" ]; then
- # Copy if destination is a symlink
- :
- elif [ -f "$1" ] && [ -f "$2" ]; then
+ if [ "$da" = "$db" ]; then
+ COPY="false"
+ elif [ -L "$2" ]; then
+ # Copy if destination is a symlink
+ :
+ elif [ -f "$1" ] && [ -f "$2" ]; then
# Content
- ca=$(/usr/bin/md5sum "$1" | sed -e 's/\(^[0-9a-f][0-9a-f]*\).*$/\1/')
- cb=$(/usr/bin/md5sum "$2" 2>/dev/null || :)
- cb=$(echo "$cb" | sed -e 's/\(^[0-9a-f][0-9a-f]*\).*$/\1/')
- # Copy only if file contents differ
- if [ "$ca" = "$cb" ]; then
- COPY="false"
- fi
- fi
- fi
+ ca=$(/usr/bin/md5sum "$1" | sed -e 's/\(^[0-9a-f][0-9a-f]*\).*$/\1/')
+ cb=$(/usr/bin/md5sum "$2" 2>/dev/null || :)
+ cb=$(echo "$cb" | sed -e 's/\(^[0-9a-f][0-9a-f]*\).*$/\1/')
+ # Copy only if file contents differ
+ if [ "$ca" = "$cb" ]; then
+ COPY="false"
+ fi
+ fi
+ fi
- # Copy only if files are different
- if [ "$COPY" = "true" ]; then
- if [ -f "$1" ]; then
- cp --preserve=all $CP_VERBOSE "$1" "$2"
- else
- # Copy non-regular file directly
- cp -a $CP_VERBOSE "$1" "$2"
- fi
- fi
+ # Copy only if files are different
+ if [ "$COPY" = "true" ]; then
+ if [ -f "$1" ]; then
+ cp --preserve=all $CP_VERBOSE "$1" "$2"
+ else
+ # Copy non-regular file directly
+ cp -a $CP_VERBOSE "$1" "$2"
+ fi
+ fi
else
- fatal "Not copying nonexistent file: $file"
+ fatal "Not copying nonexistent file: $file"
fi
}
if [ $STAGE = "setup-start" ] || [ $STAGE = "setup-recover" ]; then
if [ -n "$SETUP_COPYFILES" ]; then
- if [ -f "$SETUP_COPYFILES" ]; then
- while read file; do
- if echo "$file" | egrep -q '^(#|$)' ; then
- continue
- fi
- if echo "$file" | grep -q '^/'; then
- copy_file "$file" "${CHROOT_PATH}$file"
- else
- warn "Not copying file with relative path: $file"
- fi
- done < "$SETUP_COPYFILES"
- else
- fatal "copyfiles file '$SETUP_COPYFILES' does not exist"
- fi
+ if [ -f "$SETUP_COPYFILES" ]; then
+ while read file; do
+ if echo "$file" | egrep -q '^(#|$)' ; then
+ continue
+ fi
+ if echo "$file" | grep -q '^/'; then
+ copy_file "$file" "${CHROOT_PATH}$file"
+ else
+ warn "Not copying file with relative path: $file"
+ fi
+ done < "$SETUP_COPYFILES"
+ else
+ fatal "copyfiles file '$SETUP_COPYFILES' does not exist"
+ fi
fi
fi
diff --git a/etc/setup.d/20nssdatabases b/etc/setup.d/20nssdatabases
index dbc04e17..6ea83c09 100755
--- a/etc/setup.d/20nssdatabases
+++ b/etc/setup.d/20nssdatabases
@@ -35,30 +35,30 @@ dup_nss()
if [ $STAGE = "setup-start" ] || [ $STAGE = "setup-recover" ]; then
if [ -n "$SETUP_NSSDATABASES" ]; then
- if [ -f "$SETUP_NSSDATABASES" ]; then
- while read db; do
- if echo "$db" | egrep -q '^(#|$)' ; then
- continue
- fi
+ if [ -f "$SETUP_NSSDATABASES" ]; then
+ while read db; do
+ if echo "$db" | egrep -q '^(#|$)' ; then
+ continue
+ fi
# Device and inode
- dr=$(/usr/bin/stat --format="%d %i" "/etc/$db")
- # This one can fail since it might not exist yet
- dc=$(/usr/bin/stat --format="%d %i" "${CHROOT_PATH}/etc/$db" 2>/dev/null || :)
+ dr=$(/usr/bin/stat --format="%d %i" "/etc/$db")
+ # This one can fail since it might not exist yet
+ dc=$(/usr/bin/stat --format="%d %i" "${CHROOT_PATH}/etc/$db" 2>/dev/null || :)
- # If the database inside and outside the chroot is the
- # same, it's very likely that dup_nss would blank the
- # database, so skip it.
- if [ "$dr" = "$dc" ]; then
- warn "$db files '/etc/$db' and '${CHROOT_PATH}/etc/$db' are the same file; skipping"
- continue;
- fi
+ # If the database inside and outside the chroot is the
+ # same, it's very likely that dup_nss would blank the
+ # database, so skip it.
+ if [ "$dr" = "$dc" ]; then
+ warn "$db files '/etc/$db' and '${CHROOT_PATH}/etc/$db' are the same file; skipping"
+ continue;
+ fi
- dup_nss "$db" "${CHROOT_PATH}/etc/$db"
- done < "$SETUP_NSSDATABASES"
- else
- fatal "nssdatabases file '$SETUP_NSSDATABASES' does not exist"
- fi
+ dup_nss "$db" "${CHROOT_PATH}/etc/$db"
+ done < "$SETUP_NSSDATABASES"
+ else
+ fatal "nssdatabases file '$SETUP_NSSDATABASES' does not exist"
+ fi
fi
fi
diff --git a/etc/setup.d/60unshare b/etc/setup.d/60unshare
index e94a70df..120030d5 100755
--- a/etc/setup.d/60unshare
+++ b/etc/setup.d/60unshare
@@ -31,8 +31,8 @@ set -e
if [ $STAGE = "exec-start" ]; then
if [ "$UNSHARE_NEWNET" = "true" ]; then
- info "Bringing up netdev lo"
- ip link set dev lo up
+ info "Bringing up netdev lo"
+ ip link set dev lo up
fi
fi
diff --git a/etc/setup.d/70services b/etc/setup.d/70services
index 818d62dd..c0cc1b2e 100755
--- a/etc/setup.d/70services
+++ b/etc/setup.d/70services
@@ -38,7 +38,7 @@ if [ $STAGE = "setup-start" ] || [ $STAGE = "setup-recover" ]; then
SETUP_SERVICES=$(echo "$SETUP_SERVICES" | tr ',' '\n')
for service in $SETUP_SERVICES; do
- chroot "$CHROOT_PATH" /usr/sbin/invoke-rc.d --force "$service" start
+ chroot "$CHROOT_PATH" /usr/sbin/invoke-rc.d --force "$service" start
done
elif [ $STAGE = "setup-stop" ]; then
@@ -48,7 +48,7 @@ elif [ $STAGE = "setup-stop" ]; then
SETUP_SERVICES=$(echo "$SETUP_SERVICES" | tr ',' '\n' | tac)
for service in $SETUP_SERVICES; do
- chroot "$CHROOT_PATH" /usr/sbin/invoke-rc.d --force "$service" stop || true
+ chroot "$CHROOT_PATH" /usr/sbin/invoke-rc.d --force "$service" stop || true
done
fi
diff --git a/etc/setup.d/common-config b/etc/setup.d/common-config
index 70720b64..4344f96a 100644
--- a/etc/setup.d/common-config
+++ b/etc/setup.d/common-config
@@ -22,7 +22,7 @@
if [ -n "${SETUP_CONFIG}" ]; then
SETUP_CONFIG="${SYSCONF_DIR}/${SETUP_CONFIG}"
if [ -f "$SETUP_CONFIG" ]; then
- . "$SETUP_CONFIG"
+ . "$SETUP_CONFIG"
fi
fi
# Source script-config if set. If the file is no longer present
@@ -32,7 +32,7 @@ if [ -n "$CHROOT_SCRIPT_CONFIG" ]; then
COPYFILES="$(dirname "$CHROOT_SCRIPT_CONFIG")/copyfiles"
NSSDATABASES="$(dirname "$CHROOT_SCRIPT_CONFIG")/nssdatabases"
if [ -f "$CHROOT_SCRIPT_CONFIG" ]; then
- . "$CHROOT_SCRIPT_CONFIG"
+ . "$CHROOT_SCRIPT_CONFIG"
fi
fi
diff --git a/etc/setup.d/common-data b/etc/setup.d/common-data
index 95b4935c..9c855c6e 100644
--- a/etc/setup.d/common-data
+++ b/etc/setup.d/common-data
@@ -26,9 +26,9 @@ STATUS="$2"
# FreeBSD uses character devices in place of block devices
case "$HOST_OS" in
freebsd* | k*bsd*-gnu) :
- DEVTYPE="-c"
- ;;
+ DEVTYPE="-c"
+ ;;
*):
- DEVTYPE="-b"
- ;;
+ DEVTYPE="-b"
+ ;;
esac
diff --git a/etc/setup.d/common-functions b/etc/setup.d/common-functions
index cbc85b3e..fe486278 100644
--- a/etc/setup.d/common-functions
+++ b/etc/setup.d/common-functions
@@ -23,7 +23,7 @@
info()
{
if [ "$VERBOSE" = "verbose" ]; then
- echo "$1"
+ echo "$1"
fi
return 0
}