~elementary-os/ubuntu-package-imports/ubiquity-bionic

« back to all changes in this revision

Viewing changes to d-i/source/partman-jfs/commit.d/format_jfs

  • Committer: RabbitBot
  • Date: 2018-02-05 14:44:42 UTC
  • Revision ID: rabbitbot@elementary.io-20180205144442-vt0fvth7zus90wjh
Initial import, version 17.10.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
. /lib/partman/lib/base.sh
 
4
 
 
5
enable_swap
 
6
 
 
7
for dev in $DEVICES/*; do
 
8
        [ -d "$dev" ] || continue
 
9
        cd $dev
 
10
        partitions=
 
11
        open_dialog PARTITIONS
 
12
        while { read_line num id size type fs path name; [ "$id" ]; }; do
 
13
                [ "$fs" != free ] || continue
 
14
                partitions="$partitions $id,$num"
 
15
        done
 
16
        close_dialog
 
17
 
 
18
        for part in $partitions; do
 
19
                id=${part%,*}
 
20
                num=${part#*,}
 
21
                [ -f $id/method -a -f $id/format \
 
22
                  -a -f $id/acting_filesystem ] || continue
 
23
                filesystem=$(cat $id/acting_filesystem)
 
24
                case $filesystem in
 
25
                    jfs)
 
26
                        if [ -f $id/formatted ] && \
 
27
                           [ $id/formatted -nt $id/method ] && \
 
28
                           ([ ! -f $id/filesystem ] || \
 
29
                            [ $id/formatted -nt $id/filesystem ]); then
 
30
                                continue
 
31
                        fi
 
32
                        log "Try to create file system for $dev/$id"
 
33
                        if [ -f $id/mountpoint ]; then
 
34
                                template=partman-basicfilesystems/progress_formatting_mountable
 
35
                                db_subst $template MOUNT_POINT "$(cat $id/mountpoint)"
 
36
                        else
 
37
                                template=partman-basicfilesystems/progress_formatting
 
38
                        fi
 
39
                        open_dialog PARTITION_INFO $id
 
40
                        read_line x1 x2 x3 x4 x5 device x6
 
41
                        close_dialog
 
42
 
 
43
                        RET=''
 
44
                        db_metaget  partman/filesystem_short/"$filesystem" description || RET=''
 
45
                        [ "$RET" ] || RET="$filesystem"
 
46
                        db_subst $template TYPE "$RET"
 
47
                        db_subst $template PARTITION "$num"
 
48
                        db_subst $template DEVICE $(humandev $(cat device))
 
49
 
 
50
                        db_progress START 0 3 partman/text/formatting
 
51
                        db_progress INFO $template
 
52
                        db_progress SET 1
 
53
                        log-output -t partman --pass-stdout \
 
54
                                mkfs.jfs -q $device >/dev/null
 
55
                        code=$?
 
56
                        sync
 
57
                        db_progress STOP
 
58
 
 
59
                        if [ "$code" = 0 ]; then
 
60
                                label=''
 
61
                                if [ -f $id/label ]; then
 
62
                                        label=$(cat $id/label | \
 
63
                                                sed 's/\(................\).*/\1/g')
 
64
                                fi
 
65
                                if [ "$label" ]; then
 
66
                                        jfs_tune -L "$label" $device
 
67
                                fi
 
68
                        fi
 
69
 
 
70
                        if [ "$code" != 0 ]; then
 
71
                                T=partman-basicfilesystems/create_failed
 
72
                                db_subst $T TYPE jfs
 
73
                                db_subst $T PARTITION "$num"
 
74
                                db_subst $T DEVICE $(humandev $(cat device))
 
75
                                db_input critical $T || true
 
76
                                db_go || true
 
77
                                #disable_swap
 
78
                                exit 1
 
79
                        fi
 
80
                        >$id/formatted
 
81
                        ;;
 
82
                esac
 
83
        done
 
84
done
 
85
 
 
86
#disable_swap