File: 063_chroot

package info (click to toggle)
fsvs 1.2.7-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 2,964 kB
  • ctags: 1,464
  • sloc: ansic: 16,650; sh: 5,885; perl: 783; makefile: 338; python: 90
file content (34 lines) | stat: -rwxr-xr-x 749 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash

set -e 
$PREPARE_DEFAULT > /dev/null
$INCLUDE_FUNCS
cd $WC


logfile=$LOGDIR/063.chroot

if [[ $UID -eq 0 ]]
then
	export FSVS_CHROOT_CWD=17
	export FSVS_CHROOT_ROOT=84
	export FSVS_CHROOT_LIBS=m

	mkdir dir
	echo gurgle > empty-file
	date > dir/new-chroot

	# The shell doesn't do $X</ - the $X is taken as parameter for the 
	# binary, not as file number. So we call a sub-shell.
	bash -c "$BINdflt st .. -o dir_sort=yes > $logfile $FSVS_CHROOT_CWD<dir $FSVS_CHROOT_ROOT</"
	if [[ `cat $logfile` != ".mC."*"dir  .."*"N..."*"dir  ../dir"*"N..."*"../dir/new-chroot"*".mC."*"../empty-file" ]]
	then
		cat $logfile
		$ERROR "Wrong status output?"
	fi

	$SUCCESS "Chroot execution seems ok."
else
  $WARN "Cannot test chroot as user."
fi