From b1b9d2d964783797f72bd4148cbf413ea98d0a18 Mon Sep 17 00:00:00 2001 From: Peter Hyman Date: Mon, 20 Jun 2022 07:03:54 -0500 Subject: [PATCH 1/3] Update slackpkg.conf.new and slackpkg.conf.5 - Show DOWNLOADER options for curl usage. - Update manpage date and slackpkg version. --- files/slackpkg.conf.5 | 14 +++++++++++++- files/slackpkg.conf.new | 8 ++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/files/slackpkg.conf.5 b/files/slackpkg.conf.5 index e8ca95d..e202f85 100644 --- a/files/slackpkg.conf.5 +++ b/files/slackpkg.conf.5 @@ -1,4 +1,4 @@ -.TH SLACKPKG.CONF 5 "March 2021" slackpkg-15.0.1 "" +.TH SLACKPKG.CONF 5 "June 2022" slackpkg-15.0.10 "" .SH NAME .B slackpkg.conf \- Configuration data for slackpkg @@ -98,6 +98,18 @@ The default value of .B WORKDIR is /var/lib/slackpkg. +.TP 5 +.B DOWNLOADER +.br +Selects the download application slackpkg will use to fetch files. +Current options are \fBcurl\fR or \fBwget\fR. Default is wget. + +.TP 5 +.B CURLFLAGS +.br +Selects special options for curl. If you need to use multiple options, +remember to put them between double quotes. + .TP 5 .B WGETFLAGS .br diff --git a/files/slackpkg.conf.new b/files/slackpkg.conf.new index cbc845d..d96b759 100644 --- a/files/slackpkg.conf.new +++ b/files/slackpkg.conf.new @@ -70,6 +70,14 @@ TEMP=/var/cache/packages # Package lists, file lists, and others will be stored in WORKDIR: WORKDIR=/var/lib/slackpkg +# Use curl or wget for Downloading (wget is default) +#DOWNLOADER=curl + +DOWNLOADER=wget + +# Special options for curl +#CURLFLAGS= + # Special options for wget (default is WGETFLAGS="--passive-ftp") WGETFLAGS="--passive-ftp" From 724f444515b8f9ced83b7a0cb5ddcaf7b4a97f99 Mon Sep 17 00:00:00 2001 From: piterpunk Date: Wed, 5 Apr 2023 19:48:37 -0300 Subject: [PATCH 2/3] Minor formatting fixes --- files/slackpkg.conf.5 | 6 +++++- files/slackpkg.conf.new | 4 +--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/files/slackpkg.conf.5 b/files/slackpkg.conf.5 index e202f85..e47da8b 100644 --- a/files/slackpkg.conf.5 +++ b/files/slackpkg.conf.5 @@ -102,7 +102,11 @@ is /var/lib/slackpkg. .B DOWNLOADER .br Selects the download application slackpkg will use to fetch files. -Current options are \fBcurl\fR or \fBwget\fR. Default is wget. +Current options are "curl" or "wget". + +The default value of +.B DOWNLOADER +is "wget" .TP 5 .B CURLFLAGS diff --git a/files/slackpkg.conf.new b/files/slackpkg.conf.new index d96b759..96a4173 100644 --- a/files/slackpkg.conf.new +++ b/files/slackpkg.conf.new @@ -70,9 +70,7 @@ TEMP=/var/cache/packages # Package lists, file lists, and others will be stored in WORKDIR: WORKDIR=/var/lib/slackpkg -# Use curl or wget for Downloading (wget is default) -#DOWNLOADER=curl - +# Use curl or wget for downloading (wget is default) DOWNLOADER=wget # Special options for curl From 201eed9a8011b07c1d9a6ad42b93faf60cc207e8 Mon Sep 17 00:00:00 2001 From: piterpunk Date: Tue, 18 Apr 2023 19:20:14 -0300 Subject: [PATCH 3/3] Allows automatic cleanup of updated packages data When a package is upgraded, its old installation scripts and list of files are kept under /var/lib/pkgtools. This commit implements the function to remove those lists and scripts, the variable to govern its behaviour and the documentation about it. --- .gitignore | 1 + files/post-functions.sh | 48 +++++++++++++++++++++++++++++++++++++++++ files/slackpkg | 1 + files/slackpkg.conf.5 | 7 ++++++ files/slackpkg.conf.new | 5 +++++ 5 files changed, 62 insertions(+) diff --git a/.gitignore b/.gitignore index 1944fd6..ae12459 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ *.tmp +*~ diff --git a/files/post-functions.sh b/files/post-functions.sh index 0339e00..177a337 100644 --- a/files/post-functions.sh +++ b/files/post-functions.sh @@ -351,3 +351,51 @@ boot the appropriate kernel (after generating an initrd if required)." fi fi } + +lookoldpkgfiles() { + local PKGHISTORYLST PKGFILE CLEANLIST + + if [ -n "${KEEP_N_LAST_PKG_METADATA}" ] && [ ${KEEP_N_LAST_PKG_METADATA} -gt 0 ]; then + echo -ne "Keep only the last ${KEEP_N_LAST_PKG_METADATA} package metadata versions... " + PKGHISTORYLIST=${TMPDIR}/pkghistory.lst + if [ -d /var/lib/pkgtools/removed_packages/ ]; then + PKGTOOLSDIR=/var/lib/pkgtools + else + PKGTOOLSDIR=/var/log + fi + # This could be simpler if we used the file timestamp to sort + # the list. But the timestamp at filename is safer to warranty + # the correct ordering. + ls -1 ${PKGTOOLSDIR}/removed_packages | awk ' + /-upgraded-/ { + INPUT=$NF + fs=FS + FS="/" ; OFS="/" + $0=INPUT + FULLPACK=$NF + FS="-" ; OFS="-" + $0=FULLPACK + if ( NF > 3 ) { + DAYHOUR=$NF + MONTH=$(NF-1) + YEAR=$(NF-2) + NF=NF-7 + NAME=$0 + } + FS=fs + print YEAR"-"MONTH"-"DAYHOUR" "NAME" "FULLPACK + }' | sort -rn | awk ' + { + COUNT[$2]+=1 + if ( COUNT[$2] > '${KEEP_N_LAST_PKG_METADATA}' ) { + print $NF + } + }' > ${PKGHISTORYLIST} + for PKGFILE in $(cat ${PKGHISTORYLIST}); do + # Not all packages have scripts in the removed_scripts + # directory. + rm ${PKGTOOLSDIR}/removed_{packages,scripts}/$PKGFILE 2>/dev/null + done + echo "OK" + fi +} diff --git a/files/slackpkg b/files/slackpkg index cc95bb0..7c9ba49 100644 --- a/files/slackpkg +++ b/files/slackpkg @@ -607,6 +607,7 @@ for i in check-updates remove search file-search update info blacklist \ done if [ "$POSTINST" != "off" ]; then + lookoldpkgfiles lookkernel looknew fi diff --git a/files/slackpkg.conf.5 b/files/slackpkg.conf.5 index e47da8b..f67816e 100644 --- a/files/slackpkg.conf.5 +++ b/files/slackpkg.conf.5 @@ -360,6 +360,13 @@ is "on". .br From command line, you can use -spinning=value. +.TP 5 +.B KEEP_N_LAST_PKG_METADATA +.br +When a package is upgraded, its old installation scripts and list of files +are kept under /var/lib/pkgtools. This variable sets how many of these +previous lists and scripts should be kept. + .SH FILES .TP 5 .B /etc/slackpkg/slacpkg.conf diff --git a/files/slackpkg.conf.new b/files/slackpkg.conf.new index 96a4173..17225d5 100644 --- a/files/slackpkg.conf.new +++ b/files/slackpkg.conf.new @@ -156,6 +156,11 @@ SPINNING=on # Slackware 10.2) DIALOG_MAXARGS=139000 +# When a package is upgraded, its old installation scripts and list of files +# are kept under /var/lib/pkgtools. This variable sets how many of these +# previous lists and scripts should be kept. +#KEEP_N_LAST_PKG_METADATA=3 + # # The MIRROR is set from /etc/slackpkg/mirrors # You only need to uncomment the selected mirror.