Example share var.

This commit is contained in:
zyppe 2024-10-19 19:05:03 +08:00
parent ace0efceee
commit 24e93a17ff
10 changed files with 28 additions and 37 deletions

1
.gitattributes vendored Normal file
View file

@ -0,0 +1 @@
* text eol=lf

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.vscode/

20
lib/NBuild/CommonFunc.pm Normal file
View file

@ -0,0 +1,20 @@
#!/usr/bin/perl
package NBuild::Func;
use strict;
use warnings;
use v5.10;
use NBuild::ShareVar;
sub build_host_arch {
}
sub detect_cache_dir {
if(-w '/'){
$ShareVar::CACHE_DIR='/var/cache/build';
}else {
$ShareVar::CACHE_DIR='~/.cache/build';
}
}
1;

View file

@ -1,11 +0,0 @@
#!/usr/bin/perl
package NBuild;
use strict;
use warnings;
use v5.10;
sub buildroot_umount {
}
1;

View file

@ -1,5 +1,5 @@
#!/usr/bin/perl
package NBuild;
package NBuild::NBuildFunc;
use strict;
use warnings;

View file

@ -1,8 +1,9 @@
#!/usr/bin/perl
package NBuild;
package NBuild::ShareVar;
use strict;
use warnings;
use v5.10;
our $CACHE_DIR;
1;

View file

@ -1,8 +0,0 @@
#!/usr/bin/perl
package NBuild;
use strict;
use warnings;
use v5.10;
1;

View file

@ -1,8 +0,0 @@
#!/usr/bin/perl
package NBuild;
use strict;
use warnings;
use v5.10;
1;

View file

@ -1,7 +0,0 @@
#!/usr/bin/perl
use strict;
use warnings;
use v5.10;
print $ARGV[1];

4
nbuild
View file

@ -13,12 +13,14 @@ use strict;
use warnings;
use v5.10;
use NBuild::Func;
use File::Path qw(rmtree mkpath);
use Sys::Hostname;
use Log::Log4perl;
use File::Path;
use NBuild::CommonFunc;
use NBuild::NBuildFunc;
=todo
# some VMs do not allow to specify the init process...
if test "$0" = /sbin/init; then