diff options
Diffstat (limited to 'source/d/slacktrack/slacktrack-project')
23 files changed, 5227 insertions, 0 deletions
diff --git a/source/d/slacktrack/slacktrack-project/docs/ChangeLog.slacktrack b/source/d/slacktrack/slacktrack-project/docs/ChangeLog.slacktrack new file mode 100644 index 00000000..1d656d17 --- /dev/null +++ b/source/d/slacktrack/slacktrack-project/docs/ChangeLog.slacktrack @@ -0,0 +1,705 @@ +############################################################################## +# Document: ChangeLog.slacktrack +# Purpose : Document the changes that have occurred in 'slacktrack' +############################################################################## + +07-Jun-2017 - v2.18 + * Added option --run-after-withlog + This option is the same as -R, --run-after, with the only difference + being that any output from that script is logged to the slacktrack build + log. + +25-Apr-2015 - v2.17 + * Cleaned up superfluous white space. + * Added operator -o, --no-fs-search + Prior to beginning a build, and post build, slacktrack uses the 'find' + command to scan the OS' file system, and stores these records. The + difference between the two records are used to determine the package's + contents. + + This default set is ideal for a default Slackware installation, but some + users have data in other directories which should never be included in a + package. Scanning these additional directories takes extra time and serves + no purpose. + + While the -x,--exclude operator is applied to the final package + contents list, -o, --no-fs-search is applied before and can be used to + significantly speed up the searches that build the before/after file lists. + + Thanks to Andrew Lyon for the patch. + +10-Jan-2014 - v2.16 + * Added the following paths to the default exclude list: + /usr/man/whatis + /usr/local/man/whatis + /var/lib/pgsql/ + /var/lib/mysql/ + Thanks to Eduard Rozenberg. + * Updated the 'OVERVIEW' doc to correct a couple of small details. + * Updated man pages to conform with stricter pod2man syntax. + * Updated FAQ to explain why after using one of the 'touch file system' + options, root is notified about having new mail. + +23-May-2013 - v2.15 + * Added the $PWD from which slacktrack was invoked in to the default exclude + list. This allows a package's source directory to be in a non-default + excluded path and receive updates (such as log files) and avoid slacktrack + including them in the newly created package file. + Thanks to Eduard Rozenberg. + +10-May-2013 - v2.14 + * Removed '-i, --install' flag from the man page and the slacktrack script, + as this has been a no-op since slacktrack stopped using 'installwatch'. + Thanks to Michael Stewart. + * Added /etc/ntp/drift to the default exclude list. + Thanks to Eduard Rozenberg. + +05-Apr-2013 - v2.13 + * Use '-c' operator to 'touch' when touching the file system. This avoids + creating empty files that were referenced from a dangling symlink, and + avoids creating empty files when using the (not recommended) 'faster' + file system touch option. + * Moved slacktrack's 'ln' wrapper from /usr/share/slacktrack to + /usr/libexec/slacktrack, since /usr/share is for architecture independent + files. + Thanks to Darren Austin for the suggestion. + * Added '/usr/libexec' to the default list of library locations that will + have their ELF objects stripped. + * Capture the output of touching the file system into the slacktrack log + file, as this can be useful for recording any issues resulting from touching + files on the file system (such as dangling symlinks in existing installed + packages). + * Support supplying the full path name using the -p operator. Previously, + to store the resulting .t?z package in a location other than the default + ('/tmp'), you had to supply -b <dir name> in addition to -p <package name> + This was a somewhat wooly distinction between package *name* and package + *file name*. + The package name can now be supplied using: + # slacktrack [options] -p /somedir/foo-1.01-arm-2.tgz + The -b operator is still effective, so previous 'trackbuild' scripts will + continue to work as before. + Thanks to Eduard Rozenberg for the suggestion. + +18-Sep-2012 - v2.12 + * Added /run to the list of default path exclusions. + +27-May-2012 - v2.11 + * Added /var/lib/NetworkManager to the list of default path exclusions. + Thanks to Patrick Volkerding for the suggestion. + +05-Nov-2011 - v2.10 + * Added --allow-overlapping option to permit the package to contain files + that overlap with existing packages installed on the system. + The default is to permit this behaviour, but if you're using the -Q option + as I do to build my packages, you'll find that there's no way to switch + the behaviour off whilst building an otherwise Slackware standards + compliant package. + To use this option you will need to supply it on the command line + after '-Q'. + * Fixed bug where --delete-overlapping was expecting an input. + * To the default path exclusion list, the following paths have been added: + /var/spool/cron/cron + /dev/bus/ + /dev/char/ + /dev/rfkill + +25-Sep-2011 - v2.09 + * Fixed formatting issues with the man pages exposed by a newer version + of "pod2man". Thanks to Branko Grubic for the report and the patches. + * The /var/log/{packages,scripts}/$PACKAGE entries of the unprocessed + package contents (just after slacktrack completes execution of the + supplied package build script) were incorrect due to slacktrack not + handling symlinks when creating these entries - any symlinks were treated + treated as files which caused "removepkg" to emit messages such as + ".. no longer exists" + slacktrack now uses "makepkg" and "installpkg" to correctly create and + handle the /var/log/{packages,scripts} entries. + Thanks to Roberto for the report and a good detailed explaination. + * Removed /usr/bin/altertrack symlink to /usr/bin/slacktrack. It's + been years since altertrack was a separate tool. If you have any + scripts still calling "altertrack" -- change them :-) + * When deleting perllocal.pod files, look in /usr/lib & /usr/lib64 + * Warn if any files in the newly built package overlap with other packages + that are already installed on the system. + * Added -X, --delete-overlapping option. + This option deletes any of the overlapping files from the new package. + The -Q option now includes the erasing of any overlapping files. + * Do not emit the name of the newly built package when displaying the + list of package dependencies. + +08-Nov-2010 - v2.08 + * Exclude /var/lib/dhcpcd from being included in the package contents. + +18-Dec-2009 - v2.07 + * Rewrote package_name() function to cater for "old style" package names. + Thanks to Jim Hawkins for the bit of sed script. + * Prevent /etc/dhcpc, /var/run and /etc/resolv.conf from appearing in + the package contents. This is especially useful when your build + machine is using dhcpcd to manage its network address. + +16-July-2009 - v2.06 + * Added /lib/udev/devices to the default path exclusion list. + Files in here are generated and maintained by udev and should not + be included in packages. + +02-June-2009 - v2.05 + * If after removing orphaned *.pyc files, their previous & parent + directories become empty, delete the directories. + +29-May-2009 - v2.04 + * Added -Y, --delete-orphaned-pyc option. + Within the package contents, if slacktrack finds *.pyc files without a + matching *.py file, the *.pyc files will be removed from the package + contents. + Thanks to Patrick Volkerding for the suggestion. + Updated slacktrack(8). + +15-May-2009 - v2.03 + slackdtxt: + * Updated to handle .tgz, .tbz, .tlz, .txz file extensions + Thanks to Patrick Volkerding. + * Renamed --nodeletetgz option in to --nodelete. + * Updated slackdtxt(8) + slacktrack: + * Added /usr/lib64 and /lib64 to the list of known library directories. + Thanks to Eric Hameleers for reminding me. + +12-May-2009 - v2.02 + + This is an interim release to allow slacktrack to work with the + additional package compression formats introduced in Slackware v13. + The documentation & the 'slackdtxt' utility will be updated at a + later date. + + * Renamed --md5sumtgz option to --md5sum because starting at + Slackware v13, the package format has been expanded to several + other compression types; updated slacktrack(8). + * No longer suffix ".tgz" to a package name if the ".tgz" extension + wasn't specified. This allows you to specify one of the new alternate + package file extensions: .tgz, .tbz, .tlz and .txz + * Added /usr/share/slacktrack/ln which is an ln wrapper. + This calls /bin/ln with the -f (force) option which allows the + time stamp to get updated on symlinks. + Thanks to Jim Hawkins for writing this wrapper. + +19-Nov-2008 - v2.01 + * Added /var/cache/ to the default exclude list. + This excludes SAMBA's 'browse.dat'. + Thanks to Eduard Rozenberg for the suggestion. + * Updated 'dvd_libs' example build scripts to use libdvdcss-1.2.10 + and verified the source URLs for the other components. + (You must still download the source yourself). + +17-Sep-2008 - v2.00 + * The 'slacktrack' tool is now what used to be shipped as 'altertrack'. + This tool tracks installations directly within a live root file system + rather than a pseudo root file system. + + ** Important: This means that you *MUST* now run slacktrack on a + devbox only ** + + Please read /usr/doc/slacktrack*/RELEASE_NOTES for + important details about migrating from the previous version of + slacktrack. + + + * Changed to BSD licence for 'slacktrack' and 'slackdtxt' tools. + The only reason it was previously GPL was because this was the licence + installwatch used. + * Updated documentation & man pages. + * A GPG signing key must be specified when using the -G,--gpg-sign option; + it will not fall back on the default. This is because the code + to parse the command line operators doesn't work. I checked + the supplied examples for getopt and even they don't work! + (Perhaps it used to work with older versions of bash?) + * Added -P, --delete-perllocalpod option. + This deletes any 'perllocal.pod' found within the package's /usr/lib. + perllocal.pod files should only be included with the Slackware 'perl' + package. + * The -Q (set options to build a Slackware compliant package) option now + sets the -P, --delete-perllocalpod options. + * Removed --froot operator. This used to run the 'fakeroot' daemon + and LD_PRELOAD the fakeroot library to make your user environment + appear as if were root, with the intention of allowing package utilities + to set ownerships of files/dirs -- an ability allowed only for root. + However, since slacktrack needs to be run as root to make a useful + package (it's unlikely you'd use slacktrack to track files in a + non-root location, eg /mypackages/), then this option is defunct. + * Removed --with-scratchbox. This deleted the /dev and /home + directories that used to find their way into early ARMedslack packages. + ARMedslack has not used scratchbox in years, and I can't imagine + anybody else ever used this option! + * Build script examples are now bundled with the package rather than + being on a separate web site (since there's no cholestrol + from installwatch) + * Added "/dev/input$|/dev/input/|/dev/.udev/|/dev/.udev$" to the default + exclude list because udev is now keeping some live data in there. + +08-Feb-2008 - v1.33 - build 1 [ Not released ] + * Replaced installwatch with 'libsentry' - a fork of installwatch + by Gilbert Ashley. + +29-Jun-2007 - v1.32 - build 1, Slackware 12.0 special version. + * Fixed a bug where if --stripallexec was used, it wasn't stripping + all ELFs (.so, bins & .a files). + * Replaced slacktrack script with a dummy for the release of + Slackware 12.0. The new *at-style functions that coreutils 6.7+ + are not tracked by installwatch, so chown, chmod et al do not work. + The real slacktrack script (if you wanted to use it) is named + /usr/bin/slacktrack-real + +05-May-2007 - v1.31 - build 2 + * Fixed a bug in altertrack's --touch-filesystem-first code. + See docs/ChangeLog.altertrack. + * Updated slacktrack(8): -Q option now states that files in binary + directories are chown root:root not root:bin. + Thanks to Eduard Rozenberg for noticing that. + +31-Mar-2007 - v1.31 - build 1 + * When gzipping man & info pages, force compression (gzip -f) + * Applied Fred Emmott's portable patch to installwatch to make it + work on 64bit machines. + +19-Feb-2007 - v1.30 - build 1 + * Move installwatch library from /usr/lib/installwatch.so + /usr/lib/installwatch-slacktrack.so + This prevents an installation conflict with checkinstall. + Thanks to Henrik Carlqvist for the suggestion. + +04-Apr-2006 - v1.29 - build 1 + * Added new option, -m|--chown-bins-root-root + This sets ownerships of files and directories in the standard Slackware + binary directories to 'root:root'. + This change is for Slackware v11 - binary directories are no longer + chown root:bin. + * The -Q option now sets -m rather than chowning root:bin. + If you want root:bin, specify the -f and -e options. The command would + look something like this: + + # slacktrack -Q -fe -p moose-1.0-i486-1.tgz ./moose.build + + * Added /media,/srv and /selinux to the 'watch' patch exclusion list + (any changes to these paths will be excluded from the package). + Updated slacktrack(1) with the new paths. + +14-Nov-2005 - v1.28 - build 1 + * Fixed a bug where any man page symlinks broken by gzipping were not + being repaired. + Thanks to Andrei Levin for the bug report. + +22-Sep-2005 - v1.27 build 1 + * Rewrote the slack-desc file to explain what slacktrack actually does + in simple words :-) + * Added /var/lib/rpm to list of excluded paths. This allows you to + do some seriously kludgey stuff like build from a source RPM and + install the binary RPM as part of the build script. + Very useful sometimes - docbook is an example :-) + * Fixed bug where if a temporary directory was manually specified with -T, + its contents were tracked by installwatch. Manually set temporary + directories are now in installwatch's exclude list. + Thanks to Gufo for reporting this. + * slacktrack will now return error code 6 and abort if it finds the + temporary directory (either chosen automatically or selected via the + -T|--tempdir option) already exists. This is to prevent slacktrack + from wiping user data without any warning. + slacktrack does not create a sub directory within the specified area; + it was never designed to do so, so this is the best option. + * Modified man page to reflect the above change, and added error code 6 + to the error code section. + Thanks to Gufo for suggesting this change. + +22-Jul-2005 - v1.26 build 1 + * Added /opt/kde/man to the list of man page directories. + +08-May-2005 - v1.25 build 1 + * Renamed internal string 'VERSION' to 'SLACKTRACKVERSION' as it's + too much of a generic name and can cause confusion as it's exported + to the build script/environment. + +21-Mar-2004 - v1.24 build 1 + * Added /sys to the list of excluded paths + * Fixed bug with chowning files that was introduced in v1.19. + Files with brackets in the name would get interpreted by bash. Now + these names are enclosed within '' to prevent this. + * Trimmed down --help text a little - it's too wordy. + * Added a patch to installwatch which was posted by Alexander Kern on the + checkinstall mailing list: + It adds simply "utimes" and "setxattr" to the list of + intercepted functions. + - Please note, however, that I am aware that there seems to be a problem + with installwatch on Slackware-10.1, although it does not show up when + building all software. I am looking to replace installwatch with + something specifically for slacktrack. + +09-Dec-2004 - v1.23 build 1 + * Upgraded to installwatch-0.7.0beta4 from checkinstall-1.6.0beta4 + * Fixed bug where you were informed that there were "orphaned" libraries + and dependencies upon installed packages, but the list was blank. + This was because the file contained spaces and therefore passed the + if [ -s ] check. + +16-Nov-2004 - v1.22 build 1 + * Fixed a bug where if --notidy was specified and slacktrack/altertrack + failed to track any changes, the temporary workspace would be deleted. + This became a bug when I introduced $SLACKTRACKSCRATCHDIR; if a build + fails then the developer will be interested in looking at the source + tree which should always be preserved by --notidy. + * /usr/local/bin, /usr/local/sbin and /usr/X11R? directories & files + contained within will now: + - be chown root:bin + - be stripped (with the same strip option as the major bin directories) + * man pages in /usr/X11R?/man will now be compressed. + * Updated slacktrack(8) to reflect the above two changes. + * Fixed a typo in --help and added a suggested usage line. + * If an incorrect parameter is specified then --help is directed to STDERR. + * If no parameters are specified (or there has been no package name + specified) then the usage message is directed to STDERR. + * Updated the TODO list. + * Updated the OVERVIEW document (last update was 09-Dec-2003) + - Added a couple of new architectures (official & unofficial ports) + and made a note about i586 binary packages + - A couple of other minor edits. + +26-Aug-2004 - v1.21 build 2 + * Tidied up slacktrack.SlackBuild + * Updates to altertrack + +19-Jun-2004 - v1.21 build 1 + * Only strip debugging symbols (strip -g) from object files in .a archives + because --strip-unneeded tends to render many object files unusable. + If you're sure you know what you're doing and want to use strip + options other than -g, then I suggest doing this inside your build + script or (if using altertrack) in your post build script. + Updated slacktrack(8) to reflect this. + * Use strip -p to preserve dates/time stamps. + * Fixed a typo in the package info display prior to building the package. + +31-May-2004 - v1.20 build 1 + * Changed chown uid.gid to uid:gid + +25-Mar-2004 - v1.19 build 1 + * With the recent version of the coreutils package in Slackware-current + (coreutils-5.2.1), chmod no longer preserves setuid bits. This means + that if you elect to chown root.bin the binaries, you lose setuid. + I have implemented a work-around which works with both the new and old + coreutils chown. + +03-Mar-2004 - v1.18 build 1 + * Strip archive files (.a) with --strip-unneeded, as using strip without + this option causes the contents of some archive files to be unusable. + Thanks to longname@sezampro for reporting it. + +12-Feb-2004 - v1.17 build 1 + * Added --froot option to start the fakeroot server prior to setting + ownerships and so on. This may be helpful if you are not root on + the machine where the packages are being prepared. However, if the + build script or 'make install' sets its own ownerships, these will + be lost because the fakeroot server is not started until *after* the + build script finishes. The reason for this is that fakeroot can make + some configure scripts fail. If you know that the configure script + you are using does *not* fail under fakeroot, I suggest that you still + use fakeroot ./trackbuild.xxx + -- Please note that due to the path to the fakeroot libraries, slacktrack + only works with fakeroot-0.8.3 and up + You can download the latest version of a fakeroot Slackware package + builder from http://www.slackware.com/~mozes -- + * Upgraded to installwatch-0.7.0beta3 from CheckInstall 1.6.0beta3 + +12-Dec-2003 - v1.16 build 1 + * Updated docs/OVERVIEW + * Updated docs/TODO + * Bumped up version number for release. + +10-Dec-2003 - v1.15 build 5 + * Tidied up slacktrack.SlackBuild + Most of the recent changes have been in altertrack (bug fixes) which + is why the version of slacktrack itself hasn't been updated. + The usr/doc/slacktrack-version directory is now + usr/doc/slacktrack-version_build + because (at present) the build number is important to this project + because it changes more than the major slacktrack version number. + * Mentioned installwatch segfaulting in the FAQ. + +01-Nov-2003 - v1.15(release) + * altertrack is now included within the binary .tgz package because + I'm satisfied that it is just as safe as protopkg, and it enables you + to build packages from .build scripts that do not work with + slacktrack/installwatch. + +29-Oct-2003 - v1.15rc1 + * If running under fakeroot then remove fakeroot from the list of + dependencies (it's included because it's LD_PRELOADed) + (suggested by Emanuele Vicentini). + Patch from Emanuele Vicentini: + * Redirect file descriptor 2 to 1 so that the slacktrack log file + contains anything sent to STDOUT. + +22-Oct-2003 - v1.15 + * Added --showdeps option to log to screen and a log file what + _installed_ Slackware packages your new package relies upon. + The purpose of this for interest only but I find it useful to ensure + I haven't just built a package on a box that Xfree86 installed + and I intend to install and use the package on a box that does not, + when the package has linked against X's libraries. + Using this option will also flag up 'orphaned' libraries (ones that + do not belong to an installed package, which is especially handy + if you're going to be distributing a package). + * Added another question to FAQ. + * Bomb out if /var/log/packages or /var/log/scripts is missing. + +20-Oct-2003 - v1.14 [beta only] + * When stripping shared objects (.so files), look for 'shared' rather + than 'shared objects' (in the output from 'file') as this was causing + some files not to be stripped (PHP is an example). + * Added --mpopts option to allow the inclusion of additional options + (e.g. --prepend) to Slackware's 'makepkg' program. + * Fixed bug where by the .txt description file wouldn't be created if + you had specified a seperate build store directory that didn't end + with a / + * No longer create the /install directory because if your build script + fails to create any files then you don't see the warning slacktrack + gives you. I could code around this but I think it's cleaner this way. + * Added /root to the list of directories that will not be included within + the package. This should help with using ccache when compiling as root. + You should still see docs/FAQ for help with non-root users. + It also helps with building CPAN modules. + * Updated the FAQ with information about using perl -MCPAN -eshell + (turn off logging and the CPAN interface console will work) + * Fixed bug where by gzipping info pages wouldn't gunzip .bz files first + * Forked slacktrack into another script named 'altertrack'. This works + in a similar fashion to Pat's 'bp' and David Cantrell's 'protopkg' in + that it compares the differences between the file system before and + after 'make install', rather than using installwatch. + This script is available only in the source distribution and is + totally unsupported (but it works for me). There is an example + build script contained within the source in the 'examples-altertrack' + directory. + * Moved fakeroot's build script (and source) out of slacktrack's source + and on to http://www.slackware.com/~mozes because it's + more useful there. + +01-Oct-2003 - v1.13 + * Warn if /install/slack-desc not found or 0 bytes + * The package's /install directory is now created by slacktrack + _before_ it executes your .build script. This saves you a line + in your .build script, plus it's required in order + to meet Slackware package standards (because 'slack-desc' lives + within /install). However, if you do not wish to have a /install + directory within your final package, you may delete it within + your .build script ( rm -rf ${SLACKTRACKFAKEROOT}/install ) + * Updated dependency checking code so that it can handle packages + that begin with the same name (e.g. 'glib' 'glib2'). + * Updated the fakeroot build scripts for version 0.7.8 + Patches from Emanuele Vicentini: + * Added -Q, --standard options that specifies all command line switches + required to create a .tgz file that complies with the Slackware standard. + * Added -G, --gpg-sign option that will sign the resulting .tgz + package file with the default user's GnuPG key and placed the + detached, armored signature (.asc file) in the package store + directory. + * Fixed the value of GZINFO (which should be "No" according to the + man page but was "Yes") + * Updated man pages, typos fixed and so on. + + The easiest way to build a package is now: + # slacktrack -Qp foo-1.13-i486-1.tgz ./foo.build + +11-Jul-2003 - v1.12 + * Added -D, --md5sumtgz option that will create an MD5sum of + the resulting .tgz package file. + * Fixed problem with checking the exit code from getopt + (reported by Emanuele Vicentini). + * Added a preemptive FAQ + * Merged Patrick's changes of slacktrack.SlackBuild into mine + slacktrack.SlackBuild now also creates its own slacktrack-*.txt file + +22-Jun-2003 - v1.11r2 + * I'd missed single quotes from a few find commands - fixed. + +02-Jun-2003 - v1.11 + * -S, --stripallexec will now strip .a (archive) files. + * -A, --striparchives option added. This option strips .a archives. + Suggested by Patrick Volkerding. + * slacktrack.SlackBuild no longer includes the large collection of + example scripts into the resulting package .tgz; they're now + maintained in a separate archive (slacktrack-examples-v??.tar.gz) + available from http://www.slackware.com/~mozes + +28-May-2003 - v1.10r2 + * If deleting 'usr/info/dir' then append this info to the log. + +22-May-2003 - v1.10 + * Before gzipping man or info pages we now find any bzip2 (.bz2) files + and unpack them. I have found that BitchX installs BitchX(1) as + a bzip2 file. There is no slacktrack option to turn this feature off + because if we gzip the bzip2'd man page, the man program won't + work with the file. + * Added -K, --delete-usrinfodir option. If this option is specified + then slacktrack will delete the file 'usr/info/dir' if it is + found in the package. + This file is a special file used by the 'info' program. To quote + texinfo's 'dir' file: + "This (the Directory node) gives a menu of major topics." + Many programs create their own 'info' file. However, using slacktrack + (or even a clean SlackBuild script), any such attempts to create + an up to date 'info' file result in the file only containing + information about the particular program (or set of programs) + you have just compiled. + Therefore you will usually want to delete this file from your + package so as to avoid overwriting the system version when you + install your new package. + The default is not to delete usr/info/dir. + * As an example, I typically invoke slacktrack as: + # slacktrack -gfenzKSUIp package-1.00-i386-1.tgz ./package.build + + +16-May-2003 - v1.09 + * Added exported variable: SLACKTRACKSCRATCHDIR + This variable points to a 'scratch' dir inside slacktrack's temporary + path. Should they wish to do so, the authors of the build scripts + can use this directory to save them 'managing' their own temporary + directories where they unpack the source archives and so on. + This directory is subject to the same conditions as the rest of the + slacktrack temporary path -- it will remain if --notidy is specified. + * Added paragraph in slacktrack(8) that talks about the exported environment + variables. + * Now use date +%s to create more randomly named temp directory for installwatch + This reduces the possibility of conflicting with another user who is + running slacktrack on the same system. + * Modified afio.build to demonstrate using ${SLACKTRACKSCRATCHDIR} + * Modified tf.build to use ${SLACKTRACKSCRATCHDIR} & to prevent it from + confirming the compile-time settings with the user. + * Tidy up of the build scripts in the docs dir. + * slacktrack(8) & slackdtxt(8) release dates now always in sync with + their respective scripts. + +07-May-2003 - v1.08r3 + * Updated a few docs + * Fixed a comment typo in the slacktrack script + * Tidy up of 'SlackBuild' script + * Other misc tidying. + +03-May-2003 - v1.08r2 + * If the command line/script provided exits with an error code we now + display the error code as well as a warning message. + * Moved slacktrack and slackdtxt to /usr/bin rather than being in + /usr/sbin. This is because we can use slacktrack with 'fakeroot' + from the Debian distribution. fakeroot fakes root privileges, thereby + allowing slacktrack to chown correctly. Therefore we can sensibly + use slacktrack as user other than root. + + To use slacktrack with fakeroot you could do this + # fakeroot ./trackbuild.fetchmail + + less through the resulting package .tgz to verify that the permissions + are what they ought to be. Obviously there will be some issues with + using fakeroot but it should be pretty useful for users without root + access. + I have packaged up fakeroot and you may download it at + http://www.slackware.com/~mozes + I have included by fakeroot build script within slacktrack's source + ball - slacktrack/misc/fakeroot/ + +28-Apr-2003 - v1.08 + * Added -N, --strip-prog to allow the user to specify the location + of the strip binary. This allows me to start cross compiling + stuff with slacktrack stripping the binaries. + * Renamed my wrapper scripts from 'SlackBuild' to 'trackbuild' to + avoid any confusion & updated docs to match. + * If specifying an alternate package store dir, now suffix the path + with a / + * Now reports size of .tgz if a .tgz is built + * No options are 'Advanced' - they are now just options + * Added -R, --run-after facility to make slacktrack execute a given + command prior to running makepkg. The purpose of this is to allow + the user to specify a program such as mc (Midnight Commander) to + inspect the package directory contents and possibly make changes + before slacktrack creates the .tgz + [] Note: The CWD is changed to the package's root directory before + the external command is executed. This allows you to specify + -Rmc and have Midnight Commander load and automatically + display the root dir of the package. + * -T wasn't accepting the specified path. Fixed. + * -g,--chmod644docs also now does chown -R root.root /usr/doc. I am finding + I need to do this in build scripts a lot so I figured since I'm already + chmod 644ing I may as well just chown them to root since they always + are in Slackware packages anyway ! + +16-Apr-2003 - v1.07 + * Added the facility to gzip info pages & updated slacktrack(8) to match. + -I, --gzinfo + -W, --extra-infodir <path> + -F, --gzinfo-no-symfix + * Switched @uksolutions email addresses in example build scripts with + @polplex.co.uk + * Added two build scripts for GNU VCD Imager into the docs/examples/non-slackware + directory. There are two scripts: + vcdimager.build -- this is for use with slacktrack + vcdimager.SlackBuild -- this is a 'clean' SlackBuild script + that installs the package into a clean + dir by doing make DESTDIR + The purpose of having these two scripts is for anybody who is + interested in building their own packages; it enables you to + compare and contrast the differences... or something :) + +01-Apr-2003 - v1.06 + * --extra-libdir, --extra-bindir, --extra-mandir added to allow + the user to specify additional directories that slacktrack should + consider when stripping binaries and gzipping man pages. + Note that any binary directories specified by --extra-bindir + will NOT be chown root.bin + Suggested by Darren Austin + * No longer chown root.bin in /usr/local/{sbin,bin}/ + as it's not the Slackware standard to chown root.bin in any dirs other + than /sbin, /bin, /usr/bin & /usr/sbin + +26-Mar-2003 - v1.05 + * Now considers usr/local for man page, binary and .so files after + Darren Austin gave a convincing argument as to why one may wish to + use /usr/local + +22-Mar-2003 - v1.04-build-2 + * Moved Change Log details into separate file - 'ChangeLog.slacktrack' + to save cluttering the slacktrack script. + * Added zlib build script to the list of Slackware example build scripts + This script downloaded the Slackware bits and also patches in the + security patch from OpenPKG. + * Added NVIDIA_GLX-1.0-4191 and tinyfuge example slacktrack build scripts + * Fixed a few typos and grammar problems in the docs + * Tidied up a few comments & code in the slacktrack script + - No new features added. + +10-Mar-2003 - v1.04 + * Added --stripallexec option to strip any unstripped ELF executable files + in the entire package directory. This means that slacktrack will find all + files in non-standard Slackware directories such as /opt. + * Added 'short' command flags for the advanced options. + +02-Mar-2003 - v1.03 + * Make sure we have specified a package name before proceeding + * Bomb out & tidy up if no files or dirs are found in /var/tmp/slacktrack/TRANSL/ + this saves makepkg building a package of the current directory & it also + indicates that installwatch failed to track any activity, thus has no files + to package. + * Fixed problem with the location of installwatch's log file. + * Lots of error checks + * Exit codes now have meaning; read slacktrack(8) man page. + * If build store dir doesn't exist then change it to /tmp rather than + creating it without warning. + +01-Mar-2003 - v1.02 + * Added --chmod644docs option + * Renamed SLACKTRACKPSEUDODIR to SLACKTRACKFAKEROOT because it makes more + sense. + +28-Feb-2003 - v1.01 + * Stopped dumping all output to /dev/null when gzipping man pages + as this doesn't always work + * Added code to fix broken symlinks caused by gzipping man pages + Added --gzman-no-symfix command line option to prevent this behaviour + * Added --chown-bdirs-root-bin & chown-bfiles-root-bin (-e,-f) options + to chown root.bin the system binaries installed into /usr/bin and so on + This behaviour is specified in Pat's 'slack-tools' README file. + +22-Jan-2002 - v1.00 + * Created diff --git a/source/d/slacktrack/slacktrack-project/docs/FAQ b/source/d/slacktrack/slacktrack-project/docs/FAQ new file mode 100644 index 00000000..98ea7d7c --- /dev/null +++ b/source/d/slacktrack/slacktrack-project/docs/FAQ @@ -0,0 +1,234 @@ +################################################################ +# Document: FAQ +# Purpose : Frequently asked questions +# Author..: Stuart Winter <mozes@slackware.com> +################################################################ +# It's small at the moment but if I get any repeated +# or potentially repeated questions then they'll be added +# here. +################################################################ + + +Questions +--------- + +1. My build script places files into /home, but these are not + included in the package created by slacktrack. Why? + +2. Do I really have to remove the existing package before + building a new version with slacktrack ? + +3. I want to build a package of DVD libraries and players + but the players depend on the libraries being installed + first. How can I build such a package with slacktrack? + +4. I find that when building packages with slacktrack, a number of + files are appearing in the package that do not belong there. Why? + +5. What does slacktrack's --touch-filesystem-first option do? + why would I need it? + +6. I can't compile Perl CPAN modules via perl -MCPAN -eshell + Why ? + +7. I'm using Slackware v13 (or greater) and I want to create + package files using one of the other compression methods. + How can I do that? + +8. After completing a build using slacktrack, I see + "You have mail in /var/mail/root" + but I have no new email. + +Answers +------- + +Q1. My build script places files into /home, but these are not + included in the package created by slacktrack. Why? + +A1. slacktrack (by design and thus default) excludes /home + from being included within the package. The reason for this + that typically no package shipped should ever contain + data within /home. + +Q2. Do I really have to remove the existing package before + building a new version with slacktrack ? + +A. No (see my zlib example), but in the majority of cases, + I'd advise that you do. + + The reason that my example trackbuild scripts remove the + existing package first (or bomb out) is because some + package installations (makefiles) will not install a + new file onto the filesystem if it's identical to the + one in the source archive. This means that slacktrack + will not notice any change in the before and after picture + of the filesystem; thus your resulting package may + be missing some files. + + The way to work around this is: + 1. removepkg the package prior to building; + 2. Use the --touch-filesystem-first option; + But this option is not recommended since it destroys the + time stamp information on your system. + This option should only be used by experts using a disposable + OS installation. + Please see FAQ question 5. + + It's worth noting that Slackware's 'removepkg' program + won't always remove all files (especially config files + which are packaged as /etc/file.new and are renamed to + /etc/file by install/doinst.sh). + + It shouldn't be too much of an issue though. If it's a + brand new piece of software that you are building from + scratch then installwatch will pick up all new files. + If you're rebuilding a Slackware package using a + .build script from the source tree then it's worth + browsing the package's contents ( # cat /var/log/packages/lftp-* + for example ), then running 'removepkg' and looking at its + output. If there are any remaining config files then either + move them to a safe place or delete them before + building your package with slacktrack. + + In general though you shouldn't have any problems. + + +Q3. I want to build a package of DVD libraries and players + but the players depend on the libraries being installed + first. How can I build such a package with slacktrack? + +A. There are two ways. + 1. You either write build scripts for each individual + library and create packages for each. Once the packages + have been built, you install them prior to building + the player. + You then unarchive all packages into a temporary + directory and run makepkg over it. + 2. Use slacktrack and build them all one after another as + you no doubt have originally attempted. + + I have included example build scripts for a DVD library + package within slacktrack's source archive. + + +Q4. I find that when building packages with slacktrack, a number of + files are appearing in the package that do not belong there. Why? + +A. The way that slacktrack works is that it: + [a] takes a snapshot of the files and directories on the file system; + [b] runs the build script + [c] makes another snapshot of the files & dirs on the file system; + [d] compares the two snapshots and determines the differences + [e] the differences between the two snapshots constitute the package + contents + + The problem with this approach is that other running programs can + make modifications to files & dirs on the file system during the + build/compilation process. slacktrack will consider these modifications + to be part of the package -- slacktrack does not directly track what the + build process does: it *only* compares the differences between the + file system snapshots. + + Major culprits for this are: + cups + crond (running cron jobs) + Window Managers and X + + When using slacktrack you are advised to reduce the number of + processes to the minimum, and try to ensure that there are no processes + running which will modify the file system during the build process. + + If you cannot do this then you there are a number of work arounds: + [a] Using the -x (--exclude) operator. + With this operator you can specify a list of + paths to exclude from the file system snapshots, thus excluding them + from the resulting package. + [b] Use the -R (--run-after) operator. + With this operator you can specify a command that will be run after + slacktrack has compiled the package contents. + You may wish to run 'mc' (Midnight Commander) or perhaps just a 'bash' + shell; this will enable you to inspect and modify the contents of the + package prior to it being turned into a package file. + +Q5. What does slacktrack's --touch-filesystem-first option do? + why would I need it? + + This option touches all files this pre-set location on the host's + filesystem: + /opt /bin /boot /dev /etc /install /lib /sbin /usr /var + + It *excludes* by default '/lib/udev/devices' since this contains + live device data that doesn't take kindly to being touched. + You may see errors from 'touch' about certain binaries, including + /sbin/vol_id because this is a symlink into /lib/udev/devices. + + This will touch every file within those directories, destoying all the + timestamp information. + This is intended to be used on a throwaway development installation + that's reinstalled daily or more often. Builds will often leave + residue strewn about, so don't use this on your "good" machine and + think you're managing it properly. :-) + + The reason behind this is that if you run slacktrack and your build + partially fails, then it will leave some data on the filesystem. + You then fix the problem and re-try: this time the build may succeed. + However, if the original data on the filesystem from the first + part-failed build has *not* changed (ie if it was some static data that + was copied with cp -a (preserved time stamp & ownership)) between + the first part-failed build and second successful build, slacktrack + will miss this data from the final package. + + This option updates the file stamps contained within standard package + directories, therefore allowing slacktrack to detect changes + (even if the data contains an *old* time stamp from 1982, it will still + detect the difference). + +***** This is an expert option: Please don't use this option unless you do + not care about your operating system installation ***** + + +Q6. I can't compile Perl CPAN modules via perl -MCPAN -eshell + Why ? + +A. If you get this message: + Unable to get Terminal Size. The TIOCGWINSZ ioctl didn't work. + The COLUMNS and LINES environment variables didn't work. + The resize program didn't work. + + the answer is to tell slacktrack to turn off logging. + eg: + # slacktrack -Qnp foo-1.0-i486-2.tgz ./foo.build + +Q7. I'm using Slackware v13 (or greater) and I want to create + package files using one of the other compression methods. + How can I do that? + +A. It is 'makepkg' from the 'pkgtools' package which handles + the compression, based upon the extension of the package + file name supplied to it. + + The compression methods & file names are: + + .tgz - Gzip + .tbz - Bzip2 + .tlz - LZMA + .txz - XZ + + + Examples: + + # slacktrack -Qp foo-1.0-i486-1.tgz ./foo.build + # slacktrack -Qp foo-1.0-i486-1.tbz ./foo.build + # slacktrack -Qp foo-1.0-i486-1.tlz ./foo.build + # slacktrack -Qp foo-1.0-i486-1.txz ./foo.build + + +Q8. After completing a build using slacktrack, I see + "You have mail in /var/mail/root" + but I have no new email. + +A. This is because you used the '--touch-filesystem-first' or + '--touch-filesystem-faster' option at build time. + This option has touched all of the files on the file system, which + refreshes their date stamp. The mail notification system works only on + the date stamp of the mail spools, hence it triggers the message. diff --git a/source/d/slacktrack/slacktrack-project/docs/INSTALL b/source/d/slacktrack/slacktrack-project/docs/INSTALL new file mode 100644 index 00000000..8b74c9f1 --- /dev/null +++ b/source/d/slacktrack/slacktrack-project/docs/INSTALL @@ -0,0 +1,9 @@ + +In order to build slacktrack: + + # ./slacktrack.SlackBuild -i + +This will create a Slackware package of slacktrack +and install it. + +The resulting package will reside in /tmp. diff --git a/source/d/slacktrack/slacktrack-project/docs/OVERVIEW b/source/d/slacktrack/slacktrack-project/docs/OVERVIEW new file mode 100644 index 00000000..fb99b247 --- /dev/null +++ b/source/d/slacktrack/slacktrack-project/docs/OVERVIEW @@ -0,0 +1,595 @@ +############################################################################## +# Document: OVERVIEW +# Purpose : Provide an overview of the Slackware package system incorporating +# the use of 'slacktrack' +# Please note that this is *not* a guide to the use of slacktrack; +# the man page and SlackBuild scripts in the 'examples' directory +# aim to fulfill that requirement. +# Date....: 15-May-2009 +# Author..: Stuart Winter <mozes@slackware.com> +# Homepage: http://www.slackware.com/~mozes +############################################################################## + + +CONTENTS: +--------- +1.0 Preamble +2.0 Slackware packages + 2.0.1 Format of official Slackware packages + 2.0.1.1 Package names + 2.0.1.2 Version numbers + 2.0.1.3 Architectures + 2.0.1.4 Build numbers + 2.1 An overview of the creation of official Slackware packages + 2.1.1 'Clean' and 'dirty' builds + 2.1.1.1 Clean builds + 2.1.1.2 Dirty builds + 2.1.1 SlackBuild and .build scripts + 2.1.1.2 SlackBuild scripts + 2.1.1.3 .build scripts + 2.2 slacktrack in the scheme of things + 2.2.1 Using slacktrack with official .build scripts + 2.2.2 Writing your own .build scripts for slacktrack + 2.2.2.1 Making use of slacktrack's environment variables +3.0 slacktrack in operation + 3.1 How slacktrack finds which files have been installed +4.0 Example scripts + 4.0.1 non-slackware example build scripts + 4.0.2 slackware example wrapper build scripts +5.0 Known problems/features of slacktrack +6.0 New features +7.0 Licence + + + +1.0 Preamble + --------- + +I used to work for a company that provided web hosting and shell accounts. +When I started there were a number of shell servers all running various +releases of RedHat Linux, in various states of repair. I managed to convince +the management to let me try Slackware on there instead because I have a much +stronger understanding of how to maintain and build server using the +Slackware distribution. This trial went well and within a few months all +servers were converted to Slackware version 8.1. + +In order to ease the speed of installation (and to prevent against +forgetting to install or configure something critical), I wrote a +set of post installation scripts that upgraded Slackware packages, +configured numerous config files and copied pre-compiled software +(such as courier IMAP) onto the new system. +For other software that I could not simply copy, I'd compile it on the +new server. + +However, it soon became clear that due to security updates and so on, +it became incredibly time consuming (not to mention seriously boring) +to compile PHP, Apache and so on on every server. + +At this point, I began to investigate how to create packages for Slackware. + + +2.0 Slackware packages + ------------------ + + The Slackware Linux distribution consists of a variety of 'packages' + that make up the distribution. + + Traditionally, all packages are in '.tgz' format (a gzipped tar archive). + Starting with Slackware v13, new compression formats are supported which + are represented by three additional file extensions: + + .tgz - Gzip + .tbz - Bzip2 + .tlz - LZMA + .txz - XZ + + In this document, we use the file extension '.t?z' to represent + one of the above file formats. + + Once you have initially installed Slackware from the installer screen, + you have the facilities to install, remove or upgrade new or existing + packages using the package management tools: + + installpkg <package.t?z> - install 'package.t?z' + + upgradepkg <package.t?z> - upgrade existing 'package' with the + new version specified at the command line. + + removepkg <package> - remove specified package + + + Whilst the Slackware package system is not especially feature rich, + Slackware's user base (including me) like it because it is simple. + If we want to write our own package utilities then we can easily do so + by examining the existing package tools and querying and amending the + package database (text files). + + 2.0.1 Format of official Slackware packages + ------------------------------------- + + In Slackware 8.1 and up, each package file is named as follows: + + packagename-version-architecture-buildnumber.t?z + + 2.0.1.1 Package names + ------------- + + The package name is either the name of the single program + or the name of a collection of utilities that fall under + a single umbrella. + For example: + autoconf-2.54-noarch-1.tgz + + That is the name of the autoconf package I have on my + Slackware 8.1 box. + 'autoconf' is the name of the the entire collection of + binaries and associated documents that are extracted from + the autoconf source distribution archive. + + However, if we consider another example: + tcpip-0.17-i386-15.tgz + + There is no single piece of software called 'tcpip'. + This package contains a number of associated utilities + written by different authors but bundled into one single + 'package'. + + 2.0.1.2 Version numbers + --------------- + + If the package is the name of a particular piece of software + such as 'autoconf' from the example above, then the version + number represents the version number that its authors distribute. + + If the package is a 'bundle' such as 'tcpip' then the version + number increases as and when you add a new piece of software to + the package, or upgrade a particular piece of major software + contained within the package. + For example, with 'tcpip' above, the 0.17 refers to the version of + Linux Netkit. However, there are other programs included within + the Slackware tcpip package that are not part of 'Linux netkit'. + + 2.0.1.3 Architectures + ------------- + + The architecture is just that -- it tells you which architecture + the package is for. + + The current values in use are: + + ----- [ Official Slackware architecures ] + + noarch - Architecture independent files such as config files + i386 - packages for the x86 (Slackware v8.1 & 9) + i486 - packages for the x86 (Slackware 9.1+) + i586 - packages for the x86 + i686 - packages for the x86 + s390 - packages for the IBM s/390 mainframe + arm - packages for the ARM architecture + + Note: Whilst Slackware v10 is primarily built for i486, you may + find that there are some packages whose architecture versions + are higher than i486. This is for two reasons: + + [a] There is no source for the package - it is a repackaged + binary distribution (SUN's j2sdk is an example). + + [b] The package is not required or otherwise not suitable for + earlier revisions of the architecture (this is especially + the true with ARM and SPARC). + + ----- [ Unofficial ports of Slackware ] + + sparc - packages for the SUN Sparc architecture + powerpc - packages for the PowerPC architecture + + 2.0.1.4 Build numbers + ------------- + + A build number suplements the version number and is changed + when the *package maintainer* makes a change to the package but + the original source code and version number remains the same. + + For example, I build a package of 'foo' version 0.14 for the + sparc. I have never built this package before, thus it becomes + foo-0.14-sparc-1.tgz + However, I realise that I haven't configured + the 'bar' parameter correctly in /etc/foo.conf. I fix it + and re-build the package. The package is now named + foo-0.14-sparc-2.tgz + + + 2.1 An overview of the creation of official Slackware packages + ----------------------------------------------------------- + + This section gives a brief introduction of the two methods of + used when building the official Slackware packages. + + + 2.1.1 'Clean' and 'dirty' builds + -------------------------- + + I am assuming the reader has some experience with Makefiles + and has compiled and installed a number of software packages. + + 2.1.1.1 Clean builds + ------------ + + I term a 'clean' package one where you can specify a variable + to the 'make install' which contains the directory you wish to install + the package in, rather than installing it properly over the root file system. + For example: + # ./configure --prefix=/usr --sysconfdir=/etc + # make + # make install DESTDIR=/tmp/package-foo + + With a 'Makefile' that honours the DESTDIR variable, this will + install the whole package into /tmp/package-foo. This directory + effectively is the 'root' directory '/' as far as the Makefile + is concerned. + + From here you can use the Slackware 'makepkg' program and build + a package. + + This is by far the safest and most preferred method by all + users that make packages. + + You will find that DESTDIR is called prefix, TOPDIR and other names; + you need to examine the Makefile scripts in order to determine whether + it contains this functionality and if it does, then discover what + the variable name is. + + 2.1.1.2 Dirty builds + ------------ + + A 'dirty' build is the name I give to source distribution archives + whose Makefile scripts do not have any provisioning to install + in an alternate directory other than root. + + For these type of builds, you will typically do: + # ./configure --prefix=/usr --sysconfdir=/etc + # make + # make install + + The package will then be installed on the root filesystem. + + So how do you know what files were installed where and + even if you did, how do you pull all these files together in order + to run makepkg over them ? + That's the purpose of slacktrack! :-) + + + 2.1.1 SlackBuild and .build scripts + ----------------------------- + + Slackware has a number of packages by a great number of authors. + Some of the packages's source Makefiles honour a DESTDIR type + variable but others do not. + + 2.1.1.2 SlackBuild scripts + ------------------ + + SlackBuild scripts can be 'interesting'. They are + scripts that install into a 'clean' environment (usually /tmp). + + Some of the scripts follow the make install DESTDIR= + style, if the Makefile permits. + + Others have a 'framework' or 'controller tarball' which is + a _packagename.t?z (note the prefixing underscore). + + The SlackBuild script uses the Slackware 'explodepkg' script + to untar the contents of the _.t?z into the /tmp-package<name> + directory. + Slackbuild then runs 'make' to compile the binaries + and libraries, but then uses the 'cat' program such as: + # cat foobar > /tmp/package-foobar/usr/bin/foobar + + By using 'cat', the *new* version of 'foobar' retains + the original permissions and ownerships that are in the + controller tar ball. + + However, you may be wondering how, if the package does not + have a facility to install into somewhere other than root, + do we get the file names and permissions for the + controller _.t?z in the first place. + The answer is simple: + [a] find all files on the file system and dump to a file. + [b] compile and install the software + [c] find all files on the file system and compare the file + produced by the first 'find'. After a little pruning, you + have the list of files for the controller tar ball. + + + 2.1.1.3 .build scripts + --------------- + + For those software distributions whose Makefile does not hounour + the DESTDIR type system, there are Slackware's .build scripts. + + These scripts literally ./configure ; make ; make install + and copy docs and other goodies into the root file system. + + One of the problems with these scripts is that they are + often incomplete -- they build and install the package but + do not gzip the man pages or strip the binaries and libraries; + this is done manually afterwards. + + *These* are the scripts that slacktrack and altertrack were + written for. + + * Note: Whilst some software's Makefiles may appear to honour + the DESTDIR variable, the Makefile *may* be broken which can + result in files missing or corrupt within your new package. + For example: I built Apache v2.0.48 and built a package using + make install DESTDIR. However, a problem exists in that some of + the Perl scripts it installs have *temporary build paths* + hard coded into the resulting scripts. + This is why you *may* find a .build instead of a SlackBuild + script within Slackware's source tree. + + However, the primary reason is because the build script just + hasn't been updated to make use of DESTDIR. * + + + 2.2 slacktrack in the scheme of things + ---------------------------------- + + I follow Slackware-current quite closly. Often I want to + 'back port' a -current package to an earlier release of Slackware . + I can't simply upgrade with -current's package because it was + compiled for a newer GLIBC than Slackware 8.1's, for example. + For packages that use a 'clean' 'SlackBuild' script, this is + an easy job -- I simply run 'SlackBuild' on an 8.1 box. + + However, for .build scripts, I needed a way of building packages + using Slackware's .build scripts. + + I found a great program called 'CheckInstall' which fulfilled most of my + requirements. However, as time went on and I started building + more of Slackware's packages and writing my own build scripts, I found + that checkinstall was lacking some features that I required. + At this time I was also considering porting Slackware to run on + the ARM architecture and helping with the Splack (Slackware on SPARC project), + and therefore wanted a robust program that can deal with every .build script + I threw at it, and if it can't handle it, I needed to be able to make modifications. + The easiest way of doing this was to write my own script; thus + 'slacktrack' was born. + + slacktrack is based on the *idea* behind 'CheckInstall', but uses + only my own code (and contributions from other users), and only contains + Slackware-specific facilities -- it can not build Debian or RedHat packages + and never will. + + slacktrack does not have all of the facilities of CheckInstall either, + but then these are not required for building Slackware packages + from .build scripts. + + Also, slacktrack only works with 'official' Slackware directory locations + and /usr/local. + For example, if your make install installs binaries in /opt/packagename/bin + and the man pages in anywhere other than /usr/man or /usr/local/man, then + slacktrack's relevant options (eg stripping libs, bins, gzman) will + not detect them. + + + 2.2.1 Using slacktrack with official .build scripts + --------------------------------------------- + + Building a replicar Slackware package from a .build script is + typically fairly trivial with slacktrack. + + If we wanted to build slackware-9.1's elvis, we could do + # cd slackware/slackware-9.1/source/a/elvis + # chmod 755 elvis.build + # slacktrack -jefkzp "elvis-2.1-i386-2.tgz" ./elvis.build + + The resulting package (by default) be stored in + /tmp/built-slackwarepackages/ + + As already mentioned, some of the Slackware .build scripts + are incomplete with regard to gzipping man pages, stripping binaries + and so on -- fetchmail.build is one of them. + Therefore you can specify various options to slacktrack that + will take care of this for you. + The options in the example above : + j - compress libraries + e - chown root:bin /bin,/sbin,/usr/bin,/usr/sbin directories + f - chown root:bin files in the binary dirs listed above + k - strip binaries found in the binary dirs listed above + z - gzip man pages + p - the resulting Slackware package .t?z name + + The way I re-create the packages is to build a 'trackbuild' script that + launches slacktrack with the required options and the name + of the Slackware .build script. You can find examples of such + scripts within the docs directory after installing slacktrack: + + /usr/doc/slacktrack*/buildscript-examples/ + + You will also find that in Slackware versions 12.0 and upwards, + the .build scripts are accompanied by 'trackbuild' scripts because + slacktrack is used by the Slackware team to produce the packages. + + 2.2.2 Writing your own .build scripts for slacktrack + ---------------------------------------------- + + There isn't any specific that you have to do to write a build + script for use with slacktrack -- the script name specified to + slacktrack doesn't even have to be a script - it can be a binary - + as long as it is executable, it is acceptable. + + You can see some of my own build scripts that I have written + for use with slacktrack by looking in the documents directory + after installing slacktrack: + + /usr/doc/slacktrack*/buildscript-examples/ + + 2.2.2.1 Making use of slacktrack's environment variables + ------------------------------------------------- + + slacktrack exports two environment variables: + SLACKTRACKFAKEROOT and SLACKTRACKSCRATCHDIR + + SLACKTRACKFAKEROOT: + ```````````````````` + + The purpose of this to allow your .build script to access the + 'root' directory of the resulting package. + There are two scenarios where you may want to use this + variable: + + 1. During the build: + + The reason you may wish to do this is to pre-populate + the package with files that you may not wish to place directly + onto the root filesystem. + The package contents will only appear inside this directory + once your build script has finished, and slacktrack has determined + what to put into this directory. + + In previous slacktrack versions which used a pseudo-root filesystem + (where the package contents were populated *during* the build), this + made sense, but in slacktrack v2.00, it is unlikely that you'd want + to use this vairable from the build script. + + 2. Post-build -- cleanups after the build: + + The most likely use of this script is to perform package cleanup + tasks after the build. This is mainly to perform tasks that slacktrack + does not handle itself - such as deleting known files/directories that + creep into packages (due to a system daemon such as CUPS), or setting + some file and directory permissions. + + An example post build script is below. + A post build script can be specified by slacktrack's -R option: + + # Incase you had CUPS running: + rm -rf etc/cups etc/printcap + # crond: + rm -rf var/spool/cron + rmdir var/spool + + # perllocal.pod files don't belong in packages. + # SGMLSPL creates this: + find . -name perllocal.pod -print0 | xargs -0 rm -f + + # Some doc dirs have attracted setuid. + # We don't need setuid for anything in this package: + chmod -R a-s . + + + SLACKTRACKSCRATCHDIR: + ````````````````````` + + The purpose of this variable is to provide some temporary + space to untar your source archives and so on. slacktrack + will manage the creation and deletion of this directory. + + For example: + # cd ${SLACKTRACKSCRATCHDIR} + # tar zxvvf ${ORIGPATH}/source/foobar.tar.gz + + You can see in some of the example 'non-slackware' scripts + how I have used these variables + + +3.0 slacktrack in operation + ----------------------- + + The basic event flow is as follows: + + [1] Parse command line arguments + -> Check they are OK, if not bomb out + [2] Launch the supplied build script + [3] Run any specified functions (eg gzman, strip bins, chowns) over the + package 'root' directory and contents + [4] Run Slackware's 'makepkg' program over the package contents + [5] Move the .t?z to the specified build store path + [6] Scan for any hard links that may be in the package + -> If any found, alert the user on screen and also + log to a packagename.hardlinks.log file in the build store path + + The slacktrack shell script is fairly simple and well commented; it should be + relatively easy for anybody who understands bash to quickly comprehend what + is happening and why. + + 3.1 How slacktrack finds which files have been installed + ---------------------------------------------------- + + In order to track the files and directories that have been installed + or changed, slacktrack follows this ordered process: + + [1] Scans a pre-set list of directories on the filesystem and + logs the contents. + [2] Launches build script which installs the package onto the + filesystem + [3] Scans the filesystem once again + [4] Compares the differences in the before and after snapshots + [5] Copies the differences into a 'package root directory' and + runs makepkg over them. + + In slacktrack version 1, we used 'installwatch' which overloaded + some of glibc's filesystem calls, creating new files and directories + into a pseudo-root filesystem, avoiding the need to install onto + the host's filesystem (and also allowing to build as a non-root user). + However, this library is ill maintained and even in the early days + when it worked well, it still had problems and workarounds were required. + +4.0 Example scripts + --------------- + + Included with the slacktrack binary distribution are a number of example + scripts that hopefully should provide you with a basis of how to use slacktrack + to build from 'dirty' source distributions. + + The examples are bundled in the documentation directory available + after installing slacktrack: + + /usr/doc/slacktrack*/buildscript-examples/ + + +5.0 Known problems/features of slacktrack + ------------------------------------- + + Current problems: + + [1] slacktrack doesn't have sufficient error checking. + + I'm in two minds about *where* to put error checking, you see. + Do I go no further if the supplied build script exits with a non-zero + value? + No, that's a bad idea because what if you didn't write the build script? + it might be one of these qmail type binary installer programs that + you can't (easily without hacking the source) fix. The author may + have their own systems, and the program exits with a value that their + own controller script recognises as non-failure. + + What should I do if makepkg has failed? You see it on screen + and in the logs anyway, plus makepkg is one of the last things + that slacktrack calls -- how can you recover? + + That said, version 1.03 now has some error handling. There's still + not enough though, imo. + + [2] No support for a default config file + + I don't see the point. Each .build script is different + and although I typically use the same options to slacktrack + for most of my build scripts, I don't see why I'd need a + config file just to save 4 bytes or so in a trackbuild wrapper :-) + + +6.0 New features + ------------- + + See the TODO file in the docs directory. + + If you have any specific features you would like to see + included, or have found any bugs, please + email me <mozes@slackware.com> + +7.0 Licence + ------- + + slacktrack is distributed under BSD Licence. diff --git a/source/d/slacktrack/slacktrack-project/docs/PACKAGE_BUILDING_CHECKLIST b/source/d/slacktrack/slacktrack-project/docs/PACKAGE_BUILDING_CHECKLIST new file mode 100644 index 00000000..12817beb --- /dev/null +++ b/source/d/slacktrack/slacktrack-project/docs/PACKAGE_BUILDING_CHECKLIST @@ -0,0 +1,244 @@ +########################################################################## +# Document: PACKAGE_BUILDING_CHECKLIST +# Purpose : Check list for creation of Slackware packages +# via .build scripts +# Author..: Stuart Winter <mozes@slackware.com> +# Date....: 04-Apr-2006 +# Version : 1.01 +########################################################################## +# This document belongs to my 'slacktrack' program +# http://www.slackware.com/~mozes +########################################################################## +# Changelog +########### +# v1.01 - 04-Apr-2006 +# * Added note about Slackware version 11 using root:root ownerships +# for binary directories. +# v1.00 - 01-Mar-2003 +# * Created +########################################################################### +Building the package via slacktrack +----------------------------------- + +Let's assuming you're rebuilding the 'fetchmail' utilities package +from Slackware-current. + + # cd slackware/slackware-current/source/n + # slacktrack -jefkzcnp "fetchmail-6.2.0-sparc-2.tgz" "/bin/sh fetchmail.build" + + +If you wanted to make slacktrack save the package into a different directory +you would use the -b option, eg + # slacktrack -b "/data/sparc-packages/n/" \ + -Qnp "fetchmail-6.2.0-sparc-2.tgz" "/bin/sh fetchmail.build" + +slacktrack now moves the package and its .txt description file into my +Sparc port's 'n' series package directory. + +Your package compiles successfully and is now stored in +/tmp/built-slackwarepackages/ +as fetchmail-6.2.0-sparc-2.tgz + +Testing the package +------------------- + +We must now manually check the integrity of the resulting package. + +The easiest way of examining the package is to run it through less. + # less fetchmail-6.2.0-sparc-2.tgz + +[a] The 'install/slack-desc' file + ----------------------------- + + This is a text file in the standard 'slack-desc' format. + It gives a brief description of the package and any relevant + information. + + For examples you should look in the source directory + of any slackware package. + +[b] The 'install/doinst.sh' file + ---------------------------- + + Unless you know what you are doing, your installation scripts should + only refer to relative path names. + For example: + + if [ ! -f etc/foo.conf ]; then + mv -f etc/foo.conf.new etc/foo.conf + fi + + This is because the user can specify a different root directory + when installing the package. If your script uses absolute path names + (path names begin with a /) then this script will not work as expected because + installpkg only changes into the specified root directory and runs the script; + it does not perform a chroot or anything similar. + +[c] Check permissions + ----------------- + + Ensure that there are no globally writeable files and directories + that should not be there. + PHP 4.3.0 is an all time classic example of why you should check + your packages; it had globally writeable files in /usr/lib/php ! + + You can feed slacktrack the --chmod-og-w option to help you + deal with globally writeable files. However, it's best if you + do it yourself from your script, and using this option is no + excuse to not check ! + +[d] Check file & directory ownerships + ----------------------------------- + + Unless specifically required, the files and directories should + be owned by 'root' in the group 'root'. + You may find that some source distributions install their files + with different UIDs because they've simply copied them from the + source ball -- so the files end up being owned by 'bob.users' + or similar. + + However, also see the next check regarding binaries. + +[e] Check binary file & binary directory ownerships + ----------------------------------------------- + + Prior to Slackware version 11, the standard was to have binaries + installed in + /bin,/sbin,/usr/bin,/usr/sbin + as owned by root:bin + + The directories (above) themselves should also have these ownerships. + + You can feed slacktrack the following options to help here: + -e, --chown-bdirs-root-bin + This runs chown root.bin over the binary directories listed above + -f, -chown-bfiles-root-bin + This runs chown root.bin over the FILES inside the binary directories + listed above. + + Again, you should check the package incase there has been a problem. + + The -e and -f options are provided because *Slackware*'s .build scripts + do not do chown them for you -- it is done manually by Pat. + + With Slackware version 11, those binary directories are owned by root:root. + For slacktrack you can use the -m operator to have this set for you. + +[f] Ensure man pages are gzipped & any broken symlinks are fixed + ------------------------------------------------------------ + + Slackware's packages all (or at least should) have gzipped man pages. + The man pages reside in numbered directories ('sections') within + /usr/man + eg man pages in section 1 reside in /usr/man/man1 + + man pages that are *not* gzipped will not have a .gz extension. + For example, the mkdir man page that is not gzipped would be: + /usr/man/man1/mkdir.1 + The gzipped version is + /usr/man/man1/mkdir.1.gz + + Some binaries behave differently when called with different names, or + have different names for historical purposes. + Such an example are packages from the 'floppy' Slackware package. + /usr/bin/xdfformat is a symlink to /usr/bin/xdfcopy + The man page is no different: + xdfformat.1 -> xdfcopy.1 + By default, the Slackware 'floppy.build' script does not gzip man pages. + It's easy to gzip man pages - slacktrack does this + find usr/man -type f -print0 | xargs -0 gzip -9 + However, if you do an ls -l on the man1 directory, you will see + that we have broken the xdffformat.1 symlink to xdfcopy.1 + because xdfcopy.1 is now named xdfcopy.1.gz + The way to fix this would be to + # rm -f xdffformat.1 ; ln -s xdfcopy.1 xdfformat.1 + + The easiest way to ensure your man pages are gzipped and all symlinks + are restored is to feed slacktrack the -z or --gzman option + slacktrack will take care of your symlinks for you. + + Again, there is no excuse not to check manually ! + +[g] strip binaries and shared objects + --------------------------------- + + In order to reduce the size of the binary once installed and package, + Slackware strips the libraries and binaries. + + For example, if we wanted to strip the grep program we would do + # strip --strip-unneeded /bin/grep + + Stripping binaries from .build scripts called via slacktrack + is fairly easy. There are two ways of doing it: + [1] Let slacktrack take care of it + -j or --striplib will cause slacktrack to strip + any executable .so files it finds in /lib and /usr/lib + + -k or --stripbin will cause slacktrack to strip + any executable binaries it finds in /bin,/sbin,/usr/bin,/usr/sbin + + [2] Do it yourself in the your build script - this is the preferred way. + slacktrack exports an environment variable named + SLACKTRACKFAKEROOT + This enables you to do something like this + # find ${SLACKTRACKFAKEROOT}/usr/lib -type f -name *.so -print0 | xargs -0 strip + Using the environement variable prevents you from having to know + all of the library & binary file names, as you will only find + files that your build script has created in the fake root directory. + + * Note: You may find that some binaries or libraries break when they + are stripped. This is because they require symbols that strip + removes. This is why it's best to do your own binary and + library stripping and individually strip the required files rather + than letting slacktrack do it for you * + +[h] Check zero length files + ----------------------- + + slacktrack uses Slackware's makepkg program which should identify any + zero length files for you. However, it's worth checking *why* any files + are of zero length -- you will find that some of them are meant to be; + the etc-*-noarch-*.tgz package's /etc/mtab file is an example of this. + + There should be no occasion for a binary or .so to be of zero bytes. + + If you're unsure of any zero length files, check out the next point. + +[i] Compare your package with the official package + ----------------------------------------------- + + If you are rebuilding/porting a Slackware package from -8.1 or -current + (or any other version for that matter), then one of the easiest ways + to give you some confidence that your package is official-looking is to + simply examine the official package. + + This will allow you to see whether the file & dir permissions are the + same as your own package, verify any zero length files and so on. + + Please note that if you DO find any zero length files or anything + that you can easily PROVE is broken then *DO* submit a report + to Slackware so that it can be fixed. + + If you're porting Slackware packages to a different architecture then + obviously don't be overly concerned about file size differences -- although + it's worth making sure you've stripped your binaries. You may actually + find that some of the Slackware official packages aren't stripped. + +[j] Ensure your package root directory is chmod 755 + ----------------------------------------------- + + prisere [packages] # tar ztvvf foo.tgz + drwx------ root/root 0 2003-03-01 18:46:17 ./ + + If you see this, your package IS BROKEN. + + Installing this package will render your system seriously + broken because it will chmod 700 the root directory ! + + By default slacktrack will chmod 755 the root directory, but + as with everything else, you should check ! + + + +That's about it. If you can think of any other checks then please +email <mozes@slackware.com> diff --git a/source/d/slacktrack/slacktrack-project/docs/PACKAGE_BUILDING_URLS b/source/d/slacktrack/slacktrack-project/docs/PACKAGE_BUILDING_URLS new file mode 100644 index 00000000..801b8aa0 --- /dev/null +++ b/source/d/slacktrack/slacktrack-project/docs/PACKAGE_BUILDING_URLS @@ -0,0 +1,38 @@ +These are a few URLs that provide information about +how to build packages for Slackware Linux: + + Slackware Linux Essentials book + ------------------------------- + + http://www.slackware.com/book/index.php?source=x4132.html + + + Linux packages + -------------- + + This web site has a great number of pre-built packages for + Slackware. + + It also has a HOWTO about building packages: + + http://www.linuxpackages.net/howto/howto.php?page=package + + + Slackbuilds.org + ------------------ + + This site has a huge repository of build scripts for Slackware. + They are all 'SlackBuild' type -- eg the 'clean' builds + (the preferred method -- i.e. these do not need slacktrack) + + http://www.slackbuilds.org + + + Slackware's official build scripts + ---------------------------------- + + I also recommend that you look at the official Slackware build + scripts that can be found on the FTP site in the 'source' + directory of the distribution + (e.g. slackware/slackware-9.1/source) + diff --git a/source/d/slacktrack/slacktrack-project/docs/RELEASE_NOTES b/source/d/slacktrack/slacktrack-project/docs/RELEASE_NOTES new file mode 100644 index 00000000..02876d89 --- /dev/null +++ b/source/d/slacktrack/slacktrack-project/docs/RELEASE_NOTES @@ -0,0 +1,137 @@ +slacktrack version 2.00 +Release notes: 17th September 2008 +=================================== + +Highlights: +----------- + +slacktrack no longer uses 'installwatch' to track the installation +process -- what was previously called 'altertrack' has been turned +into 'slacktrack'. + +slacktrack's method of tracking package installations is to +have the package installed directly onto the host's filesystem. + +This is for a number of reasons: + + 1. installwatch is ill maintained and was failing to work correctly + with new versions of glibc and GNU 'coreutils'. + + 2. installwatch could not track statically compiled binaries, + meaning that if a statically compiled binary was used to + manipulate the filesystem in any way, these manipulations would + not be reflected in your package contents. + + 3. With virtualisation -- QEMU, VMWare, SUN's VirtualBox -- being so + readily available, and allowing filesystem 'snapshots', it's + easier and easier to spin up a development operating system and + build and install directly onto the root filesystem, thus getting + a complete package. + +Upgrading your build scripts from slacktrack version 1.x +-------------------------------------------------------- + +1. slacktrack internal variables + ----------------------------- + + $SLACKTRACKFAKEROOT + + This variable points to the location of the package's + root filesystem (usually /var/tmp/<someplace>). + Using slacktrack 1.x, you could perform operations on the + package contents from your build script *during* the build + process. + + In slacktrack 2.x, the package root directory is only populated + after the build script has finished. + + However, the variable can still be used from a post-build + script. + You can use slacktrack's '-R' operator to specify a post-build + script. In the example below, the post build script is + called 'postbuildfixes.sh' and resides in the same directory + as the 'trackbuild' script. + + ** Note: Ensure that your post-build script is chmod 755. ** + +# Launch the build script: +altertrack \ + --notidy \ + --showdeps \ + -T $TMP \ + -l $CWD/build.$ARCH.log \ + -R $CWD/postbuildfixes.sh \ + -b $PKGSTORE \ + -zIKASmg \ + -Ocp $PKGNAM-$PKGVERSION-$ARCH-$BUILD.tgz ./linuxdoc-tools.build + + The contents of this post build script can be something such as: + +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +#!/bin/bash + +# Once altertrack has determined what the contents of the package +# should be, it copies them into $SLACKTRACKFAKEROOT +# From here we can make modifications to the package's contents +# immediately prior to the invocation of makepkg: altertrack will +# do nothing else with the contents of the package after the execution +# of this script. + +# If you modify anything here, be careful *not* to include the full +# path name - only use relative paths (ie rm usr/bin/foo *not* rm /usr/bin/foo). + +# Enter the package's contents: +cd $SLACKTRACKFAKEROOT + +# OpenSP creates this symlink; we delete it. +if [ -L usr/share/doc ]; then + rm -f usr/share/doc +fi + +# Incase you had CUPS running: +rm -rf etc/cups etc/printcap +# crond: +rm -rf var/spool/cron +rmdir var/spool + +# perllocal.pod files don't belong in packages. +# SGMLSPL creates this: +find . -name perllocal.pod -print0 | xargs -0 rm -f + +# Some doc dirs have attracted setuid. +# We don't need setuid for anything in this package: +chmod -R a-s . +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + + +2. Build script changes + -------------------- + + If your build scripts were more sophisticated and took advantage of + the way installwatch used a pseudo root filesystem, please be acutely + aware that your build script now runs on the host's live operating system; + so you need to be more careful. However, as suggested -- run only on development + installations. + +3. Additional files creeping into the packages + ------------------------------------------- + + Due to some daemons making changes to their config files whilst your build + is in flight, you may find some additional files have crept into your package + which you were not expecting. + + You may wish to turn off the following daemons before starting a build: + CUPS + crond + sendmail + ypbind (NIS) + ypserv (NIS) + + If you look at the example post build script above, you can see that it + removes some CUPS and crond residue. + Whilst it would be possible to remove these paths from slacktrack's scan + locations, some users may wish their package to place data in those directories; + so you need to make your own adjustments and checks for this. + + +END. diff --git a/source/d/slacktrack/slacktrack-project/docs/SLACKDTXT.examples b/source/d/slacktrack/slacktrack-project/docs/SLACKDTXT.examples new file mode 100644 index 00000000..9a57620a --- /dev/null +++ b/source/d/slacktrack/slacktrack-project/docs/SLACKDTXT.examples @@ -0,0 +1,103 @@ +########################################################################## +# Document: SLACKDTXT.examples +# Purpose : Provide examples of how one may use slackdtxt +# Author..: Stuart Winter <mozes@slackware.com> +# Version : 1.00 +# Date....: 02-Mar-2003 +########################################################################### + +1.0 Building ProFTPD from Slackware's source directory + -------------------------------------------------- + +In this example, I have my slackware-current source tree +stored in the directory ' /data2 ' + +I want to compile ProFTPD using Slackware's SlackBuild script, but I want +to move the package from /tmp (where SlackBuild stores it) +into my Slackware binary directory + /data2/slackware-current/slackware/n/ +and I also want to create a .txt description file in the same binary directory. + + 1. Enter the slackware-current source directory + -------------------------------------------- + + meths [proftpd] # pwd + /data2/slackware-current/source/n/proftpd + meths [proftpd] # ls + _proftpd.tar.gz etc proftpd-1.2.7.tar.bz2 proftpd-1.2.7.tar.bz2.asc proftpd.SlackBuild slack-desc + + + 2. Compile ProFTPd using the supplied SlackBuild script. + ----------------------------------------------------- + + meths [proftpd] # ./proftpd.SlackBuild + + [ .. snip lots of text as the package is compiled and built .. ] + + Our proftpd package is built in /tmp as this is where SlackBuild stores it. + + meths [proftpd] # ls -l /tmp/proftpd-1.2.7-i386-1.tgz + -rw-r--r-- 1 root root 503169 Mar 3 00:43 /tmp/proftpd-1.2.7-i386-1.tgz + meths [proftpd] # + + + 3. Create the .txt file and move the package into the binary distribution directory + --------------------------------------------------------------------------------- + meths [proftpd] # slackdtxt -d /data2/slackware-current/slackware/n/ /tmp/proftpd-1.2.7-i386-1.tgz + slackdtxt: Copying package to destination directory ....done + slackdtxt: Verifying the version of the package in the destination directory ....done + slackdtxt: Attempting to extract install/slack-desc from the package ....done + slackdtxt: proftpd-1.2.7-i386-1.txt created + slackdtxt: Deleting the original package ....done + meths [proftpd] # + + In this instance I have extracted the slack-desc file from the /tmp/proftpd-1.2.7-i386-1.tgz + package. Because I was in the source directory, I could have used the local slack-desc + file and saved the overhead of having to untar. In order to do this I could have done: + + # slackdtxt -d /data2/slackware-current/slackware/n/ -s slack-desc /tmp/proftpd-1.2.7-i386-1.tgz + + +Example 2: Creating .txt files from a bunch of packages + -------------------------------------------- + +In this example, I have built a number of packages already. They are +stored in my binary distribution directory (/data2/slackware-current/slackware) +but the packages do not have corresponding .txt files. + +I will use slackdtxt to create .txt files in the same directory as the package files. + + + 1. Enter the slackware-current binary distribution directory + ========================================================== + + meths [n] # pwd + /data2/slackware-current/slackware/n + + These are the packages I have built previously. + + meths [n] # ls + htdig-3.1.6-i386-2.tgz mod_ssl-2.8.12_1.3.27-i386-1.tgz mutt-1.4i-i386-1.tgz wget-1.8.2-i386-2.tgz + meths [n] # + + 2. Create .txt files for all corresponding package files + ===================================================== + + meths [n] # slackdtxt *.tgz + slackdtxt: Attempting to extract install/slack-desc from the package ....done + slackdtxt: htdig-3.1.6-i386-2.txt created + slackdtxt: Attempting to extract install/slack-desc from the package ....done + slackdtxt: mod_ssl-2.8.12_1.3.27-i386-1.txt created + slackdtxt: Attempting to extract install/slack-desc from the package ....done + slackdtxt: mutt-1.4i-i386-1.txt created + slackdtxt: Attempting to extract install/slack-desc from the package ....done + slackdtxt: wget-1.8.2-i386-2.txt created + + meths [n] # ls + htdig-3.1.6-i386-2.tgz mod_ssl-2.8.12_1.3.27-i386-1.tgz mutt-1.4i-i386-1.tgz wget-1.8.2-i386-2.tgz + htdig-3.1.6-i386-2.txt mod_ssl-2.8.12_1.3.27-i386-1.txt mutt-1.4i-i386-1.txt wget-1.8.2-i386-2.txt + meths [n] # + + All .txt files are now created. + + diff --git a/source/d/slacktrack/slacktrack-project/docs/SLACKTRACK.examples b/source/d/slacktrack/slacktrack-project/docs/SLACKTRACK.examples new file mode 100644 index 00000000..924f932f --- /dev/null +++ b/source/d/slacktrack/slacktrack-project/docs/SLACKTRACK.examples @@ -0,0 +1,34 @@ + +If you are looking for example scripts to help you use +slacktrack please look in the documentation directory: + + /usr/doc/slacktrack*/buildscript-examples/ + +Quick example: +-------------- + +I will build the elvis editor that you can find in Slackware's +'a' series. This is looking at an older version of the Slackware +source tree (v 9.1) -- the build script has since been replaced +by a 'SlackBuild', but this example still serves as a good example +reference: + +bourbon [root] # cd slackware-9.1/source/a +bourbon [elvis] # slacktrack -gfenzKSUIp elvis-2.41-i486-1.tgz ./elvis.build +bourbon [elvis] # tar ztvvf /tmp/elvis-2.41-i486-1.tgz | head -n9 +drwxr-xr-x root/root 0 2003-07-11 09:26:05 ./ +drwxr-xr-x root/root 0 2003-07-11 09:26:04 usr/ +drwxr-xr-x root/bin 0 2003-07-11 09:26:05 usr/bin/ +-rwxr-xr-x root/bin 301280 2003-07-11 09:26:05 usr/bin/elvis +-rwxr-xr-x root/bin 19956 2003-07-11 09:26:05 usr/bin/ref +-rwxr-xr-x root/bin 15160 2003-07-11 09:26:05 usr/bin/elvtags +-rwxr-xr-x root/bin 936180 2002-06-08 00:15:29 usr/bin/vim +drwxr-xr-x root/root 0 2003-07-11 09:26:01 usr/share/ +drwxr-xr-x root/root 0 2003-07-11 09:26:04 usr/share/elvis-2.1_4/ +bourbon [elvis] # + +As you can see, we now have an elvis package with the +correct ownerships set on the binary files and so on and +so forth. + +Stuart. diff --git a/source/d/slacktrack/slacktrack-project/docs/TODO b/source/d/slacktrack/slacktrack-project/docs/TODO new file mode 100644 index 00000000..28c22b04 --- /dev/null +++ b/source/d/slacktrack/slacktrack-project/docs/TODO @@ -0,0 +1,65 @@ +To do list +---------- + +Likely to be done: +================== + +This list represents changes that I am likely to implement myself: + +Thinking about it: +================== + +1. Modify slacktrack to do a couple of scans of the filesystem prior to + launching the build script. + It'd compare the scans and add any differences to an exclude list -- since + any such differences were not generated by the build script, thus should not + be in the package. + The purpose of this is to reduce the possibility of non package material making + its way into the final .tgz. + *However*, there's nothing to say that some arbitary cron job won't launch and + modify the filesystem anyway -- so this sort of feature would only lead to + confusion in the long run. + +2. Allow addition of exclude/additional scan dirs without having to replace + the existing list. + Suggested by: Eduard Rozenberg + +3. Compare contents of new package and warn about any overlapping files. + This is harder to do that it sounds because the user may not be removing + the previous package (although it's suggested that you do) because it's + an integral system library or binary and they simply want to upgrade + it and produce a package. This would always talk about overlap. + We could get the 'base package name' of the supplied package + and then remove it from any found ovelap results, but it seems + a bit slow. + +Unlikely to be done: +==================== + +This list represents future additions that (for one reason or another) I am +unlikely to implement. However, feel free to submit a patch (but ask me first - +I don't like receiving unsolicited attachments!). + +2. Add an option to rename/move .conf files to conf.new + Suggested by Geoffrey Sanders, based on an option protopkg supports. + + [..] + > altertrack to (during it's file scan of new files for the package) to + > move any newly created .conf (or any other type of config files) to a + > *.new extension. Don't know how much work this would be...but thought + > that it might be nice to add for those of us who may forget to 'backup' + > any config's that may get stepped on. + [..] + + I must admit that I'm not overly keen on this idea - it sounds too much + like checkinstall -- add a feature that mainly works but breaks when you + least expect it. + + Just moving the .conf to .conf.new is okay in theory but it may: + a) catch people out who rely on the feature but where the config + file isn't called '*.conf' + + b) if it updates the doinst.sh script, the shell script which changes + the file name may need to be before or after the symlink creation + code (if there is any). + diff --git a/source/d/slacktrack/slacktrack-project/docs/USAGE b/source/d/slacktrack/slacktrack-project/docs/USAGE new file mode 100644 index 00000000..46ec1f1c --- /dev/null +++ b/source/d/slacktrack/slacktrack-project/docs/USAGE @@ -0,0 +1,8 @@ + +slacktrack and slackdtxt have full section 8 man pages. Please do + + # man slacktrack + # man slackdtxt + + +Stuart Winter <mozes@slackware.com> diff --git a/source/d/slacktrack/slacktrack-project/docs/WARNINGS b/source/d/slacktrack/slacktrack-project/docs/WARNINGS new file mode 100644 index 00000000..0ba7e31c --- /dev/null +++ b/source/d/slacktrack/slacktrack-project/docs/WARNINGS @@ -0,0 +1,38 @@ +1. Do not Use on production servers + --------------------------------- + + Do NOT run slacktrack on production servers. + + It should only be run on a development box. + + This is because slacktrack version 2.0 and upwards install onto + the filesystem of the server, rather than into a pseudo root. + +2. Slackware versions + ------------------ + + slacktrack has been tested on: + - Slackware 12.0, 12.1, 12.2, 13.0 + - ARMedslack, all versions. + + It may works on previous releases of Slackware, it may not. + +3. slacktrack default working space + -------------------------------- + + By default, slacktrack puts its work space in + /var/tmp/<randomnumber>slacktrack + + It is essential that you have enough disk space on the + partition on which /var/tmp resides - particularly if you use + ${SLACKTRACKSCRATCHDIR} + + If you do not have enough space in /var/tmp then you can + pass --tempdir to slacktrack to change the base temporary directory. + + eg you may do + # slacktrack --tempdir /tmp/slacktrack -Qp "foobar-4.1-sparc-2.tgz" "/bin/sh foobar.build" + + +Stuart Winter <mozes@slackware.com> + diff --git a/source/d/slacktrack/slacktrack-project/docs/buildscript-examples/README b/source/d/slacktrack/slacktrack-project/docs/buildscript-examples/README new file mode 100644 index 00000000..5182cc99 --- /dev/null +++ b/source/d/slacktrack/slacktrack-project/docs/buildscript-examples/README @@ -0,0 +1,19 @@ +This directory contains example scripts on which you may +base your own build scripts. + +Note that the packages and versions are not current, but their +purpose is to serve as examples. + +Slackware's packaging standard is that documents in /usr/doc are +chmod 644, so these examples are archived to retain the execute +permissions on the build scripts. + +Please extract the archive to /tmp to begin: +Example: + +mkdir -pm /tmp/slacktrack +tar xf examples.tar.bz2 -C /tmp/slacktrack + +-- +Stuart Winter <mozes@slackware.com> +17th Sept 2008 diff --git a/source/d/slacktrack/slacktrack-project/ln-wrapper.c b/source/d/slacktrack/slacktrack-project/ln-wrapper.c new file mode 100644 index 00000000..225c7576 --- /dev/null +++ b/source/d/slacktrack/slacktrack-project/ln-wrapper.c @@ -0,0 +1,19 @@ +// ln-wrapper.c by Jim Hawkins <jawkins@armedslack.org> +// Call /bin/ln with the -f operator. +// This file lives in /usr/libexec/slacktrack & is called by having this +// directory as the first dir in your $PATH +// + +#include <string.h> +#include <unistd.h> + +#define LN_PATH "/bin/ln" + +int main(int argc, char *argv[]) +{ + char *argv2[argc + 2]; + memcpy(&argv2[2], &argv[1], sizeof(*argv) * argc); + argv2[0] = LN_PATH; + argv2[1] = "-f"; + return execv(LN_PATH, argv2); +} diff --git a/source/d/slacktrack/slacktrack-project/man/man.build b/source/d/slacktrack/slacktrack-project/man/man.build new file mode 100755 index 00000000..12fb2fe2 --- /dev/null +++ b/source/d/slacktrack/slacktrack-project/man/man.build @@ -0,0 +1,51 @@ +#!/bin/sh + +########################################################################### +# Program: man.build +# Purpose: Create an nroff format file from slacktrack's Perl POD +# format manpage +# Author : Stuart Winter <mozes@slackware.com> +########################################################################### +# Information about man pages: +# http://www.fnal.gov/docs/products/ups/ReferenceManual/html/manpages.html +# which describes creating man pages in nroff format. +# However, it's easier (IMO) to create them in POD format. +########################################################################### + +# Get version from the scripts +SLACKTRACKVERSION="$( grep VERSION= ../scripts/slacktrack | tr -d =,\",[:alpha:] | awk '{print $2}' )" +SLACKDTXTVERSION="$( grep VERSION= ../scripts/slackdtxt | tr -d =,\",[:alpha:] | awk '{print $2}' )" + +# Turn /usr/doc/slacktrack-@VERSION@ into usr/doc/slacktrack-1.02 +# You can't pipe sed into pod2man because pod2man then creates +# the man page's name as 'STANDARD INPUT(8)' rather than 'SLACKTRACK(8)' +sed s/@VERSION@/${SLACKTRACKVERSION}/g slacktrack.pod > SLACKTRACK.pod +sed s/@VERSION@/${SLACKTRACKVERSION}/g slackdtxt.pod > SLACKDTXT.pod + +# Use pod2man to create an nroff compatible man page +pod2man \ + --section=8 \ + --release="$(grep "^# Date" ../scripts/slacktrack | rev | awk '{print $1}' | rev)" \ + --center=' ' \ + --date="slacktrack Version ${SLACKTRACKVERSION}" \ + SLACKTRACK.pod 2>&1 > slacktrack.8 + +pod2man \ + --section=8 \ + --release="$(grep "^# Date" ../scripts/slackdtxt | rev | awk '{print $1}' | rev)" \ + --center=' ' \ + --date="slackdtxt Version ${SLACKDTXTVERSION}" \ + SLACKDTXT.pod > slackdtxt.8 + +# If we specified -t at the command line then display the man page & exit +if [ "${1}" = "-t" ]; then + man ./slacktrack.8 + man ./slackdtxt.8 + rm -f slacktrack.8 slackdtxt.8 +fi + +# Delete the butchered .pod files +rm -f SLACKTRACK.pod SLACKDTXT.pod + +# EOF + diff --git a/source/d/slacktrack/slacktrack-project/man/slackdtxt.pod b/source/d/slacktrack/slacktrack-project/man/slackdtxt.pod new file mode 100644 index 00000000..a8b4f621 --- /dev/null +++ b/source/d/slacktrack/slacktrack-project/man/slackdtxt.pod @@ -0,0 +1,205 @@ +=pod + +=head1 NAME + +slackdtxt - Create package description files for Slackware packages + +=head1 SYNOPSIS + +B<slackdtxt> B<[>optionsB<]> B<E<lt>tgz file or list of filesE<gt>> + + +=head1 DESCRIPTION + +B<slackdtxt> is tool for creating the package description (packagename.txt) +files that can be see in the Slackware package series directories. It can +also optionally sign the Slackware package with your GnuPG secret key. + +All Slackware packages have an 'install/slack-desc' file contained within the +package file. This file gives a brief description of the package and is displayed +by the B<installpkg> program when the package is installed, or by B<upgradepkg> +when the package is upgraded. + +Within the Slackware binary distribution package 'series' directories +are the '.t?z' files and an accompanying .txt file. However, the slack-desc files +contained within the .t?z often have comments and 'the handy ruler' which +should B<not> appear the .txt version. B<slackdtxt> removes this and generates +a 'standard' .txt version from the slack-desc file. + +B<slackdtxt> can either take an existing B<slack-desc> file and convert it, or +extract the slack-desc from the specified .t?z package file. + +The basic purpose of B<slackdtxt> is to build .txt files after you have run +Slackware's official B<SlackBuild> scripts. Slackware's SlackBuild scripts +leave the packages in /tmp, and it is presumed that you would like to move +them into a safe place and create a .txt file at the same time. Therefore slackdtxt +enables you to specify a B<destination directory> in which to copy or move the .t?z +and to create the .txt file. + +slackdtxt was written with porting Slackware to other architectures in mind. + +=head1 Slackware Package file extensions + +Starting with Slackware version 13, four types of package compression formats +are suported. + +=over 4 + +=item B<.tgz> - Gzip + +=item B<.tbz> - Bzip2 + +=item B<.tlz> - LZMA + +=item B<.txz> - XZ + +=back + +Where this document mentions '.t?z', it refers to one of the above formats. + + + +=head1 OPTIONS - GENERAL + +=over 4 + +=item B<-h>, B<--help> + +Show the available options and exit + +=item B<-v>, B<--version> + +Show the version information and exit + +=back + +=head1 OPTIONS - MAIN + +=over 4 + +=item B<-s>, B<--slackdescfile> <path to slack-desc file> + +Specify the name of/path to the 'slack-desc' file. + +You would typically want to use this option if you are in the package +build directory that contains the B<slack-desc> file. + +B<Note:> You cannot use this option when specifying more than +one .t?z package file; all slack-desc files will be extracted +from the .t?z file. + +This option is not mandatory. + +=item B<-d>, B<--destdir> <directory> + +If this option is specified, slackdtxt will move (or copy, see +B<--nodelete>) the .t?z file into this directory. The .txt and .asc +files will also be created in this directory. + +See the examples document for the purpose of this option. + +This option is not mandatory. + +B<Note:> Omitting this flag implies B<--nodelete> + +=item B<-n>, B<--nodelete> + +This option is used in conjunction with B<--destdir> + +With this option, when slackdtxt has created the .txt file and copied the .t?z file +into the destination directory, it will not delete the original version. + +For example, if your file is F</tmp/foobar-2.0-i386-4.tgz> +and you feed slackdtxt B<--destdir> F</data/slackware/> then +the F</tmp/foobar-2.0-i386-4.tgz> will remain. + +By default, the original will be deleted B<unless> there is no +destination directory specified by B<--destdir> + +=item B<-G>, B<--gpg-sign> <id> + +Sign the original .t?z package file with specified GnuPG key. The +GnuPG signature file will have the same name as the .t?z file but with an +extra B<.asc> suffixed (e.g. foobar-1.0-i486-5.tgz.asc). + +=back + + +=head1 EXAMPLES + +=over 4 + +=item # B<slackdtxt> foo-1.00-i486-1.tgz + +This will create a single file named foo-1.00-i486-1.txt +within the current working directory. To specify a different +directory, see options B<-d>, B<--destdir> + +=item # B<slackdtxt> *.t?z + +This will make slackdtxt create '.txt' files for every +'.t?z' package file within the current working directory. + +=back + +=head1 RETURN VALUES + +These are the exit codes that slackdtxt will produce when it encounters +certain problems. You may wish to use these return codes to indicate +success or failure when slackdtxt is called from unattended auto builder +scripts. + +=over 4 + +=item B<0> +Clean exit + +slackdtxt exited without encountering any errors. +This is the default exit code. + +=item B<1> +Reserved + +This error code is not currently used. + +=item B<6> +Missing destination directory + +The destination directory specified by the B<--destdir> switch does not exist. + +=item B<7> +Missing user specified file + +A file specified by the user does not exist. Typically this will +be the .t?z package file. + +=item B<8> +Error moving data or moved data is corrupt + +slackdtxt failed to copy or move a data file correctly, or the file +was moved correctly (B<mv> or B<cp> did not exit with a non-zero value) +but a further verify failed. + +=back + + +=head1 FILES + +F</usr/bin/slackdtxt> the slackdtxt script + +F</usr/doc/slacktrack-@VERSION@/SLACKDTXT.examples> slackdtxt usage examples + +=head1 AUTHOR + +Stuart Winter <mozes@slackware.com> + +=head1 SEE ALSO + +=over 4 + +B<slacktrack>(8), B<makepkg>(8), B<installpkg>(8), B<explodepkg>(8), B<removepkg>(8), B<pkgtool>(8), B<upgradepkg>(8) + +=cut +=back + + diff --git a/source/d/slacktrack/slacktrack-project/man/slacktrack.pod b/source/d/slacktrack/slacktrack-project/man/slacktrack.pod new file mode 100644 index 00000000..07eac6a4 --- /dev/null +++ b/source/d/slacktrack/slacktrack-project/man/slacktrack.pod @@ -0,0 +1,949 @@ +=pod + +=head1 NAME + +slacktrack - build Slackware packages from B<.build> scripts + +=head1 SYNOPSIS + +B<slacktrack> B<[>optionsB<]> -p B<">packagefilenameB<"> B<">buildscriptB<"> + + +=head1 DESCRIPTION + +B<slacktrack> is a packaging tool to build Slackware packages +from simple B<.build> scripts, some of which can be found in the distribution +source tree. B<slacktrack> has many features available to eliminate the +majority of the manual element involved with producing packages from +these scripts. B<slacktrack> uses the standard Slackware B<makepkg> program +to produce the resulting packages. + + +=head1 OPTIONS - GENERAL + +=over 4 + +=item B<-h>, B<--help> + +Show the available options and exit + +=item B<-v>, B<--version> + +Show the version information and exit + +=back + +=head1 OPTIONS - SLACKWARE 'makepkg' PACKAGE MAKER + +The values from these options are passed to the Slackware +B<makepkg> tool. + +=over 4 + +=item B<-p>, B<--package> <package_name> + +Resulting tar file name of the package. This will be in the format +of B<name>-B<version>-B<arch>-B<build>.tgz + +For example: B<slacktrack>-B<@VERSION@>-B<i386>-B<1>.B<tgz> + +=item B<-s>, B<--nosymlinks> + +Tell B<makepkg> not to search for symlinks in the package directory + +=item B<-r>, B<--setrootowner> + +Tell B<makepkg> to set permissions on directories to 755 and owners to root.root + +See also B<--chown-bdirs-root-bin> + +=item B<--mpopts> + +Supply additional options to B<makepkg>. + +Example: # B<slacktrack> --mpopts "--prepend" -Qnp foo-1.0-i486-1.tgz ./foo.build + +B<Note:> You B<must> include the additional options in either +quotes (as shown in the example above) or single quotes otherwise slacktrack will take them +as options to itself. + +=back + +=head1 OPTIONS - SPECIFIC SLACKTRACK OPTIONS + +=over 4 + +=item B<-t>, B<--notidy> + +Do not delete temporary package directory when slacktrack has finished. +slacktrack uses a temporary work space directory in /var/tmp (by default). +This directory contains the package.tgz contents. This option can be +useful when you are having difficulties with building the package, or +for debugging slacktrack. +slacktrack will inform you of the (randomly named) temporary directory +when it has finished. + +=item B<-b>, B<--buildstore> <directory> + +Specify the location in which to store the built .tgz packages. +By default this is B</tmp/built-slackwarepackages>, but you may wish +to change it to another location. If this directory does not exist +then slacktrack will default to using B</tmp> + +This directory also will contain any logs and the package description +file (if specified). + + +=item B<-l>, B<--logfile> <filename> + +slacktrack logs every element of the compilation and build process +that the B<build script> outputs along with slacktrack's own on-screen +output. The log file is especially useful for debugging a failed build. +The default log path is B<E<lt>buildstore_pathE<gt>/E<lt>package_nameE<gt>.log> + +This option permits the user to specify a different directory for the +logs rather than storing the .log in the same directory as the .tgz. + +=item B<-n>, B<--nologging> + +Do not save the log file when slacktrack has finished. +See B<--logfile> above for a description of the contents of the log file. + +The default is to log. + +=item B<-D>, B<--md5sum> + +Create an MD5sum of the resulting package file in the package +store directory (where the resulting package will be built; usually +this is F</tmp>). The MD5sum file will be the same name as the resulting +package file but with B<.md5> suffixed (e.g. foobar-1.0-i486-5.tgz.md5). + +This option does nothing if the B<--nocreatetgz> option has been +specified. + +=item B<-G>, B<--gpg-sign> <key id> + +Sign the resulting package file with specified GnuPG key and +placed the detached, armored signature in the package store directory (where +the resulting package will be stored; usually this is F</tmp>). The GnuPG +signature file will have the same name as the resulting package file but with +an extra B<.asc> suffixed (e.g. foobar-1.0-i486-5.tgz.asc). + +This option does nothing if the B<--nocreatetgz> option has been specified. + + +=item B<-z>, B<--gzman> + +Slackware's standard is that all man pages should be gzipped. +This option makes slacktrack gzip any man pages that exist within the +directories F</usr/man>, F</usr/local/man> and F</usr/X11R?/man>. + +The default is not to gzip man pages. + +Also see the B<--gzman-no-symfix>, B<--gzinfo> and B<--gzinfo-no-symfix> options. + +=item B<-I>, B<--gzinfo> + +Slackware's standard is that all GNU info pages should be gzipped. +This option makes slacktrack gzip any info pages that exist within the +directories F</usr/info> and F</usr/local/info> + +The default is not to gzip info pages. + +Also see the B<--gzinfo-no-symfix>, B<--gzman> and B<--gzman-no-symfix> options. + +=item B<-P>, B<--delete-perllocalpod> + +Delete any B<perllocal.pod> files found in the package's /usr/lib directory. + +These files contain information about a system's Perl packages installed +in addition to the vendor's Perl distribution. Typically these files are +created by the installation script of the additional Perl add-on package. + +However, they are snapshots of the particular system on which the Slackware +package is made - and most likely will not reflect the target system's +environment (the target is unlikely to have an identical set of additional +Perl modules installed); thus these files should not be present in Slackware packages. + +The default is not to delete these files. + +=item B<-K>, B<--delete-usrinfodir> + +Delete the package's /usr/info/dir file if it exists. This file is +a special file used by the GNU 'info' program to provide the user +with a list of the info pages present on the system. +Some software's Makefile will create a new 'dir' page that only contains +information pertaining to the newly compiled software itself, rather than +appending to the existing list of software. + +In the main you will want to use this option to avoid replacing the original +/usr/info/dir file. + +However, the default is not to delete this file. + + +=item B<-x>, B<--exclude> B<pattern for egrep> + +slacktrack traverses the filesystem using the UNIX 'find' utility and generates +a 'snapshot' of the contents. grep -E (or B<'egrep'>) is then used to remove +a number of paths and specific files from this snapshot; this is because +these paths/directories either are locations that should never be installation +destinations for software, or are system files that are subject to change +moment to moment. + +This option allows you to replace the entire default pattern. + +By default, slacktrack excludes the following: + +EXCLUDE_LIST="${PWD}$|${PWD}|/etc/ntp/drift|/var/run/|/var/run$|/var/lib/dhcpcd|/var/lib/dhcpcd$|/etc/dhcpc/|/etc/dhcpc$|/var/cache/|/var/cache$|/run$|/run/|/media$|/media/|/srv$|/srv/|/selinux$|/selinux/|/var/lib/rpm|/var/lib/rpm$|/var/yp$|/var/yp/|/sys$|/sys/|/initrd$|/initrd/|/dev/bus$|/dev/bus/|/dev/char$|/dev/char/|/dev/rfkill|/dev/input$|/dev/input/|/dev/.udev/|/dev/.udev$|/dev/vc$|/dev/vc/|/dev/console|/dev/pts$|/dev/pts/|/dev/ptmx|/dev/tty|/var/log|/etc/mtab|/etc/resolv.conf|/etc/ld.so.cache|/tmp|/root|/proc|/var/tmp|/var/run/utmp|/var/spool/cron/cron|/var/lib/NetworkManager|/var/lib/NetworkManager$|/usr/man/whatis|/usr/local/man/whatis|/var/lib/pgsql$|/var/lib/pgsql|/var/lib/mysql$|/var/lib/mysql" + +This is a pattern for grep -E. Please familiarise yourself with the grep man page +if you wish to make changes. + +It is recommended that these defaults are unchanged. + +In addition, slacktrack excludes the PWD (present working directory) from which slacktrack +was invoked. This allows a package's source directory to be in a non-default excluded +path and receive updates (such as log files) and avoid slacktrack including them in the +newly created package file. + +=item B<-o>, B<--no-fs-search> B<pattern for find -regex (pre and post file system scans)> + +Prior to beginning a build, and post build, slacktrack uses the 'find' command to scan +the OS' file system, and stores these records. The difference between the two records are used to +determine the package's contents. + +There are some directory paths that should never be included within packages. By default +this list is: + +SEARCH_EXCLUDE_LIST='mnt\|sys\|proc\|tmp\|home\|lib/udev/devices' + +B<Note:> The list uses escaped pipes and does not have a leading forward slash. The regex is +applied to the --rootdir argument, so the excluded paths should be relative to that. + +This is a good set for a default Slackware installation, but some users have data +in other directories which should never be included in a package. Scanning these additional +directories takes extra time and serves no purpose. + +While the B<-x,--exclude> operator is applied to the final package contents list, B<-o, --no-fs-search> is applied +before and can be used to significantly speed up the searches that build the before/after file lists. + +=item B<-d>, B<--depend> B<'>package1,package2B<'> + +Ensure the given Slackware packages are installed before executing +the build script. + +This is a primative method of build-time dependency checking. +It simply prevents the build from failing, or a certain feature from +being compiled out because (at build time) you had not got a certain +library installed. + +The packages are wildcarded by slacktrack, thus you do not have to specify +version information. To depend on 'oggutils' being installed, you would +specify B<-d "oggutils"> and slacktrack would find any installed version of the +Slackware oggutils package. + +No depdendencies are checked by default. + +=item B<-j>, B<--striplib> + +The Slackware standard is to run B<strip --strip-unneeded> over any +shared objects. This option causes slacktrack to strip any .so objects in +/usr/lib, /usr/lib64, /lib64, /lib, /usr/local/lib and /usr/libexec + +Also see option -S, --stripallexec + +The default is not to strip. + + +=item B<-A>, B<--striparchives> + +This option causes slacktrack to run the B<strip> program against any +.a (archive) files that it finds in the package's directory. + +Only debugging symbols are stripped (B<strip -g>). + +For information about such files you should read ar(1) and ranlib(1). + +B<Note:> This option strips any .a files it finds within the package's directory +rather than limiting itself to a pre-set list of directories (as with +the other strip options that slacktrack provides). + +Also see option -S, --stripallexec + +The default is not to strip. + + +=item B<-k>, B<--stripbin> + +The Slackware standard is to run B<strip --strip-unneeded> over any +binary files. This option causes slacktrack to strip any binaries found +in /bin, /sbin, /usr/bin, /usr/sbin, /usr/local/bin, /usr/local/sbin and +/usr/X11R?/bin. + +Also see option -S, --stripallexec + +The default is not to strip. + + +=item B<-S>, B<--stripallexec> + +This option performs B<--striplib>, B<--stripbin> and B<--striparchives> but rather than +limiting itself to a pre-set list of directories, it strips any files (with execute permissions) +that the B<file> program reports as being unstripped ELF binaries. This includes +B<.a archives>. + +The purpose of this command is to strip binaires and shared object files +that are B<not> in the normal locations. An example of a known deviations is B</opt> + +Using this option is slower (especially when used with packages containing many +files in deep directory structures) than using B<--striplib>, B<--stripbin> or B<--striparchives> +options individually. + +If this option is also specified with B<--striplib>, B<--stripbin> or B<--striparchives> then +those options are dropped in favour of the B<--stripallexec> mode of operation. + +The default is not to strip objects of any type. + +=item B<-c>, B<--createdescription> + +From Slackware 8.1 and upwards, the package series directories contain +a B<name>-B<version>-B<arch>-B<build.txt> along with the package. + +Using this option causes slacktrack to create such a file in the +build store directory (see the B<--buildstore> option) + +The default is not to create a description file. + +=item B<-e>, B<--chown-bdirs-root-bin> + +Prior to Slackware v11, the standard was to have the /bin, /sbin, /usr/bin, /usr/sbin, /usr/local/sbin, /usr/local/bin and /usr/X11R?/bin directories owned by root:bin. + +Slackware v11 changed binary directory ownerships to 'root:root'. +B<If you are building packages for a version of Slackware prior to version 11, +you should use this operator>. + +B<Note:> If you use the B<--setrootowner> option then B<makepkg> will +reset the directory permissions to root.root + +The default is not to set these ownerships. + +=item B<-f>, B<--chown-bfiles-root-bin> + +Prior to Slackware v11, the standard was to have binaries contained within +the /bin, /sbin, /usr/bin, /usr/sbin, /usr/local/sbin, /usr/local/bin +and /usr/X11R?/bin directories owned by root:bin. + +B<If you are building packages for a version of Slackware prior to version 11, +you should use this operator>. + +The default is not to set these ownerships. + +=item B<-m>, B<--chown-bins-root-root> + +The Slackware standard is to have the /bin, /sbin, /usr/bin, /usr/sbin, +/usr/local/sbin, /usr/local/bin and /usr/X11R?/bin directories owned by root:root. + +If you are intending on building Slackware compliant packages, please use this +operator. + +B<If you are building packages for Slackware versions prior to 11, +please see the two operators listed above>. + +The default is not to set these ownerships. + +=item B<-g>, B<--chmod644docs> + +Often when installing documents, the permissions vary wildly. +It is preferable if documents are chmod 644 and owned by +the user 'root' and group 'root'. + +Using this option causes slacktrack to set all files contained +within F</usr/doc> to chmod 644 and runs chmod -R root.root on the package's +F</usr/doc> directory. + +The default is not to set these permissions. + +=item B<-U>, B<--nousrtmp> + +When compiling some programs (such as Apache), slacktrack sometimes picks up +the /usr/tmp symlink. This symlink is part of another Slackware package +and therefore should not be present in other packages. + +Using this option causes slacktrack to prevent this symlink from appearing +in the resulting package. + +This behaviour is not the default. + +=item B<-Q>, B<--standard> + +This option is the combination of the following slacktrack's options: +B<--gzman> (B<-z>), B<--gzinfo> (B<-I>), B<--delete-usrinfodir> (B<-K>), +B<--stripallexec> (B<-S>), B<--createdescription> (B<-c>), +B<--chown-bdirs-root-bin> (B<-m>), B<--chown-bins-root-root> (B<-f>), +B<--chmod644docs> (B<-g>), B<--delete-perllocalpod> (B<-P>) and B<--nousrtmp> (B<-U>). + +It can be considered the quick way to build a package which follows +the Slackware standard without specifying each +individual command line switch. + +You would use this option as follows: + +# B<slacktrack> -Qp foo-2.0-i486-1.tgz ./foo.build + + +=item B<-T>, B<--tempdir> B<'><path>B<'> + +slacktrack uses a temporary work space to store the package contents. +By default, slacktrack will choose one in /var/tmp. However, you may wish +to change it to another location should there not be enough space in +/var/tmp to hold the temporary files. + +Please note that if the temporary directory (either automatically chosen by +slacktrack or specified using this operator) already exists, slacktrack +will exit with error code B<6>; the directory should be deleted prior +to invoking slacktrack. + +=item B<-C>, B<--nocreatetgz> + +Do not execute the Slackware B<makepkg> program when the build script +finishes. You may wish to use this option if you want to run makepkg +by hand. + +Using this option implies B<--notidy> + +The default is to execute B<makepkg> + +=item B<-L>, B<--nologhardlinks> + +Some software distribution archive build scripts will use ln (hard link) +instead of ln -s (soft link). Hard links which should not be +allowed to make their way into a package that is to be distributed. + +By default, hard links are logged to screen and an additional +.hardlinks.log file will be created in the build store directory. + +=item B<-O>, B<--chmod-og-w> + +Run 'chmod -R og-w' over the package directory. + +Some packages (such as PHP 4.3.0) install globally writeable files +when it should not. This option runs chmod -R og-w over the entire +package directory. + +This behaviour is not the default. + +=item B<-Z>, B<--gzman-no-symfix> + +Do not repair broken man page symlinks caused by the B<--gzman> option + +Some man pages are symlinks to other man pages. When the +original file is gzipped, its name changes to name.x.gz +and thus the symlink is broken. + +This option repairs such broken symlinks by renaming the +symlink to name.x.gz and pointing it to the new .gz man page file. +The symlink also has to be named .gz otherwise the B<man> program +fails because it doesn't know that it is expecting a gzipped file. + +The default behaviour is to repair any broken symlinks. + +=item B<-F>, B<--gzinfo-no-symfix> + +Do not repair broken info page symlinks caused by the B<--gzinfo> option + +Some info pages are symlinks to other info pages. When the +original file is gzipped, its name changes to name.gz +and thus the symlink is broken. + +This option repairs such broken symlinks by renaming the +symlink to name.gz and pointing it to the new .gz info page file. + +The GNU B<info> program is capable of working with broken symlinks +but it is desirable to have the symlink corrected. + +The default behaviour is to repair any broken symlinks. + + +=item B<-M>, B<--extra-mandir> <path> + +Append additional man page directories to the default list (F</usr/man>, F</usr/local/man>, F</usr/X11R?/man>). + +You would want to use this option if you are storing man pages in non-system +locations such as /opt/kde/man and wish to gzip them using slacktrack's B<--gzman> option. + +Extra paths can be comma separated as shown below: + B<# slacktrack --extra-mandir /opt/kde/man,/opt/prog/man> + +B<Warning:> Do B<not> specify paths other than directories that will +contain man pages, otherwise normal files will become gzipped ! + + +=item B<-W>, B<--extra-infodir> <path> + +Append additional info page directories to the default list (F</usr/info>, F</usr/local/info>). + +You would want to use this option if you are storing info pages in non-system +locations such as /opt/kde/info and wish to gzip them using slacktrack's B<--gzinfo> option. + +Extra paths can be comma separated as shown below: + B<# slacktrack --extra-infodir /opt/kde/info,/opt/prog/info> + +B<Warning:> Do B<not> specify paths other than directories that will +contain info pages, otherwise normal files will become gzipped ! + + +=item B<-E>, B<--extra-libdir> <path> + +Append additional shared object (library) directories to the default list (/lib, /usr/lib, /usr/local/lib). + +You would want to use this option if you are storing shared objects in non-standard locations +and wish slacktrack to strip them using the B<--striplib> option. + +Multiple paths may be supplied by comma separating them. + +=item B<-B>, B<--extra-bindir> <path> + +Append additional binary directories to the default list +(/bin, /sbin, /usr/bin, /usr/sbin, /usr/local/bin, /usr/local/sbin, /usr/X11R?/bin). + +You would want to use this option if you are storing binaries in non-standard locations +and wish slacktrack to strip them using the B<--stripbin> option. + +Multiple paths may be supplied by comma separating them. + +=item B<-N>, B<--strip-prog> <path> + +Specify a different binary name for the B<strip> program. You may need +to use this option if you are cross compiling and wanting to strip +the resulting binaries. + +Example: +# B<slacktrack> --strip-prog /usr/local/arm/2.95.3/bin/arm-linux-strip -mnzSIP foo-2.0-arm-1.tgz + +By default slacktrack will use the version of strip that it finds +in the $PATH. + + +=item B<-R>, B<--run-after> <command> + +Run the specified command/script after the specified build script has finished +and prior to creating the package. + +The purpose of this is to allow the user to inspect and if required, modify +the contents of the package before the package file is created. + +B<Note:> The CWD (working directory) is changed to the package's root +directory before the specified command is executed. This allows you to +specify (for example) /usr/bin/mc (Midnight Commander) and have +it automatically display the contents of the package. + +Example: + +The following slacktrack command would run the Midnight Commander program +F<mc> prior to creating the package B<foo-2.0-arm-1.tgz>. + +# B<slacktrack> -Rmc -mnzSIP foo-2.0-arm-1.tgz + +By default slacktrack does not execute any commands prior to creating +the package. + +=item B<--run-after-withlog> <command> + +This option is the same as B<-R>, B<--run-after>, with the only difference being that +any output from that script is logged to the slacktrack build log. + +If any of your post build scripts perform any checks that should be inspected +manually after the package build completes, you'd be best choosing this option; but +note that logging may not work properly for any scripts that require keyboard +input or use curses based applications (such as 'dialog'). + +=item B<--showdeps> + +This option lists the B<installed> Slackware packages (those that appear in +F</var/log/packages>) that contain shared libraries upon which your new +package depends. + +The purpose of this option for interest only but you may +find it useful to ensure that you haven't built a package on a box that +Xfree86 (for example) installed but intend to install and use the package +on a box that does not, when the package has become linked against X's +libraries. + +Using this option will also flag up 'orphaned' libraries (ones that +do not belong to an installed package, which is especially handy +if you're going to be distributing a package). + +The package dependencies (and orphans, if any) will be logged (regardless +of whether logging is turned off) in text files that will be stored +in the package build store (usually /tmp) under the following names: + +packagename.orphaned_ld_deps.log + +packagename.ld_deps.log + +B<Note:> Slackware does not have any form of dependency checking and +as such any file you produce will not be considered by +pkgtools. However, third parties have developed a standard that uses +a single file to assist with the handling of automated dependency checking +(when the package is installed via 3rd party package managers such as +swaret, slapt-get et al). This file resides within the package as +F</install/slack-required>. You may like to use this feature of +slacktrack to help you generate such a file. + +The default behaviour is not to display dependencies. + +=item B<-X>, B<--delete-overlapping> + +After the filesystem comparison has been completed, slacktrack determines whether there +are any files that overlap between the new package and those already installed on the +running system. Normally there should be no overlapping files; however, some packages +that provide additional Python or Perl libraries often re-process or re-compile some parts +of the vendor-supplied package contents, causing slacktrack to correctly identify that +the files have changed after the package build process has finished. + +It is undesirable for packages to have overlapping files because it is not +possible to identify which is the master package. One of the side effects may be that +the end user has problems with the installation order of the packages. + +slacktrack will identify any overlapping files and match them with the package(s) to which the file also belongs. +Using this operator, slacktrack will erase any overlapping files from the content of the newly +created package. + +The best practice is to review the package build log and investigate any overlapping files. +It is the responsibility of the package builder (you) to determine why the file is overlapping +and decide what to do with them. + +=item B<--allow-overlapping> + +Allow the package to contain files that overlap with packages that are already installed +on the system. This is the default behaviour, if if you like to use slacktrack's -Q option to build +an otherwise Slackware standards compliant package, you will need to supply this option afterwards +to permit files to overlap. + +=item B<--touch-filesystem-first> + +Use the UNIX touch(1) tool to touch (set the objects' time stamps to the current system time) +a pre-defined list of directories and their contents prior to generating the +snapshot of the filesystem. + +The pre-defined paths are: + /opt /bin /boot /dev /etc /install /lib /sbin /usr /var + +It B<excludes> by default '/lib/udev/devices' since this contains +live device data that doesn't take kindly to being touched. +You may see errors from 'touch' about certain binaries, including +/sbin/vol_id because this is a symlink into /lib/udev/devices. + +This is intended to be used on a throwaway development installation +that's reinstalled daily or more often. + +The reason behind this is that if you run slacktrack and your build +partially fails, then it will leave some data on the filesystem. +You then fix the problem and re-try: this time the build may succeed. +However, if the original data on the filesystem from the first +part-failed build has *not* changed (for example, if it was some static data that +was copied with cp -a (preserved time stamp & ownership)) between +the first part-failed build and second successful build, slacktrack +will miss this data from the final package file. + +This option updates the file stamps contained within standard package +directories, therefore allowing slacktrack to detect changes +(even if the data contains an *old* time stamp from 1982, it will still +detect the difference). + +B<Note:> This is an expert option and is not recommended for use unless +you are working on a throw-away development installation. + +=item B<--touch-filesystem-faster> + +This operator performs the same function as B<--touch-filesystem-first> except +that it uses a faster method; except that potentially speed comes at a price. + +If this method finds files or directories with spaces in the name, it +may create empty files in your package's source build directory. + +For example: + +B</usr/doc/prog-2.0/FILE WITH A SPACE IN IT> + +You may find that you have six new files, "FILE", "WITH", "A", "SPACE," "IN", and "IT" existing +in your package's build source directory. + +However, if you know that there are no files or directories with spaces in their names, +feel free to use this option in preference to B<--touch-filesystem-first>. + +B<Note:> This is an expert option and is not recommended for use unless +you are working on a throw-away development installation. + + +=item B<-Y>, B<--delete-orphaned-pyc> + +After the build has completed, this option scans the contents of the new package, +and if it finds any '*.pyc' files without a matching '*.py' file, the *.pyc file +will be removed from the package contents (but not from the filesystem). + +This scan only checks the content of the B<package> not the filesystem. There may be +a corresponding '*.py' file on the filesystem, but it wasn't created or modified +during the build process of this particular package. + +When building Slackware's 'ap/linuxdoc-tools' package, we found that 'gnome doc-tools' +was causing some Python '*.py' system files from the Python package to be recompiled +(generating '*.pyc' files) but was not modifying the original '*.py' files. +This meant that slacktrack was correctly detecting the changed '*.pyc' files and including +them in the 'linuxdoc-tools' package; but this meant that we had file overlap +with the 'd/python' package. Since the original '*.py' files were not modified, +and the '*.pyc' files already existed in the Slackware Python package, they didn't +need to be included in the 'linuxdoc-tools' package - and the overlapping files +would have caused problems with package upgrades. + +This option is not on by default because it's quite conceivable that the user +may wish to include '*.pyc' files without '*.py' files. + +If the directories and parent directories containing the *.pyc files become +empty after this operation, then these directories are removed from the package. + +=back + +=head1 SPECIAL SLACKTRACK ENVIRONMENT VARIABLES + +slacktrack makes a small number of environment variables available to the +build script(s). The variables allow build scripts to gain access to +various inner-workings of slacktrack. + +=over 4 + +=item B<SLACKTRACKFAKEROOT> + +This directory is the 'root' directory of the package. You may wish +to access this directory during build or post-build time so that you can perform +special operations that slacktrack itself cannot perfom. + +However, the to-be-packaged contents won't exist in this directory until +B<after> the build script finishes and the package has installed itself +to the filesystem; but you can still pre-populate it with content if you wish, +although typically you'd perform these actions directly onto the filesystem +and let slacktrack take care of packaging it. + +For example, whilst slacktrack is able to strip all ELF objects, it may +be that a small number of the objects will not function when stripped, yet +the rest will. Therefore you cannot use slacktrack's stripping options +to accomplish this task; instead you can access the package's directory +directly. + +You could do this using the following script, called from slacktrack +using the B<-R, --run-after> operator: + +=item # B<slacktrack> -R $CWD/postbuildfixes.sh -Qp foo-1.0-i486-2.tgz ./foo.build + + +B<Example post build script 1:> + + +Where the 'postbuildfixes.sh' script contains: + +B<( cd ${SLACKTRACKFAKEROOT} + strip usr/bin/foo + strip bin/bar ) > + + +B<Example post build script 2:> + +Another example would be to remove known files that were detected by slacktrack +as being changed/added/updated during the build process, but that we do not want +to be packaged. This is an easier method than using the B<-x,--exclude> operator. + +B<# Incase you had CUPS running: + rm -rf etc/cups etc/printcap + # crond: + rm -rf var/spool/cron + rmdir var/spool + # perllocal.pod files don't belong in packages. + # SGMLSPL creates this: + find . -name perllocal.pod -print0 | xargs -0 rm -f + # Some doc dirs have attracted setuid. + # We don't need setuid for anything in this package: + chmod -R a-s . +> + +B<Note:> You may use any shell commands once inside the package's root directory +but be careful never to specify any paths within the B<real> root directory (for example +F</usr> rather than F<usr>) in any of your commands. + +=back + + +=over 4 + + +=item B<SLACKTRACKSCRATCHDIR> + +This directory provides a temporary 'scratch' directory for use by the +build scripts. Its purpose is to allow the author to simplify the build scripts +by removing the need to create and manage temporary directories where +the source archives will be unpacked. + +Example usage: + +B< cd ${SLACKTRACKSCRATCHDIR} + tar jxf /path/to/source/ball.bz2 + cd ball-2.3 + ./configure && make install > + +This directory is subject to the same command line options as the +rest of the slacktrack temporary build tree; if --notidy is specified +then this directory will remain, otherwise it is deleted. + +=back + + +=head1 EXAMPLES + +=over 4 + +=item # B<slacktrack> -p foo-0.10-i386-1.tgz '/bin/sh -x foo.build' + +This is the minimum selection of options you must pass to slacktrack. +You are simply telling slacktrack the name of the resulting package file +and specifying that slacktrack should launch "foo.build" via "/bin/sh" + +=item # B<slacktrack> -jmkznp bar-3.20-sparc-5.tgz ./bar.build + +We are telling slacktrack to strip libraries, chown root:root /bin +/sbin, /usr/bin, /usr/sbin, /usr/local/sbin, /usr/local/bin and /usr/X11R?/bin directories, +chown root:root files in the binary dirs, strip binaries found in the binary dirs listed above +and gzip man pages. + +The resulting Slackware package name is 'bar-3.20-sparc-5.tgz' + +Note that I have compounded the various options; the above option list could +also be specified as B<-j -m -k -z -n -p bar-3.20-sparc-5.tgz> + +=back + +There are various example scripts in F</usr/doc/slacktrack-@VERSION@/examples> + +=head1 WARNINGS + +=over 4 + + +=item B<Do not use slacktrack on production machines> + +Please do not run slacktrack on a production machine. Infact, it is advisable +not build B<any> packages (either B<SlackBuild> or B<.build>) on production machines. + +Always use a development box. + + +=item B<Slackware versions> + +slacktrack has only been tested on Slackware 8.1 & Slackware-9 and Splack (Slackware on SPARC, +using Slackware 9's pkgtools & tar-1.13). + +It may works on previous releases of Slackware, it may not. + +=item B<slacktrack default working space> + +By default, slacktrack puts its work space in B</var/tmp/> + +It is essential that you have enough disk space on the +partition on which /var/tmp resides. If you do not then you +can pass B<--tempdir> to slacktrack to change the base temporary directory: + +# B<slacktrack> --tempdir /tmp/slacktrack -jefknzp "foobar-4.1-sparc-2.tgz" "/bin/sh foobar.build"> + +=back + +=head1 RETURN VALUES + +These are the exit codes that slacktrack will produce when it encounters +certain problems. You may wish to use these return codes to indicate +success or failure when slacktrack is called from unattended auto builder +scripts. + +=over 4 + +=item B<0> +Clean exit + +slacktrack exited without encountering any errors. +This is the default exit code. + +=item B<1> +Reserved + +This error code is not currently used. + +=item B<2> +Missing command line parameters + +slacktrack was called with insufficient parameters or a parameter +that requires a value was specified but no value was given. + +=item B<3> +Slackware package dependencies failed + +slacktrack was asked to check that certain Slackware packages were installed. +It didn't find at least one of the specified packages. + +=item B<4> +Missing external helper + +slacktrack failed to find a required external helper. Currently the external helpers +is the Slackware 'makepkg' utility. + +=item B<5> +Zero files found in slacktrack's package-content-tracking working directory + +slacktrack failed to find any files installed as part of the build process. + +This error may be due to any of the following reasons: + +B<1.> The build script or command line specified did not exist or could not be executed. + +B<2.> The build script/command line exists but failed to be executed or executed and died with an error + +B<3.> The build script/command worked as expected but slacktrack failed to detect any activity. + +It is suggested that you run B<slacktrack> with the --notidy option and inspect +the working space directory in /var/tmp/ to discover what the problem is. + +=item B<6> +Possibly unsafe to continue operation. + +slacktrack determined that it was possibly unsafe to continue. This may be +because it found the temporary directory to already exist (slacktrack needs +to wipe the temporary directory), or it may get to a point where it needs to +overwrite an existing file which would require manual intervention. + +Since slacktrack is designed to be scriptable, it will never prompt for human +interaction - just fail with pre-set error codes which can be collected by +caller scripts. + +=back + +=head1 FILES + +F</usr/bin/slacktrack> the slacktrack script + +F</usr/doc/slacktrack-@VERSION@/LICENCE> a copy of the GPLv2 licence + +F</usr/doc/slacktrack-@VERSION@/OVERVIEW> an overview of the Slackware package system & build scripts + +F</usr/doc/slacktrack-@VERSION@/PACKAGE_BUILDING_CHECKLIST> a checklist for package builders + +=head1 AUTHOR + +Stuart Winter <mozes@slackware.com> + +=head1 SEE ALSO + +=over 4 + +B<makepkg>(8), B<installpkg>(8), B<explodepkg>(8), B<removepkg>(8), B<pkgtool>(8), B<upgradepkg>(8), B<slackdtxt>(8) + +=back +=cut + + diff --git a/source/d/slacktrack/slacktrack-project/old_stuff/findy b/source/d/slacktrack/slacktrack-project/old_stuff/findy new file mode 100755 index 00000000..382eea48 --- /dev/null +++ b/source/d/slacktrack/slacktrack-project/old_stuff/findy @@ -0,0 +1,17 @@ +#!/bin/bash -x +function package_name () { + local PACKAGENAME="$( echo $1 | rev | cut -d- -f4- | rev )" + echo ${PACKAGENAME} +} + + +PACKAGE=linuxdoc-tools-2.0-arm-1.txz + +# need to get the find op right. +find . -path './install' -prune -o -type f -printf "%P\n" | egrep -v "^$" > /tmp/log # | \ +( cd /var/log/packages + cat /tmp/log | while read file ; do + grep -H "${file}" * + done ) | sort | uniq | egrep -v "^$( package_name ${PACKAGE}).*:" > /tmp/log2 2>&1 + +cat /tmp/log2 diff --git a/source/d/slacktrack/slacktrack-project/scripts/slackdtxt b/source/d/slacktrack/slacktrack-project/scripts/slackdtxt new file mode 100755 index 00000000..a32bf690 --- /dev/null +++ b/source/d/slacktrack/slacktrack-project/scripts/slackdtxt @@ -0,0 +1,312 @@ +#!/bin/bash +# +# Copyright 2002, 2009 Stuart Winter, Surrey, England, United Kingdom. +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +################################################################################## +# Program: slackdtxt +# Purpose: Create package-ver-arch-build.txt files from slack-desc files. +# For use after running a SlackBuild script - you do not need to +# use this program for a package produced by slacktrack -- use its +# -c switch instead. +# Author : Stuart Winter <mozes@slackware.com> +# Date...: 24-Sep-2011 +# Version: 1.05 +################################################################################# +# History +########## +# 24-Sep-2011 - v1.05 +# * Look for 'install/slack-desc' and './install/slack-desc' +# in the packages. This provides support for malformed packages +# that have not been created with the Slackware 'makepkg' command. +# Thanks to Helmut Hullen for the suggestion. +# 15-May-2009 - v1.04 +# * Adjust to handle .tgz, .tbz, .tlz, .txz file extensions/ +# compression formats. +# 04-Sep-2008 - v1.03 +# * Display the filename of the .tgz being processed. +# * .txt files now use the time stamp of the corresponding .tgz +# * New default: only create a .txt or sign a package if there +# isn't an existing .txt or .asc *or* the .txt's time stamp +# isn't the same as the .tgz's. +# * Fixed bug where the gpg signing key wasn't being picked up +# at the command line. +# * Always wipe temp file when exiting +# * A GPG signing key must be specified -- it will not fall back +# on the default. This is because the code to check check the +# command line operators doesn't work. I checked the supplied +# examples for getopt and even they don't work! +# 28-Sep-2003 - v1.02 +# * Added option -G, --gpg-sign to sign the .tgz package +# (Patch from Emanuele Vicentini) +# * Removed -t option. You may now do specify the file after +# as before (but without -t) or specify more than one package +# at once: eg slackdtxt *.tgz +# 11-Jul-2003 - v1.01 +# * Fixed problem with checking the exit code from getopt. +# (reported by Emanuele Vicentini). +# 02-Mar-2003 - v1.00 +# * Created +################################################################################## + +# Program name +PROGNAME=slackdtxt + +# Version +VERSION="${PROGNAME} v1.03 by Stuart Winter <mozes@slackware.com>" + +# Temporary store for the slack-desc file +DESCTMPFILE="/var/tmp/$$.slackdtxt.desc.$$" + +trap "rm -f $DESCTMPFILE" EXIT + +############################## Functions################################### +function display_usage () { +printf "Usage: ${PROGNAME} [options] <package file/list of package files>\n" +if [ ! -z "$1" ]; then + echo "Use $( basename $0 ) --help for a list of options" +fi +} + +function display_help () { +printf "${VERSION}\n\n$(display_usage) + +Startup: + -h, --help Display this help + -v, --version Display version information + +Main options: + -s, --slackdescfile <file> 'slack-desc' file (cannot be used when + specifying more than one package file) + -d, --destdir <directory> The directory in which to store the package + file & create the .txt description file within + Omitting this flag implies --nodelete + -n, --nodelete Do not delete the original package file. + once moved into destination directory + -G, --gpg-sign <key id> Sign the package with GnuPG + -f, --force Force creation of a .txt and GPG signing. + By default, .txt files are only created and + packages signed if there is no existing .txt + or .asc file, or the .txt time stamps aren't + the same as the package's. +" +} + +############################################################################### + +############################## Configuration variables ######################### +# These can be changed via the command line switches +# +DELETEPKG="Yes" +# By default, don't force signing nor creation of .txt files +FORCE=No +################################################################################ + +PARAMS="$( getopt -qn "$( basename $0 )" -o s:d:fnhvG: -l slackdescfile:,destdir:,nodelete,force,help,version,gpg-sign: -- "$@" )" +# If params are incorrect then +if [ $? -gt 0 ]; then display_help ; exit 2 ; fi +eval set -- "${PARAMS}" +for param in $*; do + case "$param" in + -s|--slackdescfile) SLACKDESCFILE="$2" + shift 2;; + + -d|--destdir) DESTDIR="$2" + shift 2;; + + -n|--nodelete) DELETEPKG="No" + shift 1;; + + -f|--force) FORCE="Yes" + shift 1;; + + -G|--gpg-sign) SIGNPACKAGE="Yes" + SIGNINGKEY="$2" + shift 2 ;; + + -h|--help) display_help ; exit ;; + + -v|--version) printf "${VERSION}\n" ; exit;; + + --) shift; break;; + esac +done + +# Do we have the relevant information to proceed? +if [ -z "${1}" ]; then + display_usage help + exit 2 +fi + +# Do we have too *much* information to proceed? +if [ $# -gt 1 -a ! -z "${SLACKDESCFILE}" ]; then + echo "Error: You cannot specify a slack-desc file when" + echo " specifying more than one package file" + display_usage help + exit 2 +fi + +# Let's check if user really has gpg. +if [ "${SIGNPACKAGE}" = "Yes" ]; then + which gpg >/dev/null 2>&1 || { echo "${PROGNAME}: Warning: Cannot find gpg; disabling signature creation"; unset SIGNPACKAGE; } +fi + +# Main loop, handle any number (well, not really but you know..) +# of package files specified at the command line. +for PKGFILE in $*; do + +# If we were given a destination dir then check whether it exists +# Now giving a dest dir allows us to do +# # for i in *.t?z ; do slackdtxt -t $i ; done +# and create .txt files for all the package files in a dir. +if [ ! -z "${DESTDIR}" ]; then + DESTDIR="${DESTDIR}/" # otherwise when we tar without specifying a dest dir, it becomes /package-blah.tgz + if [ ! -d "${DESTDIR}" ]; then + echo "${PROGNAME}: ERROR: The destination directory does not exist" + exit 6 + fi + else + DELETEPKG="No" # otherwise we'd delete our only copy +fi + +# Does the specified package exist? +if [ ! -s "${PKGFILE}" ]; then + echo "${PROGNAME}: ERROR: The specified package "${PKGFILE}" does not exist" + exit 7 +fi + +# Does the specified slack-desc file exist ? +if [ ! -z "${SLACKDESCFILE}" ]; then + if [ ! -s "${SLACKDESCFILE}" ]; then + echo "${PROGNAME}: Warning: The specified slack-desc file ${SLACKDESCFILE} does not exist;" + echo " will try and extract from the package." + unset SLACKDESCFILE + else + # .. the file is fine. + # copy the slack-desc file to the temp location so I don't have + # to code around having the user specify one and having to take one + # from the package then delete it. + cp -f "${SLACKDESCFILE}" "${DESCTMPFILE}" + # .. but if copying it fails then we'll take it from the package anyway. + if [ $? -gt 0 ]; then + unset SLACKDESCFILE + else + SLACKDESCFILE="${DESCTMPFILE}" # we'll use the /var/tmp version now + fi + fi +fi +############################## Main program################################### + +# Move the pakage file to the dest dir if we were given one +if [ ! -z "${DESTDIR}" ]; then + echo -n "${PROGNAME}: Copying package to destination directory" + cp -fa "${PKGFILE}" "${DESTDIR}" + if [ $? -gt 0 ]; then + printf "\n${PROGNAME}: ERROR: Failed to copy the package\n" + exit 8 + else + echo " ... done" + fi +fi + +# Test the copied package -- it probably isn't corrupt (eg no disk space on $DESTDIR) +# as the cp would have errored, but I'd like to check anyway +if [ ! -z "${DESTDIR}" ]; then + echo -n "${PROGNAME}: Verifying the version of the package in the destination directory" + tar ftz "${DESTDIR}$( basename ${PKGFILE} )" >/dev/null 2>&1 + if [ $? -gt 0 ]; then + printf "\n${PROGNAME}: ERROR: The package in ${DESTDIR} is corrupt\n" + exit 8 + else + echo " ... done" + fi +fi + +# If we weren't given a slack-desc file then try and pull one from the +# package +if [ -z "${SLACKDESCFILE}" ]; then + SLACKDESCFILE="${DESCTMPFILE}" + echo "${PROGNAME}: Processing $( basename ${PKGFILE} ) ..." + echo -n "${PROGNAME}: Attempting to extract install/slack-desc from the package" + # In case somebody's not used 'makepkg' (which uses tar-1.13) to create the package, + # and tar has created the archive index with absolute path names. + # (it's a malformed package in this case, but we may as well support it) + tar fOx "${PKGFILE}" install/slack-desc ./install/slack-desc > "${SLACKDESCFILE}" 2>/dev/null + if [ ! -s "${SLACKDESCFILE}" ]; then + printf "\n${PROGNAME}: ERROR: Failed to extract the slack-desc file from the package\n" + rm -f "${SLACKDESCFILE}" # it may be zero bytes/empty + exit 8 + else + echo " ... done" + fi +fi + +# Turn the slack-desc file into a .txt file; +# only if there isn't an existing .txt or the .txt is older than the package +# unless -f,--force is specified. +SLACKTXTFILE="${DESTDIR}$( echo $( basename $PKGFILE ) | rev | cut -d. -f2- | rev ).txt" +if [ $SLACKTXTFILE -ot $PKGFILE -o $SLACKTXTFILE -nt $PKGFILE -o "$FORCE" = "Yes" ]; then + egrep -v '^($|#| *\|)' "${SLACKDESCFILE}" > $SLACKTXTFILE + rm -f "${SLACKDESCFILE}" + # Set the time stamp to that of the package: + touch -r $PKGFILE $SLACKTXTFILE + echo "${PROGNAME}: $SLACKTXTFILE created" + else + echo "${PROGNAME}: Not created .txt - is same age as package (use -f to override)" +fi + +# Let's sign the original package with user's gpg key +if [ ! -z "${SIGNPACKAGE}" ]; then +# If the .asc is the same time stamp as the package, don't sign unless +# forced. + if [ ${DESTDIR}${PKGFILE}.asc -ot $PKGFILE -o ${DESTDIR}${PKGFILE}.asc -nt $PKGFILE -o "$FORCE" = "Yes" ]; then + echo -n "${PROGNAME}: signing ${PKGFILE} with ${SIGNINGKEY:-your default} key" + GPG_OPTIONS="--detach-sign --armor --yes" + if [ "${SIGNINGKEY}" ]; then + GPG_OPTIONS="${GPG_OPTIONS} --local-user $SIGNINGKEY" + fi + gpg ${GPG_OPTIONS} --output ${DESTDIR}${PKGFILE}.asc ${PKGFILE} + if [ $? -ne 0 ]; then + echo "${PROGNAME}: ERROR: Signature has not been correctly generated" + else + echo " ... done" + # Set time stamp to that of the package: + touch -r $PKGFILE ${DESTDIR}${PKGFILE}.asc + fi + else + echo "${PROGNAME}: Not signed package - is same age as package (use -f to override)" + fi +fi + +# Delete the package ? +if [ "${DELETEPKG}" = "Yes" ]; then + echo -n "${PROGNAME}: Deleting the original package" + rm -f "${PKGFILE}" + if [ $? -gt 0 ]; then + printf "\n${PROGNAME}: Warning: unable to delete package\n" + else + echo " ... done" + fi +fi + +unset SLACKDESCFILE + +# Exit from main loop +done diff --git a/source/d/slacktrack/slacktrack-project/scripts/slacktrack b/source/d/slacktrack/slacktrack-project/scripts/slacktrack new file mode 100755 index 00000000..27ab2be8 --- /dev/null +++ b/source/d/slacktrack/slacktrack-project/scripts/slacktrack @@ -0,0 +1,1305 @@ +#!/bin/bash +# +# Copyright 2002-2017 Stuart Winter, Surrey, England, United Kingdom. +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +###################################################################################### +# Program: slacktrack +# Purpose: Tracking & building packages for Slackware v9.1+ +# Inspired by Patrick Volkerding's 'bp' script +# +# This DOES NOT USE libsentry nor installwatch! +# This WILL INSTALL THE PACKAGE ON THE SYSTEM (and updates the +# /var/log/packages database so that you may remove the newly built package). +# +# * DO NOT USE THIS ON ANYTHING BUT A PACKAGE BUILDING DEVELOPMENT MACHINE * +# +# You MUST consult the FAQ before using this script so that you avoid +# including unrelated files in your packages. +# +# Author : Stuart Winter <mozes@slackware.com> +# Date...: 07-Jun-2017 +# Version: 2.18 +###################################################################################### + +# Program name +PROGNAME="slacktrack" + +# Version +SLACKTRACKVERSION="${PROGNAME} v2.18 by Stuart Winter <mozes@slackware.com>" + +# Path to Slackware's makepkg +MAKEPKG=/sbin/makepkg + +# Set defaults. These may be modified via the command line switches +unset SLACKWAREPACKAGE PACKAGEDEPEND +CREATESYMLINKS=Yes +SETROOTOWNER=No +CHOWNBINDIRSROOTBIN=No +CHOWNBINFILESROOTBIN=No +CHOWNBINSROOTROOT=No +TIDYONFINISH=Yes +GZMAN=No +GZINFO=No +GZMANFIXSYMLINKS=Yes +GZINFOFIXSYMLINKS=Yes +DELETEUSRINFODIR=No +DELETEPERLLOCALPOD=No +DELETEORPHANEDPYC=No +STRIPPROG="$( which strip )" +STRIPLIB=No +STRIPBIN=No +STRIPALLEXEC=No +STRIPARCHIVES=No +CREATEDESCRIPTION=No +CHMODNOGLOBALWRITE=No +CHMOD644DOCS=No +BUILDSTORE=/tmp/built-slackwarepackages/ # if that dir doesn't exist it'll use /tmp +LOGGING=Yes +CREATEMD5SUM=No +SIGNPACKAGE=No +SIGNINGKEY= +NOUSRTMP=No +ALLOWOVERLAPPINGFILES=Yes +LOGHARDLINKS=Yes +SLACKTRACKLOGFILE="/var/tmp/$$.$(date +%s).${RANDOM}.slacktrack.log" +MANDIR_LIST="/usr/man /usr/local/man /usr/X11R?/man /opt/kde/man" +INFODIR_LIST="/usr/info /usr/local/info" +LIBDIR_LIST="/usr/lib /usr/lib64 /lib64 /lib /usr/local/lib /usr/libexec" +BINDIR_LIST="/bin /sbin /usr/sbin /usr/bin /usr/local/bin /usr/local/sbin /usr/X11R?/bin" +ROOTDIR=/ +RUNCMDAFTER= +RUNCMDAFTER_WITHLOG=No +MAKEPKGOPTS= +SHOWDEPS=No +# Below is the list of files and directories that should be excluded from the list +# of files that have changed since before and after the build. +# It's in egrep's pattern format. Note that when this string is used in altertrack +# (as it used to be called), we prefix everything with ^ meaning to only remove the +# listed value if it is at the start of a line. Eg, /var/log/monkey.log would be removed +# from the list (because /var/log is listed below), but /usr/monkey/var/log/monkey.log +# would not. +EXCLUDE_LIST="${PWD}$|${PWD}|/etc/ntp/drift|/var/run/|/var/run$|/var/lib/dhcpcd|/var/lib/dhcpcd$|/etc/dhcpc/|/etc/dhcpc$|/var/cache/|/var/cache$|/run$|/run/|/media$|/media/|/srv$|/srv/|/selinux$|/selinux/|/var/lib/rpm|/var/lib/rpm$|/var/yp$|/var/yp/|/sys$|/sys/|/initrd$|/initrd/|/dev/bus$|/dev/bus/|/dev/char$|/dev/char/|/dev/rfkill|/dev/input$|/dev/input/|/dev/.udev/|/dev/.udev$|/dev/vc$|/dev/vc/|/dev/console|/dev/pts$|/dev/pts/|/dev/ptmx|/dev/tty|/var/log|/etc/mtab|/etc/resolv.conf|/etc/ld.so.cache|/tmp|/root|/proc|/var/tmp|/var/run/utmp|/var/spool/cron/cron|/var/lib/NetworkManager|/var/lib/NetworkManager$|/usr/man/whatis|/usr/local/man/whatis|/var/lib/pgsql$|/var/lib/pgsql|/var/lib/mysql$|/var/lib/mysql" + +# The list of files/directories to exclude from the pre and post-file system scan. +# Note that this is applied to the search itself, unlike EXCLUDE_LIST, which +# means a) if you know what to exclude can make the install a lot faster and +# b) it uses find's -regex syntax. +# Paths are relative to ROOTDIR - if you amend these using the --no-fs-search operator +# you will need to omit the '/' prefix as you can see below: +SEARCH_EXCLUDE_LIST='mnt\|sys\|proc\|tmp\|home\|lib/udev/devices' + +# Default touch list: +# (ideally there shouldn't be any directories called /install as these are part of the +# package that are used during installation, and wiped afterwards; but occasionally +# there is some residue due to a problematic package or a failed build): +FSTOUCHLIST="/opt /bin /boot /etc /install /lib /usr/lib64 /lib64 /sbin /usr /var" + +# Basic sanity checks +if [ ! -f "${MAKEPKG}" ]; then + echo "ERROR: Unable to locate the Slackware 'makepkg' program" + echo " Your system is broken. makepkg is part of the pkgtools" + echo " package; you must install it to continue." + exit 4 +fi +if [ ! -d /var/log/packages -o ! -d /var/log/scripts ]; then + echo "ERROR: Unable to find at least one of the package" + echo " information repositories. Your system is broken!" + exit 4 +fi + + +############################################### Functions################################### +function display_usage () { +printf "Usage: ${PROGNAME} [options] -p <package_file_name> <command_line>\n" +if [ ! -z "$1" ]; then + echo "Use $( basename $0 ) --help for a list of options" +fi +} + +function display_help () { +printf "${SLACKTRACKVERSION}\n\n$(display_usage) + +Startup: + -h, --help Display this help + -v, --version Display version information + +Options to Slackware's 'makepkg': + -p, --package <package_name> Resulting tar file name of the package + -s, --nosymlinks Do not create symlinks via install/doinst.sh script + -r, --setrootowner Set permissions on directories to 755 and owners to root.root + --mpopts \"<options>\" Specify additional options to 'makepkg' + +Specific slacktrack options: + -t, --notidy Do not delete temporary package directory + -b, --buildstore <directory> Location to store built packages + [ default: ${BUILDSTORE} ] + -l, --logfile <filename> Path of slacktrack's logfile + [ default: (buildstore_path)/<package_name>.log ] + -n, --nologging Delete log file upon slacktrack completing successfully + -D, --md5sum Create an MD5sum file of the resulting package + -G, --gpg-sign <key id> Sign the resulting package with GnuPG + -z, --gzman gzip any man pages found in known locations + -I, --gzinfo gzip any info pages found in known locations + -Z, --gzman-no-symfix Do not repair broken symlinks caused by the --gzman option + [ default is to fix broken symlinks ] + -F, --gzinfo-no-symfix Do not repair broken symlinks caused by the --gzinfo option + [ default is to fix broken symlinks ] + -K, --delete-usrinfodir Delete package's /usr/info/dir file [default is no] + -P, --delete-perllocalpod Delete perllocal.pod files found in /usr/lib & /usr/lib64 [default is no] + -d, --depend \"package1,pack2\" Ensure Slackware packages are installed before continuing + -j, --striplib Strip executable ELF .so objects in the library directories + -A, --striparchives Strip .a (archive) files found anywhere within the package + -k, --stripbin Strip executable ELF files in the binary directories + -S, --stripallexec Strip all executable ELF objects found within the package + -c, --createdescription Create a slack-desc file named <package-name>.txt in + the build store path + -e, --chown-bdirs-root-bin Set ownerships of the standard Slackware binary directories to + 'root:bin'. If you use the --setrootowner option then it will + reset the directory permissions to root:root + -f, --chown-bfiles-root-bin Set ownerships of files contained within the standard Slackware + binary directories to 'root:bin' + -m, --chown-bins-root-root Set ownerships of files and directories in the standard Slackware + binary directories to 'root:root' + -g, --chmod644docs Run chmod 644 & chown root:root on files in package's /usr/doc/ + -U, --nousrtmp If /usr/tmp is a symlink, delete it and its contents + -T, --tempdir <path> Specify a temporary path for the package building + By default, slacktrack will choose one in /var/tmp + -L, --nologhardlinks Do not log the existence of hard links + -O, --chmod-og-w Run 'chmod -R og-w' over the package directory + -x, --exclude '/foo|/bar' Supply replacement egrep pattern for dir/file exclusion + -o, --no-fs-search 'foo\|bar' Supply replacement find regex pattern for pre and post-build file + system scans. If you know where the package will install, this can + significantly reduce the processing time. Paths are relative to --rootdir + [default: mnt\|sys\|proc\|tmp\|home\|lib/udev/devices] + -M, --extra-mandir <path> Append path to the man directory list + -W, --extra-infodir <path> Append path to the info directory list + -E, --extra-libdir <path> Append path to the lib directory list + -B, --extra-bindir <path> Append path to the bin directory list + -N, --strip-prog <path> Specify the location of the 'strip' binary + -R, --run-after <cmd> Run command/script after build script finishes, without appending + its output to the slacktrack log file. + Use this for any post build processing scripts that require manual + intervention or use a curses interface (for example a 'dialog' script). + --run-after-withlog <cmd> Run command/script after build script finishes, appending any output + to the slacktrack log file. + -X, --delete-overlapping Remove any files from the resulting package's contents that overlap + with any of the system's existing installed packages + --allow-overlapping Permit the package to contain any files that overlap with existing + installed packages [this is the default] + -Q, --standard Select options required to build a compliant Slackware package + --showdeps List the installed packages on which this new package depend + --rootdir Change the directory that slacktrack considers to be the root + [default: /] + --touch-filesystem-first Touch files on the filesystem before scanning filesystem + contents + --touch-filesystem-faster Touch files on the filesystem before scanning filesystem + contents, using a faster but less safe method + than --touch-filesystem-first + This option is _not_ recommended. + -Y, --delete-orphaned-pyc Delete orphaned Python compiled *.pyc files from the package. + +Suggested usage: ${PROGNAME} -Qp foo-1.0-i486-1.txz ./foo.build +" +} + +# basename + strip extensions .tbz, .tgz, .tlz and .txz +pkgbase() { + echo "$1" | sed 's?.*/??;s/\.t[bglx]z$//' +} +# Function to retrieve the package name. +# glibc-solibs-2.2-i386-1.tgz = glibc-solibs +package_name() { + # Strip version, architecture and build from the end of the name + pkgbase $1 | sed 's?-[^-]*-[^-]*-[^-]*$??' +} + +# Function to determine whether a supplied package name is already installed +# Returns 0 if not installed, 1 if installed. +# This function allows us to specify 'autoconf' for example, without having +# to worry about the version number installed (unless you specifically want to, +# in which case specify the version number as well - e.g. autoconf-2.54) +function is_package_installed () { + local PACKAGENAME="$1" + local installed_package + + # We have to go through each package like this (rather than just do if -f foobar-* + # because otherwise packges such as glibc, glibc-solibs and so on get wildcarded + # and things get confused. + for installed_package in $( find /var/log/packages/${PACKAGENAME}-* -type f -printf "%f\n" 2>/dev/null ) ; do + installed_package="$( package_name ${installed_package} )" + if [ "${installed_package}" = "${PACKAGENAME}" ]; then + return 1 # the package 'short' name is installed + break + fi + done +return 0 +} + +# Check if we have any package dependencies. This is a lame way of doing it and +# possibly proves nothing, but it saves me writing it in a few build scripts that +# would otherwise fail when they haven't got package X installed. +function check_package_dep () { +local error pack +# Change comma separated input into spaces and consider them one by one +for pack in $( echo ${1} | sed s/,/\ /g ); do + is_package_installed "${pack}" + if [ $? -eq 0 ]; then + echo "${PROGNAME}: dependency Slackware package '${pack}' not installed" + error=y + else + echo "${PROGNAME}: dependency Slackware package '${pack}' is installed. OK!" + fi +done + +if [ ! -z "${error}" ]; then + echo "Error: Package dependencies failed" + return 1 +fi +} + + +# Function to move the temporary log file into the correct place & with the correct name. +function move_log () { +if [ "${LOGGING}" = "Yes" ]; then + if [ -z "${USER_SLACKTRACKLOGFILE}" ]; then + # Move /var/tmp/slacklog to /tmp/built-slackwarepackages/packagename.log + mv -f ${SLACKTRACKLOGFILE} "${BUILDSTORE}/$( echo $SLACKWAREPACKAGE | rev | cut -d. -f2- | rev ).log" > /dev/null 2>&1 + else + # The user specified their own log path; rename our /var/tmp/slacklog to their's + mv -f ${SLACKTRACKLOGFILE} ${USER_SLACKTRACKLOGFILE} > /dev/null 2>&1 + fi + else + # We don't want a log, so we'll just delete the /var/tmp version + rm -f ${SLACKTRACKLOGFILE} +fi +} + +# Tidy up the temporary directory (source extraction dir and pseudo root): +function tidy_workspace () { +( if [ "${TIDYONFINISH}" = "Yes" ]; then + echo -n "${PROGNAME}: Deleting temporary directory" + rm -rf /install/* /install > /dev/null 2>&1 # otherwise this may cause trouble for other builds + rm -rf "${SLACKTRACKTMPPATH}" + if [ $? -gt 0 ]; then + echo " ... error removing" + else + echo " ... done" + fi + else + rm -rf /install/* /install > /dev/null 2>&1 + echo "${PROGNAME}: Temporary workspace '${SLACKTRACKTMPPATH}' will remain" +fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE} +} + +############################################################################################# +PARAMS="$( getopt -qn "$( basename $0 )" -o p:b:l:d:M:N:W:E:x:o:B:R:T:DG:mnefgcsrthvzPAISjkKULOZQXY -l exclude:,no-fs-search:,mpopts:,tempdir:,package:,buildstore:,logfile:,depend:,delete-overlapping,allow-overlapping,extra-mandir:,extra-infodir:,run-after:,run-after-withlog:,extra-libdir:,extra-bindir:,strip-prog:,nologging,createdescription,gzman,gzinfo,gzman-no-symfix,gzinfo-no-symfix,striplib,striparchives,stripbin,stripallexec,nosymlinks,nousrtmp,chmod644docs,setrootowner,chown-bdirs-root-bin,chown-bfiles-root-bin,notidy,help,version,delete-usrinfodir,nologhardlinks,md5sum,gpg-sign:,chmod-og-w,standard,showdeps,rootdir:,chown-bins-root-root,touch-filesystem-first,touch-filesystem-faster,delete-perllocalpod,delete-orphaned-pyc -- "$@" )" + +# If params are incorrect then +if [ $? -gt 0 ]; then display_help >&2 ; exit 2 ; fi +eval set -- "${PARAMS}" +for param in $* ; do + case "$param" in + + -p|--package) SLACKWAREPACKAGE="$2" + shift 2;; + + -b|--buildstore) BUILDSTORE="$2/" + shift 2;; + + -l|--logfile) USER_SLACKTRACKLOGFILE="$2" + shift 2;; + + -n|--nologging) LOGGING=No + shift 1;; + + -D|--md5sum) CREATEMD5SUM="Yes" + shift 1;; + + -G|--gpg-sign) SIGNPACKAGE="Yes" + SIGNINGKEY="$2" + shift 2;; + + -s|--nosymlinks) CREATESYMLINKS="No" + shift 1;; + + -U|--nousrtmp) NOUSRTMP="Yes" + shift 1;; + + -L|--nologhardlinks) LOGHARDLINKS="No" + shift 1;; + + -O|--chmod-og-w) CHMODNOGLOBALWRITE="Yes" + shift 1;; + + -T|--tempdir) SLACKTRACKTMPPATH="$2" + shift 2;; + + -r|--setrootowner) SETROOTOWNER="Yes" + shift 1;; + + --mpopts) MAKEPKGOPTS="$2" + shift 2;; + + -e|--chown-bdirs-root-bin) CHOWNBINDIRSROOTBIN="Yes" + CHOWNBINSROOTROOT="No" + shift 1;; + + -f|--chown-bfiles-root-bin) CHOWNBINFILESROOTBIN="Yes" + CHOWNBINSROOTROOT="No" + shift 1;; + + -m|--chown-bins-root-root) CHOWNBINSROOTROOT="Yes" + shift 1;; + + -g|--chmod644docs) CHMOD644DOCS="Yes" + shift 1;; + + -t|--notidy) TIDYONFINISH="No" + shift 1;; + + -c|--createdescription) CREATEDESCRIPTION="Yes" + shift 1;; + + -j|--striplib) STRIPLIB="Yes" + shift 1;; + + -k|--stripbin) STRIPBIN="Yes" + shift 1;; + + -S|--stripallexec) STRIPALLEXEC="Yes" + shift 1;; + + -A|--striparchives) STRIPARCHIVES="Yes" + shift 1;; + + -N|--strip-prog) STRIPPROG="$2" + shift 2;; + + -z|--gzman) GZMAN="Yes" + shift 1;; + + -I|--gzinfo) GZINFO="Yes" + shift 1;; + + -Z|--gzman-no-symfix) GZMANFIXSYMLINKS="No" + shift 1;; + + -F|--gzinfo-no-symfix) GZINFOFIXSYMLINKS="No" + shift 1;; + + -K|--delete-usrinfodir) DELETEUSRINFODIR="Yes" + shift 1;; + + -P|--delete-perllocalpod) DELETEPERLLOCALPOD="Yes" + shift 1;; + + -d|--depend) PACKAGEDEPEND="$2" + shift 2;; + + -Y|--delete-orphaned-pyc) DELETEORPHANEDPYC="Yes" + shift 1;; + + -x|--exclude) EXCLUDE_LIST="$2" + shift 2;; + + -o|--no-fs-search) SEARCH_EXCLUDE_LIST="$2" + shift 2;; + + -M|--extra-mandir) MANDIR_LIST="${MANDIR_LIST} $( echo ${2} | sed s/,/\ / )" # replace commas with spaces for 'for' loops + shift 2;; + + -W|--extra-infodir) INFODIR_LIST="${INFODIR_LIST} $( echo ${2} | sed s/,/\ / )" + shift 2;; + + -E|--extra-libdir) LIBDIR_LIST="${LIBDIR_LIST} $( echo ${2} | sed s/,/\ / )" + shift 2;; + + -B|--extra-bindir) BINDIR_LIST="${BINDIR_LIST} $( echo ${2} | sed s/,/\ / )" + shift 2;; + + -R|--run-after) RUNCMDAFTER="$2" + shift 2;; + + --run-after-withlog) RUNCMDAFTER="$2" + RUNCMDAFTER_WITHLOG="Yes" + shift 2;; + + -v|--version) printf "${SLACKTRACKVERSION}\n" ; exit 0 ;; + + -h|--help) display_help ; exit 0 ;; + + -X|--delete-overlapping) ALLOWOVERLAPPINGFILES="No" + shift ;; + + --allow-overlapping) ALLOWOVERLAPPINGFILES="Yes" + shift ;; + + -Q|--standard) GZMAN="Yes" + GZINFO="Yes" + DELETEUSRINFODIR="Yes" + STRIPALLEXEC="Yes" + CREATEDESCRIPTION="Yes" + CHMOD644DOCS="Yes" + CHOWNBINSROOTROOT="Yes" + NOUSRTMP="Yes" + DELETEPERLLOCALPOD="Yes" + ALLOWOVERLAPPINGFILES="No" + shift ;; + + --showdeps) SHOWDEPS="Yes" + shift ;; + + --rootdir) ROOTDIR="$2" + shift 2;; + + --touch-filesystem-first) TOUCHFILESYSTEMFIRST=Yes + shift ;; + --touch-filesystem-faster) TOUCHFILESYSTEMFIRST=Yes + TOUCHFILESYSTEMFASTER=Yes + shift ;; + + + --) shift; break;; +esac done + +# The package name is the final argument in the list +COMMANDLINESCRIPT="$@" + +# +# Sanity checks: +# +# Support the user supplying the full path of the package name - e.g. slacktrack -p /tmp/foo-1.0-arm-1.tgz +# rather than specifying slacktrack -b /tmp -p foo-1.0-arm-1.tgz +if [ "$( dirname "$SLACKWAREPACKAGE" )" != "." ]; then + BUILDSTORE="$( dirname "$SLACKWAREPACKAGE" )" + SLACKWAREPACKAGE="$( basename "$SLACKWAREPACKAGE" )" +fi + +# Do we have a package name & a build script ? If not, bomb out. +if [ -z "${SLACKWAREPACKAGE}" -o -z "${COMMANDLINESCRIPT}" ]; then + display_usage help >&2 + exit 2 +fi + +# Why don't we check to see if the build script exists? +# Well, if I do "/bin/sh foo.build" -- how can I check whether it exists? +# Just don't pass slacktrack duff stuff ;) + +# Check package dependencies +if [ ! -z "${PACKAGEDEPEND}" ]; then + check_package_dep "${PACKAGEDEPEND}" || exit 3 +fi + +# If we didn't specify a temporary directory then we need make a random one +if [ -z "${SLACKTRACKTMPPATH}" ]; then + SLACKTRACKTMPPATH="/var/tmp/$$.$(date +%s).${RANDOM}.slacktrack.FAKEROOT" # Temporary path for file translation + else + # Remove duplicate / otherwise it breaks further down when we egrep it out of the 'changed files' + # list. + SLACKTRACKTMPPATH="$( echo $SLACKTRACKTMPPATH | tr -s '/' )" +fi + +# If we elected to strip everything in the entire package directory then +# set the other two strip options to something sensible to display to the +# user/log file. +if [ "${STRIPALLEXEC}" = "Yes" ]; then + STRIPLIB="Yes" + STRIPBIN="Yes" + STRIPARCHIVES="Yes" +fi + +# Let's check if user really has gpg. +if [ "${SIGNPACKAGE}" = "Yes" ]; then + which gpg >/dev/null 2>&1 || { echo "${PROGNAME}: Warning: Cannot find gpg; disabling signature creation"; SIGNPACKAGE="No"; } +fi + +# Display some info about the new package we're going to build +( +printf " +Package information +-------------------------------------------------- +Slackware package name...........................: ${SLACKWAREPACKAGE} +Build script/command line........................: ${COMMANDLINESCRIPT} +Build package store..............................: ${BUILDSTORE} +slacktrack log file..............................: ${SLACKTRACKLOGFILE} +slacktrack temporary dir.........................: ${SLACKTRACKTMPPATH} +Logging..........................................: ${LOGGING} +Create an MD5sum of the resulting package........: ${CREATEMD5SUM} +Sign the resulting package with GnuPG............: $( if [ "${SIGNPACKAGE}" = "Yes" ]; then echo "with ${SIGNINGKEY:-your default} key" ; else echo "No" ; fi ) +Create description file..........................: ${CREATEDESCRIPTION} +Log hard links...................................: ${LOGHARDLINKS} +chmod -R og-w....................................: ${CHMODNOGLOBALWRITE} +chown root:bin binary directories................: ${CHOWNBINDIRSROOTBIN} +chown root:bin binaries in bin dirs..............: ${CHOWNBINFILESROOTBIN} +chown root:root binary dirs & files..............: ${CHOWNBINSROOTROOT} +chmod 644 & chown root:root /usr/doc/*...........: ${CHMOD644DOCS} +Additional options to 'makepkg'..................: $( if [ -z "${MAKEPKGOPTS}" ]; then echo "[ None ]" ; else echo "${MAKEPKGOPTS}" ; fi ) +Tell 'makepkg' to create symlinks................: ${CREATESYMLINKS} +Call 'makepkg' with --setrootowner...............: ${SETROOTOWNER} +Tidy on finish...................................: ${TIDYONFINISH} +gzip man pages...................................: ${GZMAN} +gzip info pages..................................: ${GZINFO} +Fix broken gz man page symlinks..................: ${GZMANFIXSYMLINKS} +Fix broken gz info page symlinks.................: ${GZINFOFIXSYMLINKS} +Delete package's /usr/info/dir page..............: ${DELETEUSRINFODIR} +Delete perllocal.pod files in /usr/lib{,64}......: ${DELETEPERLLOCALPOD} +Strip executable ELF binaries....................: ${STRIPBIN} +Strip executable ELF shared objects..............: ${STRIPLIB} +Strip .a (archive) files.........................: ${STRIPARCHIVES} +Strip all executable ELF files...................: ${STRIPALLEXEC} +Path to strip utility............................: ${STRIPPROG} +Shared objects (libraries) dirs..................: ${LIBDIR_LIST} +Binary objects dirs..............................: ${BINDIR_LIST} +Man page dirs....................................: ${MANDIR_LIST} +Info page dirs...................................: ${INFODIR_LIST} +Delete /usr/tmp symlink..........................: ${NOUSRTMP} +Show dependencies to other packages..............: ${SHOWDEPS} +egrep pattern for dir/file/path exclusion........: ${EXCLUDE_LIST} +File system pre & post scan path exclusion regex : ${SEARCH_EXCLUDE_LIST} +Command/script to run after build script.........: $( if [ -z "${RUNCMDAFTER}" ]; then echo "None" ; else echo ${RUNCMDAFTER} ; fi ) +Directory slacktrack considers is root...........: ${ROOTDIR} +Allow files to overlap with other packages.......: ${ALLOWOVERLAPPINGFILES} +Delete orphaned Python *.pyc files...............: ${DELETEORPHANEDPYC} +Touch filesystem contents first..................: $( if [ -z "${TOUCHFILESYSTEMFIRST}" ]; then echo "No" ; else echo "in $FSTOUCHLIST" ; fi ) +--------------------------------------------------\n" +) 2>&1 | tee ${SLACKTRACKLOGFILE} + +# Ensure that the temporary directory (either one chosen by slacktrack or set manually +# with --tempdir) does not exist. +# A user may expect slacktrack to choose its own directory within a sub directory +# which it deliberately does not do. +# It's safest to abort if the directory exists to avoid destroying user data. +if [ -d "${SLACKTRACKTMPPATH}" ]; then + echo "${PROGNAME}: ERROR: Temporary directory ${SLACKTRACKTMPPATH} already exists" + echo " Please delete this directory before trying again." + exit 6 # error code=unsafe to continue + else + # We're safe to create the directory: + mkdir -pm700 "${SLACKTRACKTMPPATH}" +fi + +# Create a temporary 'scratch' directory inside the slacktrack +# temporary dir. This is to save build scripts managing their own +# temporary directories should the author be too lazy ;) +export SLACKTRACKSCRATCHDIR="${SLACKTRACKTMPPATH}/SCRATCHDIR" +mkdir -pm700 "${SLACKTRACKSCRATCHDIR}" + +export SLACKTRACKFAKEROOT="${SLACKTRACKTMPPATH}/TRANSL" +mkdir -pm755 "${SLACKTRACKFAKEROOT}" + +# Touch the contents of the filesystem. +( if [ "${TOUCHFILESYSTEMFIRST}" = "Yes" ]; then + echo -n "${PROGNAME}: Touching contents of" + for touching in $FSTOUCHLIST ; do + if [ -d "$touching" ]; then + echo -n " $touching" + # Also, exclude /lib/udev/devices: + if [ "${TOUCHFILESYSTEMFASTER}" = "Yes" ]; then + find $touching -path '/lib/udev/devices' -prune -o -print | xargs touch -c + else + # Do it the slower but safer, preferred way: + # This method handles files/dirs with spaces in the names - the above, faster method + # may fail to touch some files that have spaces in their file names - therefore you cannot + # be certain that a full 'state of the system' has been captured, which may lead to + # some new/modified files being excluded from the resulting .t?z package upon build completion. + find $touching -path '/lib/udev/devices' -prune -o -print | xargs -I '{}' touch -c '{}' + fi + # Update symlink time stamps on the symlink targets: + # There's not really any point in doing this actually since the build script + # or makefile would have to use ln -fs as well, in which case slacktrack + # would find the change with just the regular touching. + # To do this reliably, you could patch 'ln' to always force overwriting of the + # target. + # But if we wanted to, here's how we'd do it: + # find $touching -path '/lib/udev/devices' -prune -o -type l -printf "ln -nfs "%l" "%p"\n" | bash + fi + done + echo +fi ) 2>&1 | tee ${SLACKTRACKLOGFILE} + +# Generate list of files on the system prior to executing the build script +# +# I remove /mnt, /proc, /tmp and /home here to make the find +# execute more quickly. I have a box NFS mounted on /mnt +# so it's highly undesirable to scan another OS installation +# in addition to our own ;-) +BEFOREFILESLIST="${SLACKTRACKTMPPATH}/before_files.list" +AFTERFILESLIST="${SLACKTRACKTMPPATH}/after_files.list" +NEWFILESLIST="${SLACKTRACKTMPPATH}/new_files.list" +DIRLIST="${SLACKTRACKTMPPATH}/dir.list" + +echo -n "${PROGNAME}: Finding files on the system, please wait" +( cd ${ROOTDIR} + find . \( -regex "./\(${SEARCH_EXCLUDE_LIST}\)" -prune \) -o -not -name . -printf "%p %T@ %s\n" | cut -d. -f2- > ${BEFOREFILESLIST} ) >/dev/null 2>&1 +echo " ... done" + +# Launch build script with logging +if [ "${LOGGING}" = "Yes" ]; then + [ -x /usr/libexec/slacktrack/ln ] && export PATH=/usr/libexec/slacktrack:$PATH + ( printf "\n\n\n[$( date "+%D %r" )] ${PROGNAME}: Executing command line '${COMMANDLINESCRIPT}'\n\n" + ${COMMANDLINESCRIPT} + EXIT_CODE=$? + if [ ${EXIT_CODE} -gt 0 ]; then + printf "\n\n[$( date "+%D %r" )] ${PROGNAME}: * WARNING: ${COMMANDLINESCRIPT} returned exit code ${EXIT_CODE} *\n\n" + fi + printf "[$( date "+%D %r" )] ${PROGNAME}: Command line '${COMMANDLINESCRIPT}' finished\n\n" + ) 2>&1 | tee -a ${SLACKTRACKLOGFILE} + else + # Launch build script without logging (allows perl's CPAN interface to work) + ( printf "\n\n\n[$( date "+%D %r" )] ${PROGNAME}: Executing command line '${COMMANDLINESCRIPT}'\n\n" + [ -x /usr/libexec/slacktrack/ln ] && export PATH=/usr/libexec/slacktrack:$PATH + ${COMMANDLINESCRIPT} + EXIT_CODE=$? + if [ ${EXIT_CODE} -gt 0 ]; then + printf "\n\n[$( date "+%D %r" )] ${PROGNAME}: * WARNING: ${COMMANDLINESCRIPT} returned exit code ${EXIT_CODE} *\n\n" + fi + printf "[$( date "+%D %r" )] ${PROGNAME}: Command line '${COMMANDLINESCRIPT}' finished\n\n" + ) +fi + + +# Generate list of files post installation +# Again we miss out /mnt et al to speed up the process. +echo -n "${PROGNAME}: Finding files on the system, please wait" +( cd ${ROOTDIR} + find . \( -regex "./\(${SEARCH_EXCLUDE_LIST}\)" -prune \) -o -not -name . -printf "%p %T@ %s\n" | cut -d. -f2- > ${AFTERFILESLIST} ) >/dev/null 2>&1 +echo " ... done" + +# Generate new list of files on the system (compare before and after file list) +# and delete the list of files/dirs that match the egrep pattern exclude list. +echo -n "${PROGNAME}: Comparing file lists" +diff -Bbu ${BEFOREFILESLIST} ${AFTERFILESLIST} | grep "^+" | awk '{print $1}' | cut -d+ -f2- | \ +egrep -v "^(/$|\+\+$|${EXCLUDE_LIST}|${SLACKTRACKTMPPATH}$|${SLACKTRACKTMPPATH}/)" > ${NEWFILESLIST} +echo " ... done" + +# Remove all non-empty directories from our package contents list +# If we don't and we have any non-empty directories that have +# changed (or been accessed) then the tar (below) ends up +# including the directory & contents in its entirety into our new package! +cd ${SLACKTRACKFAKEROOT} +echo -n "${PROGNAME}: Removing non-empty directories from package contents list" +( cd ${ROOTDIR} + cat ${NEWFILESLIST} | while read fileline ; do + if [ -d "./${fileline}" ]; then + # We only retain the *empty* directories otherwise any directories + # created by our build scripts (such as place holders) will be + # removed. Everything contained within the non-empty directories will + # be picked up by tar. + if [ "$( find "./${fileline}" | wc -l )" -ne 1 ]; then + echo "${fileline}" >> "${DIRLIST}" + fi + fi + done ) > /dev/null 2>&1 +( cat ${NEWFILESLIST} ${DIRLIST} | sort | uniq -u > ${NEWFILESLIST}.new ) > /dev/null 2>&1 +mv -f ${NEWFILESLIST}.new ${NEWFILESLIST} +echo " ... done" + +# Copy the changed files into our temporary package directory +echo -n "${PROGNAME}: Copying the new/changed files into temporary directory" +( cd ${ROOTDIR} ; cut -d/ -f2- ${NEWFILESLIST} | tar pvvcf - -T- | tar -C${SLACKTRACKFAKEROOT} -pxf - ) >/dev/null 2>&1 +echo " ... done" + +# Do we have any files in the temporary directory ? +if [ "$( find ${SLACKTRACKTMPPATH}/TRANSL -print | wc -l )" -le 1 ]; then + ( printf "slacktrack: failed to track any activity\n" + printf " Perhaps the build script doesn't exist or is broken\n\n" + printf " ERROR: Cannot build a package\n\n" + ) 2>&1 | tee -a ${SLACKTRACKLOGFILE} + move_log # we will want to log this error incase we're using slacktrack through an unattended auto builder + tidy_workspace # clean up workspace + exit 5 +fi + +# Get back inside the package's root directory +# (we shouldn't have left it because all cding is done inside subshells +# but it doesn't hurt) +cd ${SLACKTRACKFAKEROOT} + +# Determine whether there are any files that overlap with other packages on the filesystem. +# These should be avoided since they may cause problems when upgrading packages (how would we know +# which package 'really' owns the file?) +# Output a list of all files *not* owned by the name of the package you're building +# (this caters for situations when the package you're building cannot be removed from the +# filesystem of a running system ("zlib" is an example)). +shopt -s extglob # needed to find package names +cd /var/log/packages # we need to enter a directory that doesn't contain the archive (*.t?z) filename of the package +find . -type f -not -name $( package_name ${SLACKWAREPACKAGE} )-+([^-])-+([^-])-+([^-]) | xargs sed -s -e '1,/FILE LIST:/d' | egrep -v '\/\.\/|^install/' > ${SLACKTRACKTMPPATH}/packaged_and_owned_files.list +shopt -u extglob # return to previous behaviour +cd ${SLACKTRACKFAKEROOT} + +# Find the unique entries in the packaged/owned files (there are lots of duplicate entries for /bin and so on) +# then merge it in with the list of new files we've found when creating this package, and finally +# identify the overlapping (duplicated) entries: +# Remove the absolute path name from the list of new files detected, so that we can compare them with the +# list in /var/log/packages: +sed 's?^/??g' ${SLACKTRACKTMPPATH}/new_files.list > ${SLACKTRACKTMPPATH}/new_files_noabsolutepath.list +sort -u ${SLACKTRACKTMPPATH}/packaged_and_owned_files.list | sort -m ${SLACKTRACKTMPPATH}/new_files_noabsolutepath.list - | uniq -d > ${SLACKTRACKTMPPATH}/overlapping_files.list +# Match an overlapping file to its package name and print out the list: +# This flapping between subshells and the parent is due to 'shopt' not working properly inside subshells +# and the need to direct the output of slacktrack to the log file. +# It's messy and horribly inefficient -- if you know of a better way, let me know! +if [ -s ${SLACKTRACKTMPPATH}/overlapping_files.list ]; then + ( echo "${PROGNAME}: Warning - found file overlap with existing packages:" ) 2>&1 | tee -a ${SLACKTRACKLOGFILE} + pushd /var/log/packages > /dev/null + shopt -s extglob # needed to find package names + cat ${SLACKTRACKTMPPATH}/overlapping_files.list | while read ofile ; do + # Identify the package(s!) that contains the overlapping file, but exclude the package name + # that we're currently building (it could be the case that an older version of the package + # we're currently building is already installed that also contains overlapping files. I assume + # that you're going to replace this older package, so it's not worth identifying the overlapping + # file as belonging to this other version). + # The following only works with 'new' (Slackware 8.1+) style package names: "foo-1.0-arm-1.t?z" + foundpkg="$( grep "$( echo "$ofile" )" * | awk -F: '{print $1}' | egrep -v "^$( package_name ${SLACKWAREPACKAGE} )-[^-]*-[^-]*-[^-]*$" | sed '2,$s/^/\t\ \ \ \ /' )" + if [ ! -z "$foundpkg" ]; then + ( # We found it in a package: + echo "File: $ofile" + echo "Package(s): $foundpkg" ) 2>&1 | tee -a ${SLACKTRACKLOGFILE} + fi + done + popd > /dev/null + shopt -u extglob # return to previous behaviour + if [ "${ALLOWOVERLAPPINGFILES}" = "No" ]; then + ( echo -n "${PROGNAME}: Deleting overlapping files from the package contents" + cat ${SLACKTRACKTMPPATH}/overlapping_files.list | while read ovlpfile ; do + rm -f "${SLACKTRACKFAKEROOT}/${ovlpfile}" + done + echo " ... done" ) 2>&1 | tee -a ${SLACKTRACKLOGFILE} + fi + fi + +# Restore original directory permissions from root filesytem. +# Why? Because we only store (in our file list), EMPTY directories. Example: +# I chmod 700 /etc/rc.d (which contains many startup scripts) +# My new file rc script is called 'rc.foo' and this is the only thing that's changed +# within /etc/rc.d. Therefore slacktrack only preserves the file name +# '/etc/rc.d/rc.foo', so tar has to create etc/rc.d for itself -- it has no +# information about its permissions/ownerships. +# Why don't I just tar up the directory? read the comments above the code that does the tar. +( if [ -s ${DIRLIST} ]; then + echo -n "${PROGNAME}: Restoring directory permissions & ownerships" + cat ${DIRLIST} | while read line ; do + find "${ROOTDIR}/${line}" -mindepth 0 -maxdepth 0 -printf "%U:%G" | xargs -0i chown {} "./${line}" + find "${ROOTDIR}/${line}" -mindepth 0 -maxdepth 0 -printf "%m" | xargs -0i chmod {} "./${line}" + done + echo " ... done" +fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE} + +# Get back inside the package's root directory +# (we shouldn't have left it because all cding is done inside subshells +# but it doesn't hurt) +cd ${SLACKTRACKFAKEROOT} + +# Create a temporary package using "makepkg" to contain everything that +# we have detected should be in the new package. +# This will be used to populate the /var/log/packages/$package entry - the only thing we're doing +# in this block of code is to generate the package entry for the build box, so that the build "mess" can be +# removed cleanly. The reason we do this here rather than use the contents of the $package (the final .t?z) is +# because post-build, we modify some files (such as gzipping man pages), and as such when we removepkg $package, +# removepkg won't delete /usr/man/man1/bash.1 because the entry would contain /usr/man/man1/bash1.gz +# First copy the contents to another temporary location so that makepkg can slice and dice it. +( echo -n "${PROGNAME}: Creating entries for $( echo $SLACKWAREPACKAGE | rev | cut -d. -f2- | rev ) in /var/log/{packages,scripts}" + cp -fa ${SLACKTRACKFAKEROOT} ${SLACKTRACKTMPPATH}/makepkg.tmppkg + cd ${SLACKTRACKTMPPATH}/makepkg.tmppkg + # Create a slack-desc that identifies this as a slacktrack special. + mkdir -pm755 install + NOEXTPKGNAM=$( echo $SLACKWAREPACKAGE | rev | cut -d. -f2- | rev ) +cat << EOF > install/slack-desc + |-----handy-ruler------------------------------------------------------| +${NOEXTPKGNAM}: $NOEXTPKGNAM +${NOEXTPKGNAM}: +${NOEXTPKGNAM}: This package entry represents the filesystem as it was when slacktrack +${NOEXTPKGNAM}: finished executing your build script. +${NOEXTPKGNAM}: +${NOEXTPKGNAM}: There has been no post processing on the contents of the package +${NOEXTPKGNAM}: (for example, no compression of man pages). +${NOEXTPKGNAM}: +${NOEXTPKGNAM}: The primary purpose of this entry is to allow easy removal of the +${NOEXTPKGNAM}: package contents with the Slackware removepkg tool. +${NOEXTPKGNAM}: +EOF + + ${MAKEPKG} -l y -c n ${SLACKTRACKTMPPATH}/${SLACKWAREPACKAGE} >/dev/null 2>&1 + # We don't need to install it on to the root filesystem since we already have the contents, + # all that we need is the /var/log/{packages,scripts} entries to allow manipulation by pkgtools. + mkdir -pm755 ${SLACKTRACKTMPPATH}/fakeinstalldir + installpkg --root ${SLACKTRACKTMPPATH}/fakeinstalldir ${SLACKTRACKTMPPATH}/${SLACKWAREPACKAGE} >/dev/null 2>&1 + cp -fa ${SLACKTRACKTMPPATH}/fakeinstalldir/var/log/scripts/$NOEXTPKGNAM /var/log/scripts/ >/dev/null 2>&1 + cp -fa ${SLACKTRACKTMPPATH}/fakeinstalldir/var/log/packages/$NOEXTPKGNAM /var/log/packages/ >/dev/null 2>&1 +echo " ... done" ) 2>&1 | tee -a ${SLACKTRACKLOGFILE} + +# gzip man pages ? +# Note that we prefix the dir name with ./ - this is so that if users specify +# additional directories with --extra-xxxdir and include / , then it doesn't actually +# *look* in the root dir. +( if [ "${GZMAN}" = "Yes" ]; then + echo -n "${PROGNAME}: gzipping man pages" + for man_dir in ${MANDIR_LIST}; do + if [ -d "./${man_dir}" ]; then + ( find ./${man_dir} -type f -name '*.bz2' -print0 | xargs -0 bzip2 -df ) >/dev/null 2>&1 + ( find ./${man_dir} -type f -print0 | xargs -0 gzip -9f ) >/dev/null 2>&1 + ( find ./${man_dir} -type f -print0 | xargs -0 chmod 644 ) >/dev/null 2>&1 + fi + done + echo " ... done" + + if [ "${GZMANFIXSYMLINKS}" = "Yes" ]; then + echo -n "${PROGNAME}: Fixing any broken symlinks in man page directories" + # Fix up symlinks unless instructed not to + for man_dir in ${MANDIR_LIST}; do + if [ -d "./${man_dir}" ]; then + ( cd ./${man_dir} + # Enter each man page directory (man1,man2..) and whittle them down one by one + for i in $( find . -type d -maxdepth 1 -printf "%P\n" | grep -v "^$" ); do + # We cd into the man dir then use find to construct some shell commands & pipe into + # bash for execution. Neat huh? ;) + cd ${i} && ( find . -type l -printf "rm -f %P ; ln -s %l.gz %p.gz\n" ) | /bin/bash && cd .. + done + ) + fi + done + echo " ... done" + fi + fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE} + +# Delete any perllocal.pod files found in /usr/lib: +( if [ "${DELETEPERLLOCALPOD}" = "Yes" ]; then + echo -n "${PROGNAME}: Deleting perllocal.pod files in /usr/lib and /usr/lib64" + ( find usr/lib{,64} -name perllocal.pod -print0 | xargs -0 rm -f ) >/dev/null 2>&1 + echo " ... done" + fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE} + +# Delete package's /usr/info/dir ? +# You're more than likely going to want to do this. +( if [ "${DELETEUSRINFODIR}" = "Yes" -a -f usr/info/dir ]; then + echo -n "${PROGNAME}: Deleting /usr/info/dir" + rm -f usr/info/dir + echo " ... done" + fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE} + +# gzip info pages ? +( if [ "${GZINFO}" = "Yes" ]; then + echo -n "${PROGNAME}: gzipping info pages" + for info_dir in ${INFODIR_LIST}; do + if [ -d "./${info_dir}" ]; then + ( find ./${info_dir} -type f -name '*.bz2' -print0 | xargs -0 bzip2 -df ) >/dev/null 2>&1 + ( find ./${info_dir} -type f -print0 | xargs -0 gzip -9f ) >/dev/null 2>&1 + ( find ./${info_dir} -type f -print0 | xargs -0 chmod 644 ) >/dev/null 2>&1 + fi + done + echo " ... done" + + if [ "${GZINFOFIXSYMLINKS}" = "Yes" ]; then + echo -n "${PROGNAME}: Fixing any broken symlinks in info page directories" + # Fix up symlinks unless instructed not to + for info_dir in ${INFODIR_LIST}; do + if [ -d "./${info_dir}" ]; then + ( cd ./${info_dir} && ( find . -type l -printf "rm -f %P ; ln -s %l.gz %p.gz\n" ) | /bin/bash ) + fi + done + echo " ... done" + fi + fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE} + + +# Strip shared objects ? +( if [ "${STRIPLIB}" = "Yes" ]; then + echo -n "${PROGNAME}: Stripping unstripped ELF shared objects" + for i in ${LIBDIR_LIST}; do + ( cd ./${i} && find . -name '*.so*' -type f \( -perm -100 -o -perm -010 -o -perm -001 \) -print0 | xargs -0 file | egrep '(ELF.*shared.*not stripped)' | awk -F: '{print $1}' | xargs ${STRIPPROG} -p --strip-unneeded ) > /dev/null 2>&1 + done + echo " ... done" + fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE} + + +# Strip .a (archive) files ? +( if [ "${STRIPARCHIVES}" = "Yes" ]; then + echo -n "${PROGNAME}: Stripping .a (archive) files" + ( find . -name '*.a' -type f -print0 | xargs -0 ${STRIPPROG} -p -g ) > /dev/null 2>&1 + echo " ... done" + fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE} + + +# Strip binaries? +( if [ "${STRIPBIN}" = "Yes" ]; then + echo -n "${PROGNAME}: Stripping unstripped ELF binaries" + for i in ${BINDIR_LIST}; do + ( cd ./${i} && find . -type f \( -perm -100 -o -perm -010 -o -perm -001 \) -print0 | xargs -0 file | egrep '(ELF.*not stripped)' | awk -F: '{print $1}' | xargs ${STRIPPROG} -p --strip-unneeded ) >/dev/null 2>&1 + done + echo " ... done" + fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE} + + +# Strip everything? This does the same as the above but instead it does it across +# the entire package directory -- therefore it finds stuff in /opt and anywhere else +# that files have been created. You may prefer to use this option if you already use -jkA +# but it's worth noting that it will take longer (especially on a package with many files +# in a deep directory structure) +( if [ "${STRIPALLEXEC}" = "Yes" ]; then + echo -n "${PROGNAME}: Stripping all unstripped executable ELF files" + ( find . -type f \( -perm -100 -o -perm -010 -o -perm -001 \) -print0 | xargs -0 file | egrep '(ELF.*not stripped)' | awk -F: '{print $1}' | xargs ${STRIPPROG} -p --strip-unneeded ) >/dev/null 2>&1 + # Strip the .a archives + ( find . -name '*.a' -type f -print0 | xargs -0 ${STRIPPROG} -p -g ) > /dev/null 2>&1 + echo " ... done" + fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE} + + +# If we find <package_builddir>/usr/tmp is a symlink then delete it. +# Some programs such as Apache seem to put stuff in here. /usr/tmp is a symlink and is +# created by Slackware's 'aaa_base' package. +( if [ "${NOUSRTMP}" = "Yes" -a -h "usr/tmp" ]; then + echo "${PROGNAME}: Deleting /usr/tmp symlink from package build directory" + rm -rf "${SLACKTRACKTMPPATH}/TRANSL/usr/tmp" + fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE} + + +# Run chmod -R og-w over the package directory ? +# In general you won't want to do this because you should take care of your +# own permissions on a per-build-script basis. However, some software such +# as PHP leaves files globally writeable (even a recent Slackware PHP package +# had files og+w). +( if [ "${CHMODNOGLOBALWRITE}" = "Yes" ]; then + echo -n "${PROGNAME}: Running chmod -R og-w on package contents" + chmod -R og-w . + echo " ... done" + fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE} + + +# Fix up ownerships in the package. According to the 'README' that comes with +# Pat's 'slack-tools' scripts say: +# "non-setuid binaries in /bin, /sbin, /usr/bin, and /usr/sbin are +# all chown root:bin (and the directories are, too)" +# However, I spot traceroute as being setuid and owned by root.bin +# So we'll just set everything in & including those dirs to be root.bin +# You WON'T want to always use this facility -- some build scripts such as +# 'floppy' set their own permissions correctly. Again, you need to check over +# the package afterwards and make changes to your build script accordingly. +( if [ "${CHOWNBINDIRSROOTBIN}" = "Yes" ]; then + echo -n "${PROGNAME}: chowning root:bin the directories ${BINDIR_LIST}" + for i in ${BINDIR_LIST}; do + # Yes, we're assuming we may have dirs inside our bins. I've yet to see + # one but there may be in the future. + ( cd ./$i && find . -type d -print0 | xargs -0 chown root:bin ) >/dev/null 2>&1 + done + echo " ... done" + fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE} + + +# chown root:bin files +# Please note that any additional paths specified using --extra-bindir +# will NOT be considered here. The Slackware standard is to only chown root:bin on +# /usr dirs -- if you look at /opt/kde/bin you'll see the files are owned by root.root +( if [ "${CHOWNBINFILESROOTBIN}" = "Yes" ]; then + echo -n "${PROGNAME}: chowning root:bin the files inside ${BINDIR_LIST}" + for i in ${BINDIR_LIST}; do + ( cd ./$i && find . -type f -printf "chown root:bin '%p' && chmod %m '%p'\n" | /bin/bash ) > /dev/null 2>&1 + done + echo " ... done" + fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE} + + +# chown root:root files. +# This was introduced in Slackware v11. +# Please note that any additional paths specified using --extra-bindir +# will NOT be considered here. The Slackware standard is to only chown root:root on +# /usr dirs -- if you look at /opt/kde/bin you'll see the files are owned by root:root +( if [ "${CHOWNBINSROOTROOT}" = "Yes" ]; then + echo -n "${PROGNAME}: chowning root:root on files inside ${BINDIR_LIST}" + for i in ${BINDIR_LIST}; do + ( cd ./$i && find . -type f -printf "chown root:root '%p' && chmod %m '%p'\n" | /bin/bash ) > /dev/null 2>&1 + done + echo " ... done" + fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE} + + +# chmod 644 & chown root:root docs in usr/doc ? +# This is my own 'thing'. I don't like having any executable files in +# my docs directory. +( if [ "${CHMOD644DOCS}" = "Yes" -a -d "usr/doc" ]; then + echo -n "${PROGNAME}: Running chmod 644 over documents in usr/doc/" + ( find usr/doc/ -type f -print0 | xargs -0 chmod 644 ) >/dev/null 2>&1 + ( chown -R root:root usr/doc/ ) >/dev/null 2>&1 + echo " ... done" + fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE} + + +# If the user has specified both --setrootowner and --chown-bdirs-root-bin then warn +# them that their dirs permissions will be changed +# These options aren't mutually exclusive because --chown-bdirs-root-bin +# ONLY chowns /bin,/sbin,/usr/bin & /usr/sbin +( if [ "${CHOWNBINDIRSROOTBIN}" = "Yes" -a "${SETROOTOWNER}" = "Yes" ]; then + echo "${PROGNAME}: * WARNING *" + echo " You have specified both --setrootowner AND --chown-bdirs-root-bin" + echo " options, but Slackware's makepkg script will change the" + echo " directory permissions to 'root.root'." + fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE} + + +# Ensure the 'root' directory of the tarchive is globally readable +# else it breaks your root dir thus your system when you install the package ;) +chmod 755 ${SLACKTRACKTMPPATH}/TRANSL +chown root:root ${SLACKTRACKTMPPATH}/TRANSL + +# Delete any orpahaned *.pyc files - these do not have a matching *.py file +# that was detected by slacktrack. It doesn't mean that there isn't a file +# on the *filesystem*, just that if there was, it was not modified during the +# build, and so probably doesn't belong in the package, and infact may be +# conflicting with an existing file in another package. +( if [ "${DELETEORPHANEDPYC}" = "Yes" ]; then + echo "${PROGNAME}: Deleting any orphaned *.pyc files within the package" + find . -name '*.pyc' -type f | sed 's/\(.*\)\..*/\1/' | while read pycfile ; do + # We searched for .pyc files and chopped off the file extension; if + # we dont find a matching .py file for the .pyc, then we wipe it: + if [ ! -f "${pycfile}.py" ]; then + # Wipe the *.pyc file, and if that was successful then try and rmdir the directory + # and its parents. This will fail if there were more than just *.pyc files. + # We redirect to a temporary log file because rmdir displays its progress + # as it goes, rather than doing its business then reporting -- so + # we'd see "Removing directory /usr/foo", next line "Failed removing /usr/foo" + # This way we only display the log file if rmdir successfully removed the dir. + # Note however, that if it's a directory such as /usr/lib, then rmdir will try + # and remove that on every invocation, which will fail - so we'll never see + # the output; this isn't what I'd like but I don't see a way around it + # and it's not a big deal. + { rm -fv "${pycfile}.pyc" ; } && { rmdir -vp "$( dirname ${pycfile}.pyc )" > ${SLACKTRACKTMPPATH}/rmdir.out 2>&1 && cat ${SLACKTRACKTMPPATH}/rmdir.out ; } + fi + done + # Remove that temp file + rm -f ${SLACKTRACKTMPPATH}/rmdir.out + fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE} + +# If the buildstore doesn't exist then we'll use /tmp instead +# We don't check this earlier because *my* scripts mkdir /tmp/built-slackwarepackages +# and Slackware's SlackBuild scripts leave the package in /tmp -- and /tmp must always exist +# We won't try and create the dir because if you made a typo in the dir name, you +# make find your package (that may contain sensitive files) ends up in a globally readable +# area. +if [ ! -d "${BUILDSTORE}" ]; then + printf "${PROGNAME}: WARNING: The build store directory ${BUILDSTORE}\n" + printf " does not exist; using /tmp instead\n\n" + BUILDSTORE="/tmp/" +fi + + +# Show dependencies to the INSTALLED packages ? +( if [ "${SHOWDEPS}" = "Yes" ]; then + LDDEPSFILE="${SLACKTRACKTMPPATH}/ld_list" + LDDEPSUNRESOLVED="${SLACKTRACKTMPPATH}/ld_unresolved" + LDDEPSFOUNDPACKAGES="${SLACKTRACKTMPPATH}/ld_found_packages" + + echo -n "${PROGNAME}: Generating list of shared library dependencies" + # I grep out 'not found' from the list because if this package CONTAINS the + # 'not found' library then we're not going to find it in /var/log/packages + # This isn't the same as having what I call an 'orphaned' library. + ( find . -type f \( -perm -100 -o -perm -010 -o -perm -001 \) -print0 | xargs -0 file | egrep '(ELF.*shared)' | \ + awk -F: '{print $1}' | xargs ldd 2>/dev/null | grep '=>' | grep -vi 'not found' | \ + awk '{print $3}' | grep -v "^$" > "${LDDEPSFILE}" ) > /dev/null 2>&1 + + if [ ! -s "${LDDEPSFILE}" ]; then + printf "\n Failed to find any shared object dependencies\n" + else + + # Remove dupes from the list + sort "${LDDEPSFILE}" | uniq > "${LDDEPSFILE}.sorted" + mv -f "${LDDEPSFILE}.sorted" "${LDDEPSFILE}" + + # Look in /var/log/packages and /var/log/scripts (because our library + # may be linked against a symlink) and find our packages. + # Now, a problem that we have is that some of + # Slackware's packages have an 'incoming' directory (eg glibc) + # to avoid trampling over the running system without doing + # some pokery first. + # This is why I am *only* keeping the .so name rather than the + # full path leading to it. + cat "${LDDEPSFILE}" | rev | cut -d/ -f1 | rev | while read library_name ; do + ( ( cd /var/log/packages && grep -l ${library_name} * ) || ( cd /var/log/scripts && grep -l ${library_name} * ) ) >> "${LDDEPSFOUNDPACKAGES}" + # If we couldn't find it in a package (most likely because + # it's linked against something that was compiled 'locally' rather than + # being brewed into a package, or because you've broken your packages list) + if [ $? -gt 0 ]; then + # This way it shows the full path to the library rather than just its file name. + egrep "${library_name}$" "${LDDEPSFILE}" >/dev/null 2>&1 && \ + echo "$( egrep "${library_name}$" "${LDDEPSFILE}" )" >> "${LDDEPSUNRESOLVED}" + fi + done + + # Before you think "Hold on a second old cheese, but some libraries + # exist in more than one package (glibc/glibc-solibs is an example) + # so what you going to do about that?" + # Absolutely nothing! :-) That'd mean having some sort of database + # to know that you'd only need one of the packages listed. + # *Also*, if you think about it, then who's to tell you whether you + # should have glibc OR glibc-solibs? *I* only install 'glibc' because + # I compile stuff (you don't need -solibs if you have the + # developer/full package) .. then if I compiled this package on a box + # that only had 'openssl' (rather than openssl-solibs *AND* openssl) + # then... oh it's too complicated. It's like a paradox or something. + + # Remove any dupes from the package list + sort "${LDDEPSFOUNDPACKAGES}" | uniq > "${LDDEPSFOUNDPACKAGES}.sorted" + mv -f "${LDDEPSFOUNDPACKAGES}.sorted" "${LDDEPSFOUNDPACKAGES}" + + # From 'generating list of dependencies' above. + echo " ... done" + + # Dump the list of package dependencies to screen + if [ -s "${LDDEPSFOUNDPACKAGES}" ]; then + echo "${PROGNAME}: This package depends on libraries within the following installed packages:" + egrep -v "$( package_name ${SLACKWAREPACKAGE} )" "${LDDEPSFOUNDPACKAGES}" | while read line ; do + printf "\t ${line}\n" + done + fi + + # Now dump the list of dependencies into a log file. + # We could store it somewhere in the package I suppose, any suggestions? + install -m644 "${LDDEPSFOUNDPACKAGES}" "${BUILDSTORE}/$( echo $SLACKWAREPACKAGE | rev | cut -d. -f2- | rev ).ld_deps.log" + + # And if we found any libraries that aren't part of installed packages, dump + # those too. + if [ -s "${LDDEPSUNRESOLVED}" ]; then + echo "${PROGNAME}: The following libraries were not found in any installed package:" + cat "${LDDEPSUNRESOLVED}" | while read line ; do + printf "\t ${line}\n" + done + # Not much point in listing libraries in the package if we can't + # tell the user how to get a package containing that library, so + # we'll just log it and let the developer fix it afterwards. + install -m644 "${LDDEPSUNRESOLVED}" "${BUILDSTORE}/$( echo $SLACKWAREPACKAGE | rev | cut -d. -f2- | rev ).orphaned_ld_deps.log" + fi + fi + +fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE} + + +# Launch an external command/script before running makepkg ? +# This may be useful to inspect the package contents with a file manager such as +# Midnight Commander or xtc. +# This is extremly useful for slacktrack as you can fix up symlinks and stuff +# that you couldn't do inside the root file system. +if [ ! -z "${RUNCMDAFTER}" ]; then + echo "${PROGNAME}: Launching external command '${RUNCMDAFTER}'" >> ${SLACKTRACKLOGFILE} + # Enter the package's root directory and run the command, appending any output to + # slacktrack's log: + if [ "${RUNCMDAFTER_WITHLOG}" = "Yes" ]; then + ( cd ${SLACKTRACKTMPPATH}/TRANSL ; ${RUNCMDAFTER} ) 2>&1 | tee -a ${SLACKTRACKLOGFILE} + else + # No logging - best for manual intervention or a curses type program, since this would + # potentially cause an unclean log file: + ( cd ${SLACKTRACKTMPPATH}/TRANSL ; ${RUNCMDAFTER} ) + fi + echo "${PROGNAME}: External command finished" >> ${SLACKTRACKLOGFILE} +fi + + +# Execute the Slackware package making utility & append its output to the package logfile +( ${MAKEPKG} ${MAKEPKGOPTS} \ + --linkadd $( echo ${CREATESYMLINKS} | cut -b1 | tr A-Z a-z ) \ + --chown $( echo ${SETROOTOWNER} | cut -b1 | tr A-Z a-z ) \ + ${BUILDSTORE}/${SLACKWAREPACKAGE} + + # Warn if no slack-desc file found. You don't need a doinst.sh script + # though, so we won't bother with that one. + # Why do this *after* running makepkg? makepkg makes lots of noise + # and unless you specifically scroll up or look at logs, you'll miss this warning. + if [ ! -s "install/slack-desc" ]; then + echo "${PROGNAME}: WARNING - /install/slack-desc not found or is 0 bytes" + fi + + # Display the size of the package: + if [ -f "${BUILDSTORE}/${SLACKWAREPACKAGE}" ]; then + printf "${PROGNAME}: ${SLACKWAREPACKAGE}'s size is $( ls -lah ${BUILDSTORE}/${SLACKWAREPACKAGE} | awk '{print $5}' )\n" + fi + + # Create an MD5sum of the package if requested + if [ "${CREATEMD5SUM}" = "Yes" ]; then + echo -n "${PROGNAME}: Creating an MD5 sum of ${SLACKWAREPACKAGE}" + ( cd "${BUILDSTORE}" + md5sum "${SLACKWAREPACKAGE}" > "${SLACKWAREPACKAGE}.md5" ) + echo " ... done" + fi + + # Sign the package if requested to do so. + if [ "${SIGNPACKAGE}" = "Yes" ]; then + echo -n "${PROGNAME}: Signing ${SLACKWAREPACKAGE} with ${SIGNINGKEY:-your default} key" + ( cd "${BUILDSTORE}" + GPG_OPTIONS="--detach-sign --yes --armor" + if [ "${SIGNINGKEY}" ]; then + GPG_OPTIONS="${GPG_OPTIONS} --local-user $SIGNINGKEY" + fi + + gpg ${GPG_OPTIONS} --output ${SLACKWAREPACKAGE}.asc ${SLACKWAREPACKAGE} + if [ $? -ne 0 ]; then + printf "\n${PROGNAME}: ERROR: Signature has not been correctly generated\n" + else + echo " ... done" + fi ) + + fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE} + + +# Copy the slack-desc file into the build store path ? +( if [ "${CREATEDESCRIPTION}" = "Yes" -a -f "${SLACKTRACKTMPPATH}/TRANSL/install/slack-desc" ]; then + echo "${PROGNAME}: Installing package description file into build store" + # Cut the handy ruler, comments and empty lines out of the file. + egrep -v '^($|#| *\|)' ${SLACKTRACKTMPPATH}/TRANSL/install/slack-desc > "${BUILDSTORE}/$( echo $SLACKWAREPACKAGE | rev | cut -d. -f2- | rev ).txt" + chmod 644 "${BUILDSTORE}/$( echo $SLACKWAREPACKAGE | rev | cut -d. -f2- | rev ).txt" + fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE} + + +# Log hard links +# Some packages (such as Python) use ln to create hard links rather than soft links. +# It is impossible to determine the original file name of a hard link, and thus +# must be weeded out manually. +( if [ "${LOGHARDLINKS}" = "Yes" ]; then + echo -n "${PROGNAME}: Scanning for hard links" + printf "$( find ${SLACKTRACKTMPPATH}/TRANSL -type f -links +1 -printf "Hard link: %P\n" )\n" > ${SLACKTRACKLOGFILE}.hardlinks + if [ ! -z "$( grep "Hard link:" ${SLACKTRACKLOGFILE}.hardlinks )" ]; then + printf "\nWARNING: The following hard links were detected\n" + cat ${SLACKTRACKLOGFILE}.hardlinks + echo + # We will ALWAYS create a log file for hardlinks regardless of whether logging is disabled. + # The packager HAS to know about them ! + mv ${SLACKTRACKLOGFILE}.hardlinks "${BUILDSTORE}/$( echo $SLACKWAREPACKAGE | rev | cut -d. -f2- | rev ).hardlinks.log" + else + echo " ... none found" + rm -f "${SLACKTRACKLOGFILE}.hardlinks" + fi +fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE} + +# Tidy up workspace: +tidy_workspace + +# Report that slacktrack has finished, but to the log only. +printf "\n\n[$( date "+%D %r" )] ${PROGNAME} finished.\n" >> ${SLACKTRACKLOGFILE} + + +# Unless the user has specified their own logfile, we'll use packagename-ver-arch-build.log +# If they've disabled logging with --nologging then simply delete the log file. +# You could say this was sloppy, that we're logging in the first place if we're told not to +# but given that most make scripts scroll tens of pages off the screen, I think a log file +# is *Always* handy to have, even if you don't retain it. +move_log + + +# Report that slacktrack has finished (to screen only). +printf "\n\n[$( date "+%D %r" )] ${PROGNAME} finished.\n" + +exit 0 +#EOF diff --git a/source/d/slacktrack/slacktrack-project/slack-desc b/source/d/slacktrack/slacktrack-project/slack-desc new file mode 100644 index 00000000..167f8e09 --- /dev/null +++ b/source/d/slacktrack/slacktrack-project/slack-desc @@ -0,0 +1,21 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':'. +# +# I've broken the 11 line rule here but installpkg can handle up to 13. +# + |-----handy-ruler------------------------------------------------------| +slacktrack: slacktrack (Slackware package building utilities) +slacktrack: +slacktrack: slacktrack tracks the installation of a 'make install' (or similar) +slacktrack: and produces a Slackware compliant package from the results. +slacktrack: +slacktrack: slacktrack can be used to build packages from Slackware's '.build' +slacktrack: scripts or your own. +slacktrack: +slacktrack: slacktrack tracks installations directly on the host's filesystem. +slacktrack: +slacktrack: diff --git a/source/d/slacktrack/slacktrack-project/slacktrack.SlackBuild b/source/d/slacktrack/slacktrack-project/slacktrack.SlackBuild new file mode 100755 index 00000000..244d92ed --- /dev/null +++ b/source/d/slacktrack/slacktrack-project/slacktrack.SlackBuild @@ -0,0 +1,107 @@ +#!/bin/bash + +################################################################# +# Program: slacktrack.SlackBuild +# Purpose: Build a Slackware Package of slacktrack +# Author : Stuart Winter <mozes@slackware.com> +# Version: 1.06 +# Date...: 05-Apr-2013 +################################################################# + +PKGNAM=slacktrack +VERSION=${VERSION:-2.18} +BUILD=${BUILD:-1} + +# Automatically determine the architecture we're building on: +case "$( uname -m )" in + i?86) export ARCH=i586 + PKGEXT=txz ;; + arm*) export ARCH=arm + PKGEXT=txz ;; + # Unless $ARCH is already set, use uname -m for all other archs: + *) export ARCH=$( uname -m ) + PKGEXT=txz ;; +esac + +SLACKPACKAGE=$PKGNAM-$VERSION-$ARCH-$BUILD.$PKGEXT + +# Resting place for the package .t?z: +PKGSTORE=${PKGSTORE:=/tmp} + +# Temporary unarchive, compile & package-root directory: +TMP=/tmp/build-slacktrack +PKG=/tmp/package-slacktrack + +# Work out where we are now so we can untar our source ball from it: +CWD=$PWD + +# Delete previous build dirs +rm -rf $PKG $TMP +mkdir -pm755 $PKG $TMP + +# Create package framework: +mkdir -pm755 $PKG/{install,usr/{libexec/slacktrack,bin,doc/$PKGNAM-${VERSION},man/man8}} + +# slacktrack's docs: +cp -fav $CWD/docs/* $PKG/usr/doc/$PKGNAM-${VERSION} +rm -fv $PKG/usr/doc/$PKGNAM-${VERSION}/INSTALL + +# Fix any wonky permissions the docs may have attracted: +find $PKG/usr/doc -type f -print0 | xargs -0 chmod 644 +find $PKG/usr/doc -type f -print0 | xargs -0 chown root:root + +# Install man pages: +( cd $CWD/man + ./man.build + gzip -9c slacktrack.8 > $PKG/usr/man/man8/slacktrack.8.gz + gzip -9c slackdtxt.8 > $PKG/usr/man/man8/slackdtxt.8.gz + rm -f *.8 ) + +# Install slacktrack & friends: +install -oroot -groot -vpm755 $CWD/scripts/{slacktrack,slackdtxt} \ + $PKG/usr/bin + +# Build the ln wrapper: +gcc -O3 $CWD/ln-wrapper.c -o $PKG/usr/libexec/slacktrack/ln || exit 1 +strip --strip-unneeded $PKG/usr/libexec/slacktrack/ln + +# Install package description: +install -vpm644 $CWD/slack-desc $PKG/install + +# Build package: +cd $PKG +chown -R root:root . +chmod -R og-w . +makepkg -l y -c n $PKGSTORE/$SLACKPACKAGE + +# Create the corresponding .txt description file: +( cd $PKGSTORE && $CWD/scripts/slackdtxt $SLACKPACKAGE ) + +# Package maintainer stuff: +PARAMS="$( getopt -qn "$( basename $0 )" -o iz -- "$@" )" +if [ $? -eq 0 ]; then + eval set -- "$PARAMS" + for option in $* ; do + case "${option}" in + -i) + removepkg slacktrack + installpkg $PKGSTORE/$SLACKPACKAGE + shift ;; + + -z) + echo -n "Making a distributable source archive" + ( cd $CWD/.. + # Don't worry, you're not missing much! + chown -R root:root . + tar --exclude slacktrack/2bourbon \ + --exclude slacktrack/old_stuff \ + -Ixz -cf $CWD/../slackware-package-dir/slacktrack/$PKGNAM-${VERSION}-source.tar.xz slacktrack-project ) + echo " ... done" + shift ;; + esac done +fi + +# Delete temporary build dir and package-root. +# I don't like doing this anymore - I prefer to be able to refer back to +# the compiled source tree after the build. +#rm -rf $TMP $PKG diff --git a/source/d/slacktrack/slacktrack-project/tests/test-exclusion b/source/d/slacktrack/slacktrack-project/tests/test-exclusion new file mode 100755 index 00000000..cbb2d32c --- /dev/null +++ b/source/d/slacktrack/slacktrack-project/tests/test-exclusion @@ -0,0 +1,12 @@ +#!/bin/bash +eval $( grep ^EXCLUDE_LIST ../scripts/slacktrack ) + +cat << EOF | egrep "$EXCLUDE_LIST" +/var/lib/NetworkManager/dir +/usr/bin/wn +/usr/man/whatis.gz +/usr/local/man/whatis.gz +/var/lib/pgsql/foop +/var/lib/mysql +EOF + |