Add installation without unsquashfs, but with progressbar

master
Mike Hiretsky 15 years ago
parent a733e84404
commit 624880f4d9

@ -3263,6 +3263,20 @@ sub extract{
return 1;
};
#------------------------------------------------------------------------------
# Выполнить копирование с прогресс баром если возможно
#------------------------------------------------------------------------------
sub copy_with_progress{
my ($from, $to, $count) = @_;
if( $data{run_bar} ne "cp" && $count > 0 ) {
return system("$data{path} cp -av $from/* $to/ | ".
"cut -b 1000 | $data{run_bar} -ns -nth -nc -s $count >/dev/null");
}
else {
return system("$data{path} cp -a $from/* $to/");
}
}
#------------------------------------------------------------------------------
# Выполним распаковку
#------------------------------------------------------------------------------
@ -3276,10 +3290,11 @@ sub extract_exec{
}else{
printmes(" ".gettext('Unpack')); printmes(" $data{stage}... ");
if($data{stage} !~m/iso$/){
$unpack = "$data{patunsquashfsh} tar -xjpf $data{stagepath}/$data{stage} -C $data{mount}";
}else{
$unpack = "$data{path} unsquashfs -d $data{mount} -f /mnt/cdrom/livecd.squashfs";
$unpack = "$data{path} tar -xjpf $data{stagepath}/$data{stage} -C $data{mount}";
}
# else{
# $unpack = "$data{path} unsquashfs -d $data{mount} -f /mnt/cdrom/livecd.squashfs";
# }
}
#путь к squashfs в случае установки из ISO файла или с CD-ROM
@ -3298,9 +3313,26 @@ sub extract_exec{
#установка с ISO файла на флешку
return system("$data{path} rsync -a /mnt/cdrom/ $data{mount}");
}elsif(!$data{scratch_ws}){
$bar ++; printmes("\n");
my $install_from;
if($data{linux} =~ m/iso$/ || $data{stage} =~ m/iso$/ ){
system "$data{path} mkdir /mnt/squashfs && mount -o loop $squashfs /mnt/squashfs";
$install_from = "/mnt/squashfs";
}
else {
$install_from = "/mnt/livecd";
}
#установка с ISO файла на жесткий диск ($data{type} = "hdd" или "usb-hdd")
return system("$data{path} unsquashfs -d $data{mount} -f $squashfs");
my $count=int(`sed -rn \"\s/^files=(.*)\$/\\1/p\" $install_from/etc/calculate/calculate.ini`);
if($count > 0 ) {
$bar ++; printmes("\n");
} else {
$bar = 0;
}
my $res = copy_with_progress($install_from,$data{mount},$count);
if($install_from == "/mnt/squashfs"){
system "$data{path} umount $install_from && rmdir $install_from";
}
return $res;
}elsif($data{scratch_ws}){
if($data{run_bar} =~m/bar/){$bar ++; printmes("\n");}
#установка путем копирования ISO файла на жесткий диск (режим установки scratch)
@ -5291,6 +5323,16 @@ sub createiso{
$squashfile = "/mnt/flash/$data{squash_cur}"
}
printmes(" ".gettext('Calculating files for packing')); printmes("...");
my $filesnum=int(`/usr/bin/find $data{tmpdir}/livecd/calculate/ | wc -l`);
my $calc_ini="$data{tmpdir}/livecd/calculate/etc/calculate/calculate.ini";
system(qq{ grep ^files= $calc_ini &>/dev/null &&
sed -ri "s/(^files=)(.*)\$/\\1$filesnum/" $calc_ini ||
echo "files=$filesnum" >>$calc_ini
}
);
printmes(" ".gettext('done')); printmes(".\n");
printmes(" ".gettext('Packing system into squashfs format')); printmes("...");
if(system("/usr/bin/mksquashfs $data{tmpdir}/livecd/calculate/ $squashfile &>/dev/null")){
printmes(" ".gettext('error').".\n");

Loading…
Cancel
Save