From 98c0ab336faf04bb1c9e6b99c44245e2c42b9619 Mon Sep 17 00:00:00 2001 From: Jay Larson Date: Fri, 2 Jun 2017 18:49:47 -0500 Subject: [PATCH] The following changes were made: * Updated Makefile.snaplinux to be more flexible with package names * Added bit to set root password in snapinstall --- SRC/snap/Makefile.snaplinux | 33 +++++++++++++++++++-------------- SRC/snap/Snap.pm | 2 +- SRC/snap/snapinstall | 9 +++++++++ 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/SRC/snap/Makefile.snaplinux b/SRC/snap/Makefile.snaplinux index 3353d4a..872bec4 100644 --- a/SRC/snap/Makefile.snaplinux +++ b/SRC/snap/Makefile.snaplinux @@ -9,16 +9,21 @@ # GNU General Public License for more details. PWD := $(shell pwd) -PACKAGE := $(shell echo $(PWD)|sed 's/.*\///') SNAPDIR = $(PWD)/SNAP ROOT = $(PWD)/ROOT -# This allows the package Makefile to override the name -# of the package file. Added for the kernel package -# though could be useful for others +# This will set PACKAGE only if the package itself has +# not provided a package name -ifndef SNAP -SNAP := $(PACKAGE)-$(VERSION).snap +ifndef PACKAGE +PACKAGE := $(shell echo $(PWD)|sed 's/.*\///') +endif + +# This defines the name of the package file unless +# specified + +ifndef PKGFILE +PKGFILE := $(PACKAGE)-$(VERSION).snap endif SNAPINFO = $(SNAPDIR)/snapinfo @@ -31,7 +36,7 @@ FILES = $(SNAPDIR)/files.tar.gz # if we find that not to be supplied we're going to # assume that the SRCPKG is the same as the PACKAGE -ifndef SRCPKG) +ifndef SRCPKG SRCPKG := $(PACKAGE) endif @@ -41,19 +46,19 @@ ifndef VERSION $(error VERSION is not set) endif -$(SNAP): $(SNAPINFO) $(FILES) - @if [ -f $(SNAP) ]; then \ - rm -v $(SNAP); \ +$(PKGFILE): $(SNAPINFO) $(FILES) + @if [ -f $(PKGFILE) ]; then \ + rm -v $(PKGFILE); \ fi - @ar cvr $(SNAP) $(SNAPINFO) $(MANIFEST); \ + @ar cvr $(PKGFILE) $(SNAPINFO) $(MANIFEST); \ if [ -f $(USHER) ]; then \ chmod +x $(USHER); \ - ar cvr $(SNAP) $(USHER); \ + ar cvr $(PKGFILE) $(USHER); \ fi; \ - ar cvr $(SNAP) $(FILES) + ar cvr $(PKGFILE) $(FILES) - @echo "Successfully built $(SNAP)" + @echo "Successfully built $(PKGFILE)" $(SNAPINFO): $(MANIFEST) @>$(SNAPINFO) diff --git a/SRC/snap/Snap.pm b/SRC/snap/Snap.pm index 3047f3c..dececcd 100644 --- a/SRC/snap/Snap.pm +++ b/SRC/snap/Snap.pm @@ -89,7 +89,7 @@ use constant VERFILE => eval { } }; use constant { - VERSION => '0.9', + VERSION => '0.10', SNAPDIR => TARGET . '/var/lib/snap', PKGDIR => TARGET . '/var/lib/snap/packages', INSTDIR => TARGET . '/var/lib/snap/installed', diff --git a/SRC/snap/snapinstall b/SRC/snap/snapinstall index d1bda7f..6d33bb5 100644 --- a/SRC/snap/snapinstall +++ b/SRC/snap/snapinstall @@ -84,6 +84,15 @@ foreach my $package ( @$packages ) { $package->install(); } +if ( $virtfs ) { + if ( $pid = fork() ) { + waitpid( $pid, 0 ); + } + else { + exec( "chroot " . Snap->TARGET . " passwd" ); + } + } + virtfs( 'umount' ); print "\n";