File: 005_device_ops__uid0

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 (33 lines) | stat: -rwxr-xr-x 633 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
#!/bin/bash

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

if [[ $UID -eq 0 ]]
then
	mv device device-2
	mkdir device
	mv device-2 device/device-node

	chown 1.1 empty-file

	# We don't know whether there's sudo, su or something else possible.
	# lchown() isn't available on the cli, so use perl.
	mkdir -m 777 all_open
	perl -e '$(=$)="5 5"; $<=$>=1; symlink(shift(), shift()) || die $!' device all_open/KK

	rm reclink
	touch reclink

	echo "     ci"
	$BINq ci -m "changed dev to dir/dev and link to file"
	echo "     st1"
	$BINq st

	$WC2_UP_ST_COMPARE
else
  $WARN "cannot test device creation as normal user."
fi