File: filesystems

package info (click to toggle)
partman-target 34
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 532 kB
  • ctags: 7
  • sloc: sh: 366; makefile: 29
file content (75 lines) | stat: -rwxr-xr-x 1,434 bytes parent folder | download
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/sh

. /lib/partman/definitions.sh

dev=$1
num=$2
id=$3
size=$4
type=$5
fs=$6
path=$7
name=$8

cd $dev

[ -d $id ] || mkdir $id

if [ $fs = free -a -f $id/method ]; then
    rm $id/method
fi

if [ ! -f $id/method -o ! -f $id/use_filesystem ]; then
    [ ! -f $id/acting_filesystem ] || rm $id/acting_filesystem
    exit 0
fi

if [ -f $id/filesystem ]; then
    cp $id/filesystem $id/acting_filesystem
else
    if [ -f $id/acting_filesystem ]; then
	rm $id/acting_filesystem
    fi
fi

open_dialog PARTITION_INFO $id
read_line num id size type fs path name
close_dialog

acting_filesystem=''
if
    [ -f $id/acting_filesystem ] \
	&& acting_filesystem=$(cat $id/acting_filesystem) \
	&& [ -f /lib/partman/parted_names/$acting_filesystem ] \
	&& new_fs=$(cat /lib/partman/parted_names/$acting_filesystem) \
	&& [ "$fs" != "$new_fs" ]
then
    open_dialog CHANGE_FILE_SYSTEM $id $new_fs
    close_dialog
fi

existing=no
formatable=no

for i in /lib/partman/valid_filesystems/*; do
    [ -x $i ] || continue
    if [ "`$i $dev $id existing`" = "$acting_filesystem" ]; then
	existing=yes
    fi
    if [ "`$i $dev $id formatable`" = "$acting_filesystem" ]; then
	formatable=yes
    fi
done

if [ $existing = yes ]; then
    > $dev/$id/existing
else
    [ ! -f $dev/$id/existing ] || rm $dev/$id/existing
fi

if [ $formatable = yes ]; then
    > $dev/$id/formatable
else
    [ ! -f $dev/$id/formatable ] || rm $dev/$id/formatable
fi