mirror of
https://github.com/BioArchLinux/iso.git
synced 2025-03-10 06:14:01 +00:00
polish: use docker instead of host
This commit is contained in:
parent
3810c6ae64
commit
e23912d98b
1 changed files with 46 additions and 36 deletions
82
gen_iso.perl
82
gen_iso.perl
|
@ -9,18 +9,32 @@ sub update_iso_directory {
|
||||||
system('git', 'pull');
|
system('git', 'pull');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub run_docker_container {
|
||||||
|
system('docker', 'run', '-itd', '--privileged', '--name', 'bio', 'bioarchlinux/bioarchlinux', '/bin/bash');
|
||||||
|
}
|
||||||
|
|
||||||
|
sub system_setup {
|
||||||
|
system('docker', 'exec', '-i', 'bio', 'sh', '-c', 'ln -sf /usr/share/zoneinfo/GMT /etc/localtime');
|
||||||
|
system('docker', 'exec', '-i', 'bio', 'sh', '-c', 'pacman -Syu --noconfirm');
|
||||||
|
system('docker', 'exec', '-i', 'bio', 'sh', '-c', 'pacman -S archiso rsync --noconfirm');
|
||||||
|
}
|
||||||
|
|
||||||
|
sub transfer_docker {
|
||||||
|
my ($subdir, $dest_dir) = @_;
|
||||||
|
system('docker', 'cp', $dest_dir . $subdir, "bio:/root/");
|
||||||
|
}
|
||||||
|
|
||||||
sub prepare_files {
|
sub prepare_files {
|
||||||
my ($src_path) = @_;
|
my ($src_path) = @_;
|
||||||
|
|
||||||
# Download bio mirrorlist file
|
# Download bio mirrorlist file
|
||||||
system('curl', '-L', '-o', $src_path . '/bio/airootfs/etc/pacman.d/mirrorlist.bio', 'https://raw.githubusercontent.com/BioArchLinux/mirror/main/mirrorlist.bio');
|
system('docker', 'exec', '-i', 'bio', 'sh', '-c', "cd /root/bio/airootfs/etc/pacman.d && curl -L -o mirrorlist.bio https://raw.githubusercontent.com/BioArchLinux/mirror/main/mirrorlist.bio")
|
||||||
|
|
||||||
# Download mirrorlist file
|
|
||||||
system('curl', '-L', '-o', $src_path . '/bio/airootfs/etc/pacman.d/mirrorlist', 'https://gitlab.archlinux.org/archlinux/packaging/packages/pacman-mirrorlist/-/raw/main/mirrorlist');
|
|
||||||
|
|
||||||
|
# Download mirrorlist file
|
||||||
|
system('curl', '-L', '-o', $src_path . 'mirrorlist' , 'https://gitlab.archlinux.org/archlinux/packaging/packages/pacman-mirrorlist/-/raw/main/mirrorlist');
|
||||||
# Uncomment Worldwide mirrors
|
# Uncomment Worldwide mirrors
|
||||||
my @mirrorlist_lines = ();
|
my @mirrorlist_lines = ();
|
||||||
open(my $fh, '<', $src_path . '/bio/airootfs/etc/pacman.d/mirrorlist') or die "Can't open mirrorlist file: $!";
|
open(my $fh, '<', $src_path . 'mirrorlist') or die "Can't open mirrorlist file: $!";
|
||||||
while (my $line = <$fh>) {
|
while (my $line = <$fh>) {
|
||||||
if ($line =~ /^## Worldwide/) {
|
if ($line =~ /^## Worldwide/) {
|
||||||
push @mirrorlist_lines, $line;
|
push @mirrorlist_lines, $line;
|
||||||
|
@ -33,28 +47,22 @@ sub prepare_files {
|
||||||
open($fh, '>', $src_path . '/bio/airootfs/etc/pacman.d/mirrorlist') or die "Can't write mirrorlist file: $!";
|
open($fh, '>', $src_path . '/bio/airootfs/etc/pacman.d/mirrorlist') or die "Can't write mirrorlist file: $!";
|
||||||
print $fh @mirrorlist_lines;
|
print $fh @mirrorlist_lines;
|
||||||
close($fh);
|
close($fh);
|
||||||
|
# transfer mirrorlist
|
||||||
|
system('docker', 'cp', $src_path . 'mirrorlist' , "bio:/root/bio/airootfs/etc/pacman.d/")
|
||||||
|
# clean mirrorlist
|
||||||
|
system('rm', $src_path . 'mirrorlist')
|
||||||
|
|
||||||
# Download keyring files
|
# Download keyring files
|
||||||
system('curl', '-L', '-o', $src_path . '/bio/airootfs/usr/share/pacman/keyrings/bioarchlinux-trusted', 'https://raw.githubusercontent.com/BioArchLinux/keyring/main/bioarchlinux-trusted');
|
system('docker', 'exec', '-i', 'bio', 'sh', '-c', "cd /root/bio/airootfs/usr/share/pacman/keyrings && curl -L -o bioarchlinux-trusted https://raw.githubusercontent.com/BioArchLinux/keyring/main/bioarchlinux-trusted")
|
||||||
system('curl', '-L', '-o', $src_path . '/bio/airootfs/usr/share/pacman/keyrings/bioarchlinux.gpg', 'https://raw.githubusercontent.com/BioArchLinux/keyring/main/bioarchlinux.gpg');
|
system('docker', 'exec', '-i', 'bio', 'sh', '-c', "cd /root/bio/airootfs/usr/share/pacman/keyrings && curl -L -o bioarchlinux.gpg https://raw.githubusercontent.com/BioArchLinux/keyring/main/bioarchlinux.gpg")
|
||||||
|
|
||||||
# Copy pacman.conf file
|
# Copy pacman.conf file
|
||||||
system('cp', $src_path . '/bio/pacman.conf', $src_path . '/bio/airootfs/etc/');
|
system('docker', 'exec', '-i', 'bio', 'sh', '-c', "cp ${src_path}/bio/pacman.conf ${src_path}/bio/airootfs/etc/");
|
||||||
}
|
}
|
||||||
|
|
||||||
sub copy_template_files {
|
sub copy_template_files {
|
||||||
my ($src, $dst) = @_;
|
my ($src, $dst) = @_;
|
||||||
system('rsync', '-a', '--links', '--ignore-existing', "$src/", "$dst/");
|
system('docker', 'exec', '-i', 'bio', 'sh', '-c', "rsync -a --links --ignore-existing $src/ $dst/");
|
||||||
}
|
|
||||||
|
|
||||||
sub run_docker_container {
|
|
||||||
system('docker', 'run', '-itd', '--privileged', '--name', 'bio', 'bioarchlinux/bioarchlinux', '/bin/bash');
|
|
||||||
}
|
|
||||||
|
|
||||||
sub system_setup {
|
|
||||||
system('docker', 'exec', '-i', 'bio', 'sh', '-c', 'ln -sf /usr/share/zoneinfo/GMT /etc/localtime');
|
|
||||||
system('docker', 'exec', '-i', 'bio', 'sh', '-c', 'pacman -Syu --noconfirm');
|
|
||||||
system('docker', 'exec', '-i', 'bio', 'sh', '-c', 'pacman -S archiso --noconfirm');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub use_mkarchiso {
|
sub use_mkarchiso {
|
||||||
|
@ -62,7 +70,6 @@ sub use_mkarchiso {
|
||||||
my $iso_filename = "${iso_name}-" . `date "+%Y.%m.%d"` . "-x86_64.iso";
|
my $iso_filename = "${iso_name}-" . `date "+%Y.%m.%d"` . "-x86_64.iso";
|
||||||
$iso_filename =~ s/[^\x20-\x7E]//g;
|
$iso_filename =~ s/[^\x20-\x7E]//g;
|
||||||
chomp($iso_filename);
|
chomp($iso_filename);
|
||||||
system('docker', 'cp', $dest_dir . $subdir, "bio:/root/");
|
|
||||||
system('docker', 'exec', '-i', 'bio', 'sh', '-c', "cd /root/$subdir && mkarchiso -C pacman.conf -v .");
|
system('docker', 'exec', '-i', 'bio', 'sh', '-c', "cd /root/$subdir && mkarchiso -C pacman.conf -v .");
|
||||||
system('docker', 'cp', "bio:/root/" . ${subdir} . "/out/". ${iso_filename}, $dest_dir);
|
system('docker', 'cp', "bio:/root/" . ${subdir} . "/out/". ${iso_filename}, $dest_dir);
|
||||||
}
|
}
|
||||||
|
@ -72,17 +79,10 @@ sub use_mkarchiso_bt {
|
||||||
my $iso_filename = "${iso_name}-bootstrap" . `date "+%Y.%m.%d"` . "-x86_64.tar.gz";
|
my $iso_filename = "${iso_name}-bootstrap" . `date "+%Y.%m.%d"` . "-x86_64.tar.gz";
|
||||||
$iso_filename =~ s/[^\x20-\x7E]//g;
|
$iso_filename =~ s/[^\x20-\x7E]//g;
|
||||||
chomp($iso_filename);
|
chomp($iso_filename);
|
||||||
system('docker', 'cp', $dest_dir . $subdir, "bio:/root/");
|
|
||||||
system('docker', 'exec', '-i', 'bio', 'sh', '-c', "cd /root/$subdir && mkarchiso -C pacman.conf -m bootstrap -v .");
|
system('docker', 'exec', '-i', 'bio', 'sh', '-c', "cd /root/$subdir && mkarchiso -C pacman.conf -m bootstrap -v .");
|
||||||
system('docker', 'cp', "bio:/root/" . ${subdir} . "/out/". ${iso_filename}, $dest_dir);
|
system('docker', 'cp', "bio:/root/" . ${subdir} . "/out/". ${iso_filename}, $dest_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub clean_system {
|
|
||||||
system('docker', 'stop', 'bio');
|
|
||||||
system('docker', 'rm', 'bio');
|
|
||||||
system('docker', 'rmi', '--force', 'bioarchlinux/bioarchlinux');
|
|
||||||
}
|
|
||||||
|
|
||||||
sub gpg_sign {
|
sub gpg_sign {
|
||||||
my ($file_path) = @_;
|
my ($file_path) = @_;
|
||||||
$file_path =~ s/[^\x20-\x7E]//g;
|
$file_path =~ s/[^\x20-\x7E]//g;
|
||||||
|
@ -101,6 +101,12 @@ sub sum_sign {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub clean_system {
|
||||||
|
system('docker', 'stop', 'bio');
|
||||||
|
system('docker', 'rm', 'bio');
|
||||||
|
system('docker', 'rmi', '--force', 'bioarchlinux/bioarchlinux');
|
||||||
|
}
|
||||||
|
|
||||||
sub remove_files {
|
sub remove_files {
|
||||||
my ($directory_path) = @_;
|
my ($directory_path) = @_;
|
||||||
unlink glob $directory_path . '/*';
|
unlink glob $directory_path . '/*';
|
||||||
|
@ -126,26 +132,27 @@ my $cdpath = '/usr/share/lilac/Repo/iso';
|
||||||
# Update
|
# Update
|
||||||
update_iso_directory( $abpath );
|
update_iso_directory( $abpath );
|
||||||
|
|
||||||
# Call prepare_files function before copying templates
|
|
||||||
prepare_files( $abpath );
|
|
||||||
|
|
||||||
# Copy template files
|
|
||||||
copy_template_files( $abpath . '/bio', $abpath . '/bio-wayfire');
|
|
||||||
|
|
||||||
# Run
|
# Run
|
||||||
run_docker_container();
|
run_docker_container();
|
||||||
|
|
||||||
# System
|
# System
|
||||||
system_setup();
|
system_setup();
|
||||||
|
|
||||||
|
# transfer
|
||||||
|
transfer_docker('bio', $abpath);
|
||||||
|
transfer_docker('bio-wayfire', $abpath);
|
||||||
|
|
||||||
|
# Call prepare_files function before copying templates
|
||||||
|
prepare_files( $abpath );
|
||||||
|
|
||||||
|
# Copy template files
|
||||||
|
copy_template_files( 'bio:/root/bio', 'bio:/root/bio-wayfire');
|
||||||
|
|
||||||
# Use mkarchiso
|
# Use mkarchiso
|
||||||
use_mkarchiso('bio', 'bioarchlinux', $abpath);
|
use_mkarchiso('bio', 'bioarchlinux', $abpath);
|
||||||
use_mkarchiso('bio-wayfire', 'bioarchlinux-wayfire', $abpath);
|
use_mkarchiso('bio-wayfire', 'bioarchlinux-wayfire', $abpath);
|
||||||
use_mkarchiso_bt('bio', 'bioarchlinux', $abpath);
|
use_mkarchiso_bt('bio', 'bioarchlinux', $abpath);
|
||||||
|
|
||||||
# Clean system
|
|
||||||
clean_system();
|
|
||||||
|
|
||||||
# GPG Sign
|
# GPG Sign
|
||||||
gpg_sign( $abpath . '/bioarchlinux-' . `date "+%Y.%m.%d"` . '-x86_64.iso');
|
gpg_sign( $abpath . '/bioarchlinux-' . `date "+%Y.%m.%d"` . '-x86_64.iso');
|
||||||
gpg_sign( $abpath . '/bioarchlinux-wayfire-' . `date "+%Y.%m.%d"` . '-x86_64.iso');
|
gpg_sign( $abpath . '/bioarchlinux-wayfire-' . `date "+%Y.%m.%d"` . '-x86_64.iso');
|
||||||
|
@ -156,6 +163,9 @@ sum_sign( $abpath . '/bioarchlinux-' . `date "+%Y.%m.%d"` . '-x86_64.iso');
|
||||||
sum_sign( $abpath . '/bioarchlinux-wayfire-' . `date "+%Y.%m.%d"` . '-x86_64.iso');
|
sum_sign( $abpath . '/bioarchlinux-wayfire-' . `date "+%Y.%m.%d"` . '-x86_64.iso');
|
||||||
sum_sign( $abpath . 'bioarchlinux-bootstrap-' . `date "+%Y.%m.%d"` . '-x86_64.tar.gz');
|
sum_sign( $abpath . 'bioarchlinux-bootstrap-' . `date "+%Y.%m.%d"` . '-x86_64.tar.gz');
|
||||||
|
|
||||||
|
# Clean system
|
||||||
|
clean_system();
|
||||||
|
|
||||||
# Remove
|
# Remove
|
||||||
remove_files( $cdpath );
|
remove_files( $cdpath );
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue