4 Commits

Author SHA1 Message Date
Jay Larson
8c66f6df9f Re-added config.tar.gz to Makefile.snaplinux among other minor tweaks 2020-08-21 14:46:18 -05:00
Jay Larson
2dce4dc009 Corrected version number 2020-08-16 16:52:35 -05:00
Jay Larson
b2fa82dd6f Removed temp files and created 0.0alpha1 branch 2020-08-16 16:32:54 -05:00
Jay Larson
afcac9264c Delete sl-0.15-0.slp 2020-07-20 16:00:41 +00:00
18 changed files with 24 additions and 6303 deletions

View File

@@ -1,57 +0,0 @@
#
# These packages are the bare minimum necessary for a functional system.
# This file is required for snapinstall to function, so don't delete it!
#
snap-base
dash
texinfo
glibc
coreutils
libacl
libattr
libcap
ncurses
readline
tzdata
perl
binutils
bzip2
cpio
dhclient
e2fsprogs
ex
findutils
gawk
gdbm
gmp
grep
groff
gzip
iana-etc
iftools
inetutils
iproute2
kmod
less
libgcc
libpipeline
libstdc++
libzfs
linux-firmware
man-db
mpfr
net-tools
procps-ng
psmisc
sed
shadow
tar
snap
initscripts
sysklogd
sysvinit
tar
util-linux
xz
zlib

View File

@@ -1,63 +0,0 @@
#
# This is a basic server install which includes openssh-server along with
# other packages typically expected on servers
#
binutils
bzip2
coreutils
cpio
cron
dash
dhclient
e2fsprogs
eudev
ex
findutils
gawk
gdbm
glibc
gmp
grep
groff
grub
gzip
iana-etc
iftools
inetutils
initscripts
iproute2
kmod
less
libacl
libattr
libcap
libgcc
libpipeline
libstdc++
libzfs
linux
man-db
mkinitramfs
mpfr
ncurses
net-tools
openssh-client
openssh-server
perl
procps-ng
psmisc
readline
rsyslog
sed
shadow
snap
snap-base
sysvinit
tar
tar
texinfo
tzdata
util-linux
xz
zlib

View File

@@ -1,45 +0,0 @@
#!/bin/sh
### PLACEHOLDER ###
# This script needs to provide things like network setup perhaps
# This code should help with setting up the network interfaces
#
#my $dir = '/sys/class/net';
#my $devs = {};
#
#opendir( my $dh, $dir ) || die( $! );
#
#while ( readdir( $dh ) ) {
# my $link = readlink( "$dir/$_" ) || next;
#
# if ( $link =~ /virtual/ ) {
# next;
# }
#
# open( my $fh, "$dir/$_/address" ) || die( $! );
# $devs->{$_}{'mac'} = <$fh>;
# close( $fh );
#
# chomp( $devs->{$_}{'mac'} );
# }
#
#foreach my $dev ( sort( keys( %$devs ) ) ) {
# print "$dev - $devs->{$dev}{'mac'}\n";
# }
if [ -n "$HOSTNAME" ]; then
cat > /etc/hostname <<EOF
$HOSTNAME
EOF
fi
if [ -n "$ROOTPW" ]; then
chpasswd <<EOF
root:$ROOTPW
EOF
fi
if [ -n "$TZFILE" ]; then
ln -s "$TZFILE" /etc/localtime
fi

File diff suppressed because it is too large Load Diff

View File

@@ -1,195 +0,0 @@
#!/usr/bin/perl
use Data::Dumper;
use strict;
use warnings;
use Snap;
setup();
my $conf = readconf();
my $templates = templates( $conf );
my $template = $ARGV[0] || Snap->error( 1, 'Failed to supply template' );
my $sources = Snap::Sources->new( $conf->{'sources'} );
my @basepkgs = qw( snap-base coreutils dash );
my @packages = ();
my $rootfs;
my $preinst;
my $rootpw;
my $postinst;
my $pid;
my $stat;
my $virtfs;
my $dialog;
if ( ! $snap->{'target'} ) {
Snap->error( -1, 'A target must be specified with -t' );
}
if ( ! $templates->{$template} ) {
Snap->error( -1, "$template: Invalid template" );
}
$rootfs = "$conf->{'snapinstall'}{'templatedir'}/$template/rootfs";
$preinst = "$conf->{'snapinstall'}{'templatedir'}"
. "/$template/preinst";
$postinst = "$conf->{'snapinstall'}{'templatedir'}"
. "/$template/postinst";
if ( -f $preinst ) {
pipe( my $reader, my $writer ) ||
Snap->error( int( $! ), "pipe(): $!" );
if ( $pid = fork() ) {
close( $writer );
}
else {
close( $reader );
open( STDERR, '>&', $writer );
exec( $preinst ) || die( $! );
exit;
}
waitpid( $pid, 0 );
$stat = $? >> 8;
while ( readline( $reader ) ) {
if ( $_ =~ /^([a-zA-Z]+)=\s*(.*)$/ ) {
$ENV{$1} = $2;
}
}
close( $reader );
}
$sources->readpkgs();
foreach my $pkgname ( @basepkgs ) {
my $package = $sources->latest( $pkgname );
$package->depends( $sources, \@packages );
if ( ! grep( $_ eq $package->{'name'}, @packages ) ) {
push( @packages, $package );
}
}
foreach my $pkgname ( @{$templates->{$template}{'packages'}} ) {
my $package = $sources->latest( $pkgname ) ||
Snap->error( 1, "$pkgname: Unable to find package" );
if ( grep( $_->{'name'} eq $pkgname, @packages ) ) {
next;
}
$package->depends( $sources, \@packages );
if ( ! grep( $_ eq $package->{'name'}, @packages ) ) {
push( @packages, $package );
}
}
open( $dialog, "|dialog --title ' Downloading Packages ' --gauge '' 8 70 0" );
select( $dialog );
foreach my $package ( @packages ) {
if ( $package->{'path'} =~ /https*:\/\// ) {
( my $filename = $package->{'path'} ) =~ s/.*\///;
if ( -f $snap->{'pkgdir'} . "/$filename" ) {
$package->{'path'} = $snap->{'pkgdir'} . "/$filename";
}
elsif ( -f "/var/lib/snap/packages/$filename" ) {
$package->{'path'} = "/var/lib/snap/packages/$filename";
}
else {
Snap->httpget( $package->{'path'},
"$snap->{'pkgdir'}/$filename", 0644,
{ dialog => 1 } );
$package->{'path'} = "$snap->{'pkgdir'}/$filename";
}
}
}
select( STDOUT );
close( $dialog );
if ( -d $rootfs && ! Snap->dirempty( $rootfs ) ) {
if ( $pid = fork() ) {
waitpid( $pid, 0 );
$stat = $? >> 8;
}
else {
# print "\nCopying rootfs files\n";
# exec( "cp -va '$rootfs'/* $snap->{'target'}" );
exec( "cp -a '$rootfs'/* $snap->{'target'}" );
}
if ( $stat ) {
Snap->error( $stat, "Failed to copy rootfs" );
}
}
open( $dialog, "|dialog --title ' Installing Packages ' --gauge '' 8 70 0" );
select( $dialog );
foreach my $package ( @packages ) {
if ( ! $virtfs ) {
$virtfs = virtfs( 'mount' );
}
# print "\n";
$package->install( $sources, { dialog => 1 } );
}
select( STDOUT );
close( $dialog );
print "\033[2J";
print "\033[0;0H";
trigger();
if ( -f $postinst ) {
my $tmpscript = "/var/lib/snap/postinst";
open( my $fh, '<', $postinst ) || Snap->error( int( $! ),
"Failed to open $postinst" );
open( my $wh, '>', "$snap->{'target'}/$tmpscript" ) ||
Snap->error( int( $! ), "Failed to open $tmpscript" );
chmod( 0755, "$snap->{'target'}/$tmpscript" );
while ( <$fh> ) {
print $wh $_;
}
close( $wh );
close( $fh );
if ( $pid = fork() ) {
waitpid( $pid, 0 );
$stat = $? >> 8;
}
else {
if ( $> ) {
exec( "fakeroot fakechroot /usr/sbin/chroot "
. "$snap->{'target'} $tmpscript" );
}
else {
exec ( "chroot $snap->{'target'} $tmpscript" );
}
}
if ( $stat ) {
Snap->error( $stat, "Failed to execute $tmpscript" );
}
}
if ( $virtfs ) {
virtfs( 'umount' );
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,159 +0,0 @@
package SL::Commands;
use strict;
use warnings;
use parent 'SL';
sub new {
my( $class, $commands ) = @_;
return( bless( $commands, $class ) );
}
sub commandhelp {
my $self = shift;
my $command = shift;
my $optcount = 0;
if ( ! $self->{$command} ) {
SL->error( 2, "help(): Invalid command '$command'" );
}
my $options = $self->{$command}{'options'};
my $help = $self->{$command}{'help'};
print "$0 $command";
foreach ( @{$self->{$command}{'options'}} ) {
if ( $_ =~ /^(<|\[[A-Z])/ ) {
print " $_";
}
elsif ( substr( $_, 0, 1 ) eq '[' ) {
$optcount++;
}
}
if ( $optcount ) {
print ' [OPTIONS]';
}
print "\n\n$self->{$command}{'brief'}\n";
for ( my $i = 0; $i <= $#{$options}; $i++ ) {
my $charcnt = 0;
printf( "\n %-32s", $options->[$i] );
foreach ( split( ' ', $help->[$i] ) ) {
$charcnt += length( $_ ) + 1;
if ( $charcnt >= 34 ) {
$charcnt = 0;
print "\n" . ( ' ' x 34 ) . "$_ ";
}
else {
print "$_ ";
}
}
print "\n";
}
}
sub help {
my ( $self, $opts ) = @_;
my $cnt = 0;
print "Usage: $0 <COMMAND> <ARGS>\n\n"
. "sl is the Snaplinux package management utility\n\n"
. "COMMANDS\n\n";
if ( $opts->{'all'} ) {
foreach my $command ( sort( keys( %$self ) ) ) {
if ( $cnt ) {
print "\n";
}
$self->commandhelp( $command );
$cnt++;
}
}
else {
foreach my $command ( sort( keys( %$self ) ) ) {
print " $command \t\t\t$self->{$command}{'brief'}\n"
}
}
print "\nTo view more information for commands run:\n"
. "sl <COMMAND> -h|--help\n";
}
sub parseopts {
my ( $self, $command ) = @_;
my $opts = {};
if ( ! $command ) {
SL->error( 0, "parseopts(): Missing COMMAND" );
$self->help();
exit( 2 );
}
elsif ( ! $self->{$command} ) {
SL->error( 0, "parseopts(): '$command': Invalid COMMAND" );
$self->help();
exit( 2 );
}
foreach ( my $i = $#ARGV; $i >= 0; $i-- ) {
if ( $ARGV[$i] =~ /^\-([a-z]{2,})/ ) {
my @chars = split( '', $1 );
splice( @ARGV, $i, 1 );
foreach ( @chars ) {
push( @ARGV, "-$_" );
$i = $#ARGV;
}
}
if ( substr( $ARGV[$i], 0, 1 ) eq '-' &&
! grep( $_ =~ /(\[$ARGV[$i],|\[\-[a-z],$ARGV[$i]( |\]))/,
@{$self->{$command}{'options'}} ) ) {
SL->error( 2, "$ARGV[$i]: invalid argument" );
}
}
foreach ( @{$self->{$command}{'options'}} ) {
my( $short, $long, $arg2 ) = '';
my $tmpopts = {};
if ( $_ =~ /^\[(\-[a-z]),(\-\-([a-z]+))( (\S+)\]|\])/ ) {
$short = $1 || SL->error( 1, "Malformed short arg"
. " definition" );
$long = $2 || SL->error( 1, "Malformed long arg"
. " definition" );
$arg2 = $5 || '';
$tmpopts = SL->pullarg( {
short => $short,
long => $long,
arg2 => $arg2
} );
if ( ref( $tmpopts ) ) {
foreach my $key ( %$tmpopts ) {
$opts->{$key} = $tmpopts->{$key};
}
}
else {
$opts->{$3} = $tmpopts;
}
}
}
return( $opts );
}
1;

File diff suppressed because it is too large Load Diff

View File

@@ -1,382 +0,0 @@
package SL::Sources;
use Data::Dumper;
use strict;
use warnings;
use Compress::Zlib;
use parent 'SL';
sub new {
my $class = shift;
my $srcconf = shift;
my $sources = {};
foreach my $source ( @$srcconf ) {
if ( $source =~ /^(\S+)\s*=\s*(\S+?)\/*\s+(\S.*)$/ ) {
$sources->{'config'}{$1}{'url'} = "$2/"
. $SL::sl->{'slver'};
$sources->{'config'}{$1}{'order'} =
keys( %{$sources->{'config'}} );
foreach ( split( /\s+/, $3 ) ) {
$sources->{'config'}{$1}{'repos'}{$_} = {};
}
}
else {
SL->error( int( $! ), "SL::Sources->new():"
. " Invalid source format: $source" );
}
}
return( bless( $sources, $class ) );
}
### latest() ###############################################
#
# This *should* be a pretty much guaranteed method of
# retrieving the latest version of a package
#
############################################################
sub latest {
my ( $self, $pkgname ) = @_;
my $package;
foreach ( sort { SL->vercmp( $a->{'version'},
$b->{'version'} ) } @{$self->{'pkgs'}{$pkgname}} ) {
$package = $_;
}
return( $package );
}
sub readpkgs {
my $self = shift;
$self->{'status'} = {};
opendir( DIR, $SL::sl->{'statdir'} ) ||
SL->error( 1, "opendir(): $SL::sl->{'statdir'}: $!" );
foreach my $pkgname ( readdir( DIR ) ) {
my $slinfo = "$SL::sl->{'statdir'}/$pkgname/slinfo";
my $package;
if ( $pkgname =~ /^\.{1,2}$/ || ! -f $slinfo ) {
next;
}
$package = SL::Package->new( $pkgname );
$self->{'status'}{$pkgname} = $package;
}
close( DIR );
foreach my $source ( sort { $self->{'config'}{$a}{'order'} <=>
$self->{'config'}{$b}{'order'} } ( keys( %{$self->{'config'}} ) ) ) {
my $repos = $self->{'config'}{$source}{'repos'};
foreach my $repo ( keys( %$repos ) ) {
my $repopath = "$self->{'config'}{$source}{'url'}"
. "/$repo";
my $file = "$SL::sl->{'srcdir'}/$source/"
. "$repo-packages.gz";
my $gz = gzopen( $file, 'r' ) ||
SL->error( int( $! ), "gzopen: $file: $!" );
my $buff;
my $pkg = {};
while ( $gz->gzreadline( $buff ) ) {
if ( $pkg->{'name'} &&
! $self->{'pkgs'}{$pkg->{'name'}} ) {
$self->{'pkgs'}{$pkg->{'name'}} = [];
}
if ( $buff =~ /^name:\s*(.*)$/ ) {
$pkg = {};
$pkg->{'name'} = $1;
}
elsif ( $buff =~ /^(\S+):\s+(.*)$/ ) {
$pkg->{$1} = $2;
}
elsif ( $buff =~ /^$/ && $pkg->{'name'} ) {
$pkg->{'source'} = $source;
$pkg->{'path'} = $repopath
. "/$pkg->{'path'}";
push( @{$self->{'pkgs'}{$pkg->{'name'}}}
,SL::Package->new( $pkg ) );
$pkg = {};
}
elsif ( $buff =~ /^$/ ) {
next;
}
else {
SL->error( -1, "readpkgs():"
. "$file: malformed package"
. " list" );
}
}
$gz->gzclose();
}
}
return( 1 );
}
sub refresh {
my $self = shift;
my $cnt;
foreach my $srcname ( sort { $self->{'config'}{$a}{'order'} <=>
$self->{'config'}{$b}{'order'} }( keys( %{$self->{'config'}} ) ) ) {
my $source = $self->{'config'}{$srcname};
my $srcdir = "$SL::sl->{'srcdir'}/$srcname";
if ( ! -d $srcdir ) {
mkdir( $srcdir, 0755 ) || SL->error( int( $! ),
"mkdir(): $srcdir: $!" );
}
if ( $cnt ) {
print "\n";
}
print "Refreshing $srcname\n\n";
foreach my $repo ( sort( keys( %{$source->{'repos'}} ) ) ) {
my $remotepkgs = "$source->{'url'}/"
. "/$repo-packages.gz";
my $remotesha256 = "$source->{'url'}/"
. "/$repo-packages.gz.sha256";
my $localpkgs = "$srcdir/$repo-packages.gz";
my $shaget = SL->httpget( $remotesha256, 0, 0644 );
SL->httpget( $remotepkgs, $localpkgs, 0644 );
if ( SL->sha256( $localpkgs ) ne $shaget ) {
SL->error( -1, "sha256(): incorrect SHA256"
. " calculated for $localpkgs!" );
}
}
$cnt++;
}
}
### search() ###############################################
#
# This searches the packages from all sources and returns
# an array reference with all matching packages. Should
# be generally accepting of regex type stuff
#
# It seems to me to be a bit kludgy, I'd like to make it
# more elegant, but it works for now...
#
# If $opts->{'all'} isn't set (as in with arg -a/--all) and
# there is an exact match with a package name in the search
# string the most recent version of the package is returned.
#
############################################################
sub search {
my $self = shift;
my $opts = shift;
my $packages = [];
my $cnt;
if ( ! $opts->{'all'} && ! $opts->{'keys'} && $opts->{'search'} &&
$self->{'pkgs'}{$opts->{'search'}} ) {
return( [ $self->{'pkgs'}{$opts->{'search'}}[-1] ] );
}
if ( $opts->{'keys'} ) {
foreach ( split( /,| /, $opts->{'keys'} ) ) {
if ( $_ =~ /^(\S+):(\S+)$/ ) {
if ( ! grep( $_ eq $1,
&SL::Package::FIELDS ) ) {
SL->error( -1, "search(): $1:"
. " Invalid key\n" );
}
$opts->{$1} = $2;
}
}
}
if ( $opts->{'search'} && $opts->{'search'} =~
/^([a-zA-Z0-9]+)([<>=]+\S+)/ ) {
$opts->{'name'} = $1;
$opts->{'version'} = $2;
}
foreach my $pkgname ( sort( keys( %{$self->{'pkgs'}} ) ) ) {
my $package;
if ( $opts->{'name'} && $pkgname ne $opts->{'name'} ) {
next;
}
foreach ( sort { SL->vercmp( $a->{'version'},
$b->{'version'} ) } ( @{$self->{'pkgs'}{$pkgname}} ) ) {
if ( $opts->{'version'} && $opts->{'version'} =~
/^((<|>)=?|=)\s*(.*)/ ) {
my $op = $1;
my $ver = $3;
my $chk = SL->vercmp( $_->{'version'}, $ver );
if ( $op eq '<' && $chk != -1 ) {
next;
}
if ( $op eq '<=' && $chk > 0 ) {
next;
}
if ( $op eq '>' && $chk != 1 ) {
next;
}
if ( $op eq '>=' && $chk < 0 ) {
next;
}
if ( $op eq '=' && $chk != 0 ) {
next;
}
}
elsif ( $opts->{'version'} && $_->{'version'} ne
$opts->{'version'} ) {
next;
}
elsif ( $opts->{'depends'} && $_->{'depends'} !~
/$opts->{'depends'}/ ) {
next;
}
elsif ( $opts->{'source'} && $_->{'source'} ne
$opts->{'source'} ) {
next;
}
elsif ( $opts->{'repo'} && $_->{'repo'} ne
$opts->{'repo'} ) {
next;
}
elsif ( $opts->{'search'} && ( $_->{'name'} !~
/$opts->{'search'}/ && $_->{'description'} !~
/$opts->{'search'}/ ) ) {
next;
}
if ( $opts->{'all'} ) {
push( @$packages, $_ );
}
elsif ( ! $package || SL->vercmp( $_->{'version'},
$package->{'version'} ) ) {
$package = $_;
}
}
if ( $package ) {
push( @$packages, $package );
}
}
return( $packages );
}
1;
=head1 NAME
SL::Sources - Interface for Snaplinux package sources
=head1 DESCRIPTION
This module is not intended to be used directly, rather it is included with the parent SL.pm module. It is separated into its own module only to logically separate the code.
SL::Sources includes all functions for retrieving, parsing, and searching through package lists. The structure of package objects is defined in SL::Package.
=head1 METHODS
=head2 new
$sources = SL::Sources->new( $arrayref )
If $arrayref contains a list of valid sources the $sources object will be built. The $arrayref is intended to be populated with values parsed from /etc/sl.conf. The syntax for sources is as follows:
[sources]
source1 = http://packages.snaplinux.org core dev util
Each item listed under the [sources] section is added to $sources->{'config'}. The following describes the structure:
$sources => {
config => {
source1 => {
url => 'http://packages.snaplinux.org/0.1',
order => 1,
repos => {
dev => {},
core => {},
util => {}
=head2 readpkgs
$sources->readpkgs()
Parses all source/repo files and builds a list of packages which is available in $sources->{'pkgs'}. Also reads all installed and removed packages and adds them to $sources->{'status'}. The list is built with the following structure:
$sources => {
pkgs => {
<PKGNAME> => [
SL::Package->{'version'} => 1
SL::Package->{'version'} => 2
]
}
installed => {
<PKGNAME> => SL::Package
=head2 search
$sources->search( $searchterms )
This will search all sources and repos in the $sources object for the search terms and either print the output, or if { quiet => 1 } is supplied as an arg it will return the highest version of the matched package. The quiet option is only intended for internal routines rather than for queries intended to display output on the command line.
Other available options that can be set (using key => value pairs):
=over 4
=item name
This will only return packages where the name matches exactly
=item version
The operators <, <=, >, >=, = can all be used to retrieve the desired package version. The operator should preface the version string.
=item depends
The supplied string will be used as a patter to match dependencies in packages.
=item source
Return only packages available from the specified source.
=item repo
Return only packages from the specified repo
=item string
The supplied string will be used to match against either the package name, or the package description.
=back
=head2 refresh
$sources->refresh()
This will download all package information for the repos defined in $sources->{'config'}. The data will be stored in /var/lib/sl/sources/<SOURCENAME>
=cut

View File

@@ -1,136 +0,0 @@
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation here:
# (http://www.gnu.org/licenses/gpl-2.0.html)
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# Some, but not all of variables are required. The following list
# describes the required variables:
#
# * URL: The main website of the upstream project
# * REPO: The location of the package on the source pacakge
# server. This might be one of core, main, dev, or
# perhaps others.
# * BRIEF: Short description, should be 50 chars or less
# * SLVER: This is the package version. When a package is
# changed, but no changes are made to the source code
# this value should be increased. This would include
# things like usher being modified, changes to default
# configuration files, file permissions, etc.
# * ARCHIVE: The default commands that set this variable should
# work in most cases, but in some cases it may need
# to be modified. This variable should contain the
# path to the source of the package (./SRC/filename)
# * TYPE: This is probably not really needed due to the
# ability of gnu tar to figure it out on its own.
# Should probably be removed at some point.
# * SRCDIR: This is the name of the source directory after the
# package source is extracted. The default command
# should in most cases set this automatically.
# * PATCHDIR: This directory should be ./SRC/patches and is
# required, whether or not patches are used.
# * VERSION: This should be set automatically based on the
# version string in the source directory and SLVER.
# The default command here should work in many cases,
# but certain packages may need to use a different
# method.
#
# Variables that aren't required:
#
# * ARCH: This should be populated for packages which contain
# compiled binaries. If it is not populated the ARCH
# will be set to 'noarch'.
# * DEPENDS: If any other packages are required for this package
# to function then they need to be listed here,
# preferably in alphabetical order.
# * BUILDDEPS: Any package beyond packages from the core repo
# need to be listed here. The idea is that we
# can automate building and testing packages
# from clean core systems. The core repo is
# intended to include only the base minimum
# packages which provide a functional system.
# * SRCPKG: By default this is populated automatically with
# the name of the package (current directory). If
# the source package is used to generate multiple
# packages then this variable should contain the
# name of the git repo that tracks the source.
# * DESC: This is to be used to provide a longer description
# of the package.
ARCH =
DEPENDS =
BUILDDEPS =
SRCPKG =
URL =
REPO =
BRIEF =
DESC =
SLVER =
ARCHIVE := $(PWD)/SRC/$(shell ls SRC|egrep '(bz2|gz|tar|xz)$$'|tail -1)
TYPE := $(shell file -ib $(ARCHIVE)|cut -d';' -f1|tr -d '\n')
SRCDIR := $(shell tar -tf $(ARCHIVE)|head -1|sed 's/\/.*//')
PATCHDIR := $(PWD)/SRC/patches
VERSION := $(shell echo $(SRCDIR)|egrep -o '\-[0-9].*'|sed 's/^-//')-$(SLVER)
include /usr/share/sl/Makefile.snaplinux
$(SRCDIR)/configure: $(ARCHIVE)
@if [ '$(TYPE)' == 'application/x-bzip2' ]; then \
tar -jxf $(ARCHIVE); \
elif [ '$(TYPE)' == 'application/x-gzip' ]; then \
tar -zxf $(ARCHIVE); \
elif [ '$(TYPE)' == 'application/x-tar' ]; then \
tar -xf $(ARCHIVE); \
elif [ '$(TYPE)' == 'application/x-xz' ]; then \
tar -xf $(ARCHIVE); \
else \
echo 'Unable to determine archive type'; \
exit 1; \
fi
@touch $(SRCDIR)/configure
$(SRCDIR)/config.log: $(SRCDIR)/configure
@cd $(SRCDIR) && \
for patch in `find $(PATCHDIR) -name \*.patch|sort`; do \
patch --verbose -Np1 -i $$patch; \
done
@cd $(SRCDIR); \
./configure \
--prefix=/usr \
--build=x86_64-snap-linux-gnu \
--host=x86_64-snap-linux-gnu \
--target=x86_64-snap-linux-gnu
# binfile should be replaced with a file generated by the
# make process. It won't really break anything if not
# set to a valid file, but the source make process will
# be re-executed even if it isn't necessary
$(SRCDIR)/binfile: $(SRCDIR)/config.log
@cd $(SRCDIR) && make
$(ROOT): $(SRCDIR)/binfile
@if [ -d $(ROOT) ]; then \
touch $(ROOT); \
else \
mkdir -v $(ROOT); \
fi
@cd $(SRCDIR) && make install DESTDIR=$(ROOT)
test: $(ROOT)
@cd $(SRCDIR); \
make check
clean:
@rm -rvf $(ROOT) \
$(SLINFO) \
$(MANIFEST) \
$(FILES) \
$(SRCDIR)

View File

@@ -1,180 +0,0 @@
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation here:
# (http://www.gnu.org/licenses/gpl-2.0.html)
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
export SHELL := /bin/bash
PWD := $(shell pwd)
SLDIR = $(PWD)/SL
ROOT = $(PWD)/ROOT
# This will set PACKAGE to the name of the current working directory
# if the package itself has not provided a package name
ifndef PACKAGE
PACKAGE := $(shell echo $(PWD)|sed 's/.*\///')
endif
# If VERSION is not set then we must fail
ifndef VERSION
$(error VERSION is not set)
endif
# This defines the name of the package file unless
# it is already specified in the package Makefile
ifndef PKGFILE
PKGFILE := $(PACKAGE)-$(VERSION).slp
endif
# If ARCH is not set we will assume noarch
ifndef ARCH
ARCH := noarch
endif
# SRCPKG defines the git repo name from which the package
# is built. In many cases it should be the same as the
# package name, but in cases where multiple packages are
# built from the same source this is especially relevant.
ifndef SRCPKG
SRCPKG := $(PACKAGE)
endif
# URL is required - this should point to the upstream project
ifndef URL
$(error URL is not set)
endif
# REPO is required. This value is used to determine the
# location of the package on the package source server
ifndef REPO
$(error REPO is not set)
endif
SLINFO = $(SLDIR)/slinfo
MANIFEST = $(SLDIR)/manifest
USHER = $(SLDIR)/usher
FILES = $(SLDIR)/files.tar.gz
# BRIEF is required.
ifndef BRIEF
$(error BRIEF is not set)
endif
$(PKGFILE): $(SLINFO) $(FILES)
@if [ -f $(PKGFILE) ]; then \
rm -v $(PKGFILE); \
fi
@ar cvr $(PKGFILE) $(SLINFO) $(MANIFEST); \
if [ -f $(USHER) ]; then \
chmod +x $(USHER); \
ar cvr $(PKGFILE) $(USHER); \
fi; \
ar cvr $(PKGFILE) $(FILES)
@echo "Successfully built $(PKGFILE)"
$(SLINFO): $(MANIFEST)
@>$(SLINFO)
$(eval BYTES := $(shell gzip -l $(FILES)|tail -1|awk '{print $$2}'))
$(eval SHA256MAN := $(shell sha256sum $(MANIFEST)|awk '{print $$1}'))
@fields=( \
"name: $(PACKAGE)" \
"version: $(VERSION)" \
"arch: $(ARCH)" \
"depends: $(DEPENDS)" \
"builddeps: $(BUILDDEPS)" \
"srcpkg: $(SRCPKG)" \
"bytes: $(BYTES)" \
"url: $(URL)" \
"repo: $(REPO)" \
"sha256man: $(SHA256MAN)" \
"brief: $(BRIEF)" \
"description: $(DESC)" \
) && \
for field in "$${fields[@]}"; do \
printf "$$field\n"; \
done > $(SLINFO)
$(MANIFEST): $(FILES)
@>$(MANIFEST)
@rootfiles=`cd $(ROOT) && find ! -path .|sed 's/^\.\///'|sort -r` && \
while read -r file; do \
info=`ls -ld "$(ROOT)/$$file"`; \
perm=`echo $$info|awk '{print $$1}'`; \
type=`echo $$perm|head -c1`; \
sha='________________________________________'; \
if [ $$type = 'c' ]; then \
size=0; \
fi; \
if [ -f "$(ROOT)/$$file" ]; then \
sha=`sha1sum "$(ROOT)/$$file"|awk '{print $$1}'`; \
fi; \
printf "$$sha\t$$perm\t$$file\n" >> $(MANIFEST); \
done <<< "$$rootfiles"
$(FILES): $(ROOT)
# Remove any perllocal.pod to avoid conflicts
# Should try to properly fix this some time...
@find $(ROOT) -name perllocal.pod -exec rm {} \;
@if [ -d $(ROOT)/usr/share/man ]; then \
find $(ROOT)/usr/share/man -type f -not -name \*.gz| \
while read -r file; do \
gzip $$file; \
done; \
find $(ROOT)/usr/share/man -type l| \
while read -r file; do \
target=`readlink $$file`; \
path=`dirname $$file`; \
full="$$path/$$target"; \
if [ ! -f $$full ] && [ -f $$full.gz ]; then \
ln -sf $$target.gz $$file; \
fi; \
done; \
fi
@if [ -d $(ROOT)/usr/share/info ]; then \
find $(ROOT)/usr/share/info -name '*.info' -o \
-name '*.info-[0-9]*'|while read -r file; do \
gzip $$file; \
done; \
if [ -f $(ROOT)/usr/share/info/dir ]; then \
rm -v $(ROOT)/usr/share/info/dir; \
fi; \
fi
@find $(ROOT) -type f | while read -r file; do \
type=`file -i $$file|sed 's/.*: //'`; \
case $$type in \
*'/x-executable; charset=binary') \
echo "--strip-unneeded $$file"; \
strip --strip-unneeded $$file \
;; \
*'/x-object; charset=binary') \
echo "--strip-debug $$file"; \
strip --strip-debug $$file \
;; \
*'/x-sharedlib; charset=binary') \
echo "--strip-debug $$file"; \
strip --strip-debug $$file \
;; \
esac; \
done
@cd $(ROOT) && tar cvzf $(FILES) *

Binary file not shown.

View File

@@ -1,27 +0,0 @@
6c7fd33ea7498d8fceb4fae8c5253d00ca12a2ca -rw-r--r-- usr/share/sl/Makefile.snaplinux
f280e4828f64bc9b6166f90573ef6bf6c2a0a79f -rw-r--r-- usr/share/sl/Makefile.skel
________________________________________ drwxr-xr-x usr/share/sl
________________________________________ drwxr-xr-x usr/share
983e13980dab92c1a643cc371f9fc8c4b89d2241 -rw-r--r-- usr/lib/perl5/vendor_perl/5.24.0/SL/Sources.pm
094aeef2123f70de7628b6c21a48eb277586e910 -rw-r--r-- usr/lib/perl5/vendor_perl/5.24.0/SL/Package.pm
d7dfae002a00995eb75cbd53076c3dfed9545a39 -rw-r--r-- usr/lib/perl5/vendor_perl/5.24.0/SL/Commands.pm
e9ff59a2e73d49bb4b72fc802707f1125342aba7 -rw-r--r-- usr/lib/perl5/vendor_perl/5.24.0/SL.pm
________________________________________ drwxr-xr-x usr/lib/perl5/vendor_perl/5.24.0/SL
________________________________________ drwxr-xr-x usr/lib/perl5/vendor_perl/5.24.0
________________________________________ drwxr-xr-x usr/lib/perl5/vendor_perl
________________________________________ drwxr-xr-x usr/lib/perl5
________________________________________ drwxr-xr-x usr/lib
935d38bc282b82ff603bf9587539fc8c80b2c4ff -rwxr-xr-x usr/bin/slinstall
e652e3c122196a53a8c274ddf874665f4c772a93 -rwxr-xr-x usr/bin/sl
________________________________________ drwxr-xr-x usr/bin
________________________________________ drwxr-xr-x usr
________________________________________ drwxr-xr-x etc/sl.d/templates/server/rootfs
cf93b606a51e1987fc183670a99a5a2e3a4455bd -rw-r--r-- etc/sl.d/templates/server/postinst
22f8fffa7742fe7a8967d6bd5715428d27b27ee3 -rw-r--r-- etc/sl.d/templates/server/packages
________________________________________ drwxr-xr-x etc/sl.d/templates/server
________________________________________ drwxr-xr-x etc/sl.d/templates/container/rootfs
e2e641ddea8abeaadecc3c23bdcc07c9b6c6ed2d -rw-r--r-- etc/sl.d/templates/container/packages
________________________________________ drwxr-xr-x etc/sl.d/templates/container
________________________________________ drwxr-xr-x etc/sl.d/templates
________________________________________ drwxr-xr-x etc/sl.d
________________________________________ drwxr-xr-x etc

View File

@@ -1,12 +0,0 @@
name: sl
version: 0.15-0
arch: x86_64
depends: binutils,coreutils,gzip,perl>=5.20.0,tar
builddeps:
srcpkg: sl
bytes: 163840
url: http://snaplinux.org
repo: core
sha256man: 987dccaedf78807ea98f4c19e9f36ce2a7d56899d405579083504eb32ea04375
brief: The Snaplinux package management system
description: The Snaplinux package management system

View File

@@ -80,13 +80,13 @@ VERSION := $(shell echo $(SRCDIR)|egrep -o '\-[0-9].*'|sed 's/^-//')-$(SLVER)
include /usr/share/sl/Makefile.snaplinux
$(SRCDIR)/configure: $(ARCHIVE)
@if [ '$(TYPE)' == 'application/x-bzip2' ]; then \
@if [ '$(TYPE)' = 'application/x-bzip2' ]; then \
tar -jxf $(ARCHIVE); \
elif [ '$(TYPE)' == 'application/x-gzip' ]; then \
elif [ '$(TYPE)' = 'application/x-gzip' ]; then \
tar -zxf $(ARCHIVE); \
elif [ '$(TYPE)' == 'application/x-tar' ]; then \
elif [ '$(TYPE)' = 'application/x-tar' ]; then \
tar -xf $(ARCHIVE); \
elif [ '$(TYPE)' == 'application/x-xz' ]; then \
elif [ '$(TYPE)' = 'application/x-xz' ]; then \
tar -xf $(ARCHIVE); \
else \
echo 'Unable to determine archive type'; \

View File

@@ -65,6 +65,8 @@ endif
SLINFO = $(SLDIR)/slinfo
MANIFEST = $(SLDIR)/manifest
USHER = $(SLDIR)/usher
CONFIGDIR = $(PWD)/CONFIG
CONFIG = $(SLDIR)/config.tar.gz
FILES = $(SLDIR)/files.tar.gz
# BRIEF is required.
@@ -78,12 +80,19 @@ $(PKGFILE): $(SLINFO) $(FILES)
rm -v $(PKGFILE); \
fi
@ar cvr $(PKGFILE) $(SLINFO) $(MANIFEST); \
@ar cvr $(PKGFILE) $(SLINFO) $(MANIFEST) && \
if [ -f $(USHER) ]; then \
chmod +x $(USHER); \
chmod +x $(USHER) && \
ar cvr $(PKGFILE) $(USHER); \
fi; \
ar cvr $(PKGFILE) $(FILES)
fi && \
ar cvr $(PKGFILE) $(FILES) && \
if [ -d $(CONFIGDIR) ] && [ "$$(ls -A)" ]; then \
cd $(CONFIGDIR) && \
tar cvzf $(CONFIG) *; \
if [ -f $(CONFIG) ]; then \
ar cvr $(PWD)/$(PKGFILE) $(CONFIG); \
fi; \
fi
@echo "Successfully built $(PKGFILE)"
@@ -176,5 +185,9 @@ $(FILES): $(ROOT)
;; \
esac; \
done
@cd $(ROOT) && tar cvzf $(FILES) *
@cd $(ROOT) && \
if [ "$$(ls -A)" ]; then \
tar cvzf $(FILES) *; \
else \
tar cvzf $(FILES) -T /dev/null; \
fi

View File

@@ -40,7 +40,7 @@ our @EXPORT = qw(
$sl
);
our $VERSION = '0.15';
our $VERSION = '0.19';
############################################################
#

Binary file not shown.