|
|
|
@ -22,7 +22,7 @@ use Time::Local;
|
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
my %data; #объявим хэш переменных
|
|
|
|
|
$data{"calcver"} = "1.2.1";
|
|
|
|
|
$data{"calcver"} = "1.2.2";
|
|
|
|
|
|
|
|
|
|
#Определим путь к программе
|
|
|
|
|
if(!getpath()){exit;};
|
|
|
|
@ -3700,33 +3700,37 @@ sub profile{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#сохраним обработанный файл в директории установки
|
|
|
|
|
my $fname = $allocation; $fname=~m/^(.*\/)([^\/]+)$/;
|
|
|
|
|
$allocation=~m/^(.*\/)([^\/]+)$/;
|
|
|
|
|
my $namepath = $1;
|
|
|
|
|
my $nameprof = $2;
|
|
|
|
|
my $nameorig;
|
|
|
|
|
|
|
|
|
|
if($data{pass} eq 'install' && $data{scratch_ws} &&
|
|
|
|
|
(substr($2,0,1) eq "~" || substr($2,0,1) eq "^")
|
|
|
|
|
(substr($nameprof,0,1) eq "~" || substr($nameprof,0,1) eq "^")
|
|
|
|
|
){
|
|
|
|
|
#извлечем файл для объединения
|
|
|
|
|
unsquash(substr($1.substr($2,1), length($data{'chroot'}.$data{scratch_ws})));
|
|
|
|
|
unsquash(substr($namepath.substr($nameprof,1), length($data{'chroot'}.$data{scratch_ws})));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(substr($2,0,1) eq "^"){
|
|
|
|
|
|
|
|
|
|
if(substr($nameprof,0,1) eq "^"){
|
|
|
|
|
$nameorig = substr($nameprof,1);
|
|
|
|
|
#допишем в конец файла без значка
|
|
|
|
|
open(C, ">>".$1.substr($2,1)); print C @conf; close(C);
|
|
|
|
|
}elsif(substr($2,0,1) eq "~"){
|
|
|
|
|
open(C, ">>".$namepath.$nameorig); print C @conf; close(C);
|
|
|
|
|
}elsif(substr($nameprof,0,1) eq "~"){
|
|
|
|
|
$nameorig = substr($nameprof,1);
|
|
|
|
|
#подменим переменные конфигурационного файла новыми значениями
|
|
|
|
|
open(C, $1.substr($2,1)); my (@original) = <C>; close(C); #считаем оригинальный файл
|
|
|
|
|
open(C, $namepath.$nameorig); my (@original) = <C>; close(C); #считаем оригинальный файл
|
|
|
|
|
my @save = substitution([@original], [@conf]);
|
|
|
|
|
open(C, ">".$1.substr($2,1)); print C @save; close(C);
|
|
|
|
|
}elsif(substr($2,-5) eq ".diff"){
|
|
|
|
|
open(C, ">".$namepath.substr($nameprof,1)); print C @save; close(C);
|
|
|
|
|
}elsif(substr($nameprof,-5) eq ".diff"){
|
|
|
|
|
$nameorig = substr($nameprof,0,-5);
|
|
|
|
|
if($data{pass} eq 'install' && $data{scratch_ws}){
|
|
|
|
|
#извлечем файл для объединения
|
|
|
|
|
unsquash(substr($allocation, length($data{'chroot'}.$data{scratch_ws}),-5));
|
|
|
|
|
}
|
|
|
|
|
my $root = $1;
|
|
|
|
|
my $patch = $2;
|
|
|
|
|
my $file = substr($2,0,-5);
|
|
|
|
|
open(C, ">$data{tmpdir}/$patch"); print C @conf; close(C);
|
|
|
|
|
foreach(`LANG=C patch -N -r $data{tmpdir}/$file.rej --no-backup-if-mismatch $root$file $data{tmpdir}/$patch`){
|
|
|
|
|
open(C, ">$data{tmpdir}/$nameprof"); print C @conf; close(C);
|
|
|
|
|
foreach(`LANG=C patch -N -r $data{tmpdir}/$nameorig.rej --no-backup-if-mismatch $nameprof$nameorig $data{tmpdir}/$nameprof`){
|
|
|
|
|
if(m/FAILED/i){
|
|
|
|
|
printmes("\n".gettext('Error patching from')." $data{file}{name}\n");
|
|
|
|
|
last;
|
|
|
|
@ -3739,9 +3743,9 @@ sub profile{
|
|
|
|
|
#сменим права доступа
|
|
|
|
|
if(substr($allocation,-5) ne ".diff"){
|
|
|
|
|
if($allocation=~m|/ssh/|){
|
|
|
|
|
system "$data{path} chmod 600 $allocation";
|
|
|
|
|
system "$data{path} chmod 600 $namepath$nameorig";
|
|
|
|
|
}elsif($allocation=~m|/etc/sudoers|){
|
|
|
|
|
system "$data{path} chmod 0440 $allocation";
|
|
|
|
|
system "$data{path} chmod 0440 $namepath$nameorig";
|
|
|
|
|
}elsif( $allocation=~m|/config/kdm/X| ||
|
|
|
|
|
$allocation=~m|/etc/cron\.| ||
|
|
|
|
|
$allocation=~m|/etc/init\.d/| ||
|
|
|
|
@ -3749,13 +3753,12 @@ sub profile{
|
|
|
|
|
$allocation=~m|/sbin/| ||
|
|
|
|
|
$allocation=~m|\.sh$|
|
|
|
|
|
){
|
|
|
|
|
system "$data{path} chmod 755 $allocation";
|
|
|
|
|
system "$data{path} chmod 755 $namepath$nameorig";
|
|
|
|
|
} }
|
|
|
|
|
}elsif(`$data{path} file "$_" | grep empty`){
|
|
|
|
|
system "$data{path} rm -f \"$allocation\"";
|
|
|
|
|
if($data{scratch_ws} && $data{pass} eq "install"){
|
|
|
|
|
$allocation=~m/^(.+\/)([^\/]+)$/;
|
|
|
|
|
system "$data{path} touch \"$1.wh.$2\"";
|
|
|
|
|
system "$data{path} touch \"$namepath.wh.$nameorig\"";
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
#перенесем без обработки бинарный файл
|
|
|
|
@ -4065,14 +4068,15 @@ sub configure{
|
|
|
|
|
|
|
|
|
|
#если система собирается не из CLS
|
|
|
|
|
if($data{stage} !~m/iso$/){
|
|
|
|
|
#chroot groupadd games
|
|
|
|
|
printmes(" ".gettext('Execute')); printmes(" groupadd -g 35 games...");
|
|
|
|
|
if(system "$data{path} chroot $data{chroot} /usr/sbin/groupadd -g 35 games &>/dev/null"){
|
|
|
|
|
printmes(" ".gettext('error')."!\n");
|
|
|
|
|
umountbuild(); return '';
|
|
|
|
|
}else{
|
|
|
|
|
printmes(" ".gettext('done').".\n");
|
|
|
|
|
}
|
|
|
|
|
if($data{system} eq 'desktop'){
|
|
|
|
|
#chroot groupadd games
|
|
|
|
|
printmes(" ".gettext('Execute')); printmes(" groupadd -g 35 games...");
|
|
|
|
|
if(system "$data{path} chroot $data{chroot} /usr/sbin/groupadd -g 35 games &>/dev/null"){
|
|
|
|
|
printmes(" ".gettext('error')."!\n");
|
|
|
|
|
umountbuild(); return '';
|
|
|
|
|
}else{
|
|
|
|
|
printmes(" ".gettext('done').".\n");
|
|
|
|
|
} }
|
|
|
|
|
|
|
|
|
|
#chroot groupadd plugdev
|
|
|
|
|
printmes(" ".gettext('Execute')); printmes(" groupadd -g 440 plugdev...");
|
|
|
|
@ -4091,26 +4095,8 @@ sub configure{
|
|
|
|
|
}else{
|
|
|
|
|
printmes(" ".gettext('done').".\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#chroot groupadd vboxusers
|
|
|
|
|
printmes(" ".gettext('Execute')); printmes(" groupadd -g 442 vboxusers...");
|
|
|
|
|
if(system "$data{path} chroot $data{chroot} /usr/sbin/groupadd -g 442 vboxusers &>/dev/null"){
|
|
|
|
|
printmes(" ".gettext('error')."!\n");
|
|
|
|
|
umountbuild(); return '';
|
|
|
|
|
}else{
|
|
|
|
|
printmes(" ".gettext('done').".\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if($data{calculate} eq "CLD"){
|
|
|
|
|
printmes(" ".gettext('Execute')); printmes(" useradd vboxadd...");
|
|
|
|
|
if(system "$data{path} chroot $data{chroot} /usr/sbin/useradd -d /var/run/vboxadd -g 1 -c \"added by Calculate for virtualbox\" -s /bin/sh vboxadd &>/dev/null"){
|
|
|
|
|
printmes(" ".gettext('error')."!\n");
|
|
|
|
|
umountbuild(); return '';
|
|
|
|
|
}else{
|
|
|
|
|
printmes(" ".gettext('done').".\n");
|
|
|
|
|
} }
|
|
|
|
|
|
|
|
|
|
#chroot useradd p2p
|
|
|
|
|
if($data{calculate} eq "CDS"){
|
|
|
|
|
printmes(" ".gettext('Execute')); printmes(" useradd -g 100 p2p...");
|
|
|
|
@ -4511,7 +4497,7 @@ sub packsystem{
|
|
|
|
|
){
|
|
|
|
|
#Добавим пользователя guest
|
|
|
|
|
system "$data{path} chroot $data{'chroot'} groupadd --gid 999 guest";
|
|
|
|
|
system "$data{path} chroot $data{'chroot'} useradd --uid 999 --gid 999 -m --home-dir /home/guest --shell /bin/bash --groups audio,cdrom,plugdev,vboxusers,video,wheel guest";
|
|
|
|
|
system "$data{path} chroot $data{'chroot'} useradd --uid 999 --gid 999 -m --home-dir /home/guest --shell /bin/bash --groups audio,cdrom,plugdev,video,wheel guest";
|
|
|
|
|
system "$data{path} chroot $data{'chroot'} chmod 0700 /home/guest";
|
|
|
|
|
|
|
|
|
|
#Установим пароль пользователя guest
|
|
|
|
@ -4632,8 +4618,9 @@ sub packsystem{
|
|
|
|
|
#Создадим архив системы
|
|
|
|
|
printmes(" ".gettext('Create system archive file')); printmes("...");
|
|
|
|
|
chdir($data{'chroot'});
|
|
|
|
|
`$data{path} rm -f $data{linuxdir}/".lc($data{'calculate'})."-$data{linuxver}-$data{march}.tar.7z`;
|
|
|
|
|
if(system("$data{path} tar cf - . 2>/dev/null | 7za a -si $data{linuxdir}/".lc($data{'calculate'})."-$data{linuxver}-$data{march}.tar.7z >/dev/null")){
|
|
|
|
|
my $pathtar = "$data{linuxdir}/".lc($data{'calculate'})."-$data{linuxver}-$data{march}.tar.7z";
|
|
|
|
|
system "$data{path} rm -f $pathtar"; #удалим если такой файл есть
|
|
|
|
|
if(system("$data{path} tar cf - . 2>/dev/null | 7za a -si $pathtar >/dev/null")){
|
|
|
|
|
printmes(" ".gettext('error').".\n");
|
|
|
|
|
return "";
|
|
|
|
|
}else{
|
|
|
|
|