View | Details | Raw Unified | Return to bug 27786
Collapse All | Expand All

(-)/usr/lib/alterator/backend3/livecd-install.orig (-3 / +55 lines)
Lines 83-93 Link Here
83
# unpack squashfs image
83
# unpack squashfs image
84
#
84
#
85
85
86
no_unsquashfs=yes
87
86
do_install()
88
do_install()
87
{
89
{
88
    local img="$1";shift
90
    local img="$1";shift
89
    local dst="$1";shift
91
    local dst="$1";shift
90
    local percent1=
92
    local percent1=
93
    local unpacked=
94
    local free=
95
    local live_mount=
96
    local retval=0
97
    local blk_tot pct pct_prev dpct
98
99
if [ "x$no_unsquashfs" = "xyes" ] ; then
100
101
	    live_mount="$( mount | sed '/ type squashfs /!d; s/^.* on [ ]*\([^ ]\+\) type squashfs .*$/\1/')"
102
	    if [ "x$live_mount" = "x" ] ; then
103
		    do_notify_error "Can't find squashfs mount point"
104
		    return 1
105
	    fi
106
	    unpacked="$(du -sb ${live_mount} | sed 's,^[ ]*\([0-9]\+\).*$,\1,')"
107
	    if [ "x$unpacked" = "x" ] ; then
108
            	do_notify_error "Can't calculate unpacked squashfs size"
109
	        return 1
110
	    fi
111
    	    free=$(free_space "$dst")
112
    	    if [ $unpacked -gt $free ]; then
113
 	    	do_notify_error "No free space to unpack squashfs image"
114
	        return 1
115
	    fi
116
	    do_notify_stage install
117
           blk_tot=$[ ${unpacked} / 1024 ]
118
           tar cf - . --exclude=dev --exclude=mnt --exclude=proc --exclude=sys \
119
	    | { 
120
		cd ${dst}
121
		LANG=C LC_ALL=C tar xfvR - \
122
		| {
123
		   pct_prev=0 ; 
124
  		   while read dum blk dum  ; do
125
			blk=${blk/:/};
126
			pct=$[ $blk * 100 / $tot ];
127
			dpct=$[ $pct - $pct_prev ] ; 
128
			if test $dpct -ge 1 ; then
129
				pct_prev=$pct
130
				do_notify_status "$pct"
131
			fi
132
		   done
133
		  }
134
             }
135
	    mkdir -p -- ${dst}/{dev,mnt,proc,sys}
136
137
else # default:
91
138
92
    if ! [ -r "$img" ]; then
139
    if ! [ -r "$img" ]; then
93
        do_notify_error "Can't read squashfs image $img"
140
        do_notify_error "Can't read squashfs image $img"
Lines 106-119 Link Here
106
    percent1="$((percent1/99))"
146
    percent1="$((percent1/99))"
107
147
108
    # calculate size necessary for unpacked squashfs image
148
    # calculate size necessary for unpacked squashfs image
109
    local unpacked=$(sqfs_size "$img")
149
    unpacked=$(sqfs_size "$img")
110
150
111
    if [ -z "$unpacked" ]; then
151
    if [ -z "$unpacked" ]; then
112
        do_notify_error "Can't calculate unpacked squashfs size"
152
        do_notify_error "Can't calculate unpacked squashfs size"
113
        return 1
153
        return 1
114
    fi
154
    fi
115
   
155
   
116
    local free=$(free_space "$dst")
156
    free=$(free_space "$dst")
117
157
118
    if [ $unpacked -gt $free ]; then
158
    if [ $unpacked -gt $free ]; then
119
        do_notify_error "No free space to unpack squashfs image"
159
        do_notify_error "No free space to unpack squashfs image"
Lines 122-128 Link Here
122
162
123
    do_notify_stage install
163
    do_notify_stage install
124
164
125
    unsquashfs -force -no-progress -info -dest "$dst" "$img" 2>/dev/null |
165
  { unsquashfs -force -no-progress -info -dest "$dst" "$img" 2>/dev/null ; retval=$? ; } |
126
    {
166
    {
127
        local i=0
167
        local i=0
128
        local progress=0
168
        local progress=0
Lines 136-141 Link Here
136
             fi
176
             fi
137
        done
177
        done
138
    }
178
    }
179
    if [ $retval -ne 0 ] ; then
180
            do_notify_error "Can't read squashfs image $img"
181
            return 1
182
    fi
183
fi #end of unsquashfs ...
139
184
140
    # Set right perms on root directory of installed system
185
    # Set right perms on root directory of installed system
141
    chmod 0755 "$dst"
186
    chmod 0755 "$dst"

Return to bug 27786