- Moved away from versioned directory for better tracking

- Modified usher to set root password if not already set
 - Modified snap to deal with circular dependencies properly
 - Now snap properly checks exit value for usher postinst
This commit is contained in:
2016-11-04 08:32:24 -05:00
parent 388430ed37
commit 997a8d69b5
10 changed files with 48 additions and 34 deletions

View File

@@ -13,7 +13,6 @@ PACKAGE := $(shell echo $(PWD)|sed 's/.*\///')
SNAPDIR = $(PWD)/SNAP
ROOT = $(PWD)/ROOT
BYTES = 0
SNAP = $(PACKAGE)-$(VERSION).snap
SNAPINFO = $(SNAPDIR)/snapinfo
MANIFEST = $(SNAPDIR)/manifest
@@ -22,14 +21,6 @@ FILES = $(SNAPDIR)/files.tar.gz
# The following values must be set in the Makefile for the package
ifndef ARCHIVE
$(error ARCHIVE is not set)
endif
ifndef SRCDIR
$(error SRCDIR is not set)
endif
ifndef VERSION
$(error VERSION is not set)
endif
@@ -50,17 +41,16 @@ $(SNAP): $(SNAPINFO) $(FILES)
$(SNAPINFO): $(MANIFEST)
@>$(SNAPINFO)
$(eval BYTES := $(shell du -sB1 $(ROOT)|awk '{print $$1}'))
$(eval BYTES := $(shell gzip -l $(FILES)|tail -1|awk '{print $$2}'))
@printf "package: $(PACKAGE)\nversion: $(VERSION)\n" > $(SNAPINFO); \
@printf "package: $(PACKAGE)\nversion: $(VERSION)\n" > $(SNAPINFO) && \
printf "depends: $(DEPENDS)\narch: $(ARCH)\nbytes: $(BYTES)\n" \
>> $(SNAPINFO); \
>> $(SNAPINFO) && \
printf "url: $(URL)\ndescription: $(DESC)\n" >> $(SNAPINFO)
$(MANIFEST): $(FILES)
@>$(MANIFEST)
@bytes=0; \
rootfiles=`cd $(ROOT) && find ! -path .|sed 's/^\.\///'|sort -r`; \
while read -r file; do \
info=`ls -ld "$(ROOT)/$$file"`; \
@@ -82,14 +72,19 @@ $(FILES): $(ROOT)
@find $(ROOT) -name perllocal.pod -exec rm {} \;
@files=`find $(ROOT) -type f -exec file -i '{}' \;| grep \
'application/x-\(executable\|object\|sharedlib\);' | \
grep ' charset=binary'`; \
while read -r line; do \
file=`echo $$line|sed 's/: application\/x-.*//'`; \
if [ "$$file" != '' ]; then \
strip --strip-unneeded $$file; \
fi; \
done <<< "$$files"
@find $(ROOT) -type f | while read -r file; do \
type=`file -i $$file|sed 's/.*: //'`; \
case $$type in \
*'/x-executable; charset=binary') \
strip --strip-unneeded $$file \
;; \
*'/x-object; charset=binary') \
strip --strip-debug $$file \
;; \
*'/x-sharedlib; charset=binary') \
strip --strip-debug $$file \
;; \
esac; \
done
@cd $(ROOT) && tar cvzf $(FILES) *

View File

@@ -158,10 +158,9 @@ sub depends {
if ( $packages->{$package} && $packages->{$package}{'depends'} ) {
foreach my $depend ( split( ',',
$packages->{$package}{'depends'} ) ) {
depends( $packages, $depend, $depends );
if ( ! grep( /^$depend$/, @$depends ) ) {
push( @$depends, $depend );
depends( $packages, $depend, $depends );
}
}
}
@@ -640,7 +639,7 @@ sub install {
print STDOUT "\e[K$filenum files extracted\e[?25h\n\n";
usher( $pkgfile, $target, 'postinst' );
%result = usher( $pkgfile, $target, 'postinst' );
return( \%result );
}
@@ -1807,7 +1806,8 @@ elsif ( $ARGV[0] eq 'install' || $ARGV[0] eq 'reinstall' ){
}
}
foreach my $depend ( @depends ) {
for ( my $i = $#depends; $i >= 0; $i-- ) {
my $depend = $depends[$i];
my $depdir = "$target/$conf->{'general'}{'snapdir'}/$depend";
my $dlpath = $packages->{$depend}{'path'};
( my $file = $dlpath ) =~ s/.*\///;