diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2020-10-23 16:20:43 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2020-10-23 16:25:19 +0300 |
commit | b403a6b56114acfb80c0beb836eef77bd6a6cffa (patch) | |
tree | de3d8f82bd62df8953d0701f2ff3679339e2abe4 | |
download | slackimage-b403a6b56114acfb80c0beb836eef77bd6a6cffa.tar.gz slackimage-b403a6b56114acfb80c0beb836eef77bd6a6cffa.tar.bz2 |
Initial commit
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | Dockerfile | 17 | ||||
-rw-r--r-- | docker-compose.yml | 14 | ||||
-rw-r--r-- | scripts/dump.sh | 26 | ||||
-rw-r--r-- | scripts/install.sh | 20 | ||||
-rw-r--r-- | scripts/slackpkg-init.sh | 37 |
6 files changed, 118 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c5831d3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.emacs* +.env +tmp/ +*~ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..791be29 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +ARG VERSION +FROM vbatts/slackware:${VERSION} + +RUN wget --no-check-certificate -O /etc/ssl/certs/DST_Root_CA_X3.pem https://letsencrypt.org/certs/trustid-x3-root.pem.txt &&\ + cd /etc/ssl/certs &&\ + ln -sf DST_Root_CA_X3.pem `openssl x509 -noout -hash -in DST_Root_CA_X3.pem`.0 + +ADD scripts/ /var/lib/slackimg +RUN sh /var/lib/slackimg/slackpkg-init.sh +ARG SERIES="a ap d e f k l n t tcl" +RUN sh /var/lib/slackimg/install.sh ${SERIES} +ARG IMAGENAME +VOLUME ["/mnt"] +ENTRYPOINT ["/bin/sh", "/var/lib/slackimg/dump.sh" ] + + + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..851f7fa --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +version: '3.4' + +services: + slackware: + command: ${IMAGE} + build: + context: . + args: + VERSION: ${VERSION} + dockerfile: Dockerfile + image: slackimg:${VERSION} + volumes: + - ${OUTPUT}:/mnt + diff --git a/scripts/dump.sh b/scripts/dump.sh new file mode 100644 index 0000000..a40328c --- /dev/null +++ b/scripts/dump.sh @@ -0,0 +1,26 @@ +#!/bin/sh +IMAGENAME=$1 + +if [ -z "$IMAGENAME" ]; then + IMAGENAME=$(sed -r -e 's/[[:space:]]+/-/g' /etc/slackware-version).tar.gz +fi + +cd / +/usr/bin/tar \ + --one-file-system\ + --anchored\ + --exclude-caches\ + --warning=no-xdev\ + --warning=no-cachedir\ + -c\ + -z\ + -v\ + --exclude 'README' \ + --exclude var/lib/slackimg\ + --exclude 'mnt/*' \ + --exclude 'proc/*' \ + --exclude 'sys/*' \ + --exclude 'var/log/removed_packages/*' \ + --exclude 'var/log/removed_scripts/*' \ + -f /mnt/$IMAGENAME * + diff --git a/scripts/install.sh b/scripts/install.sh new file mode 100644 index 0000000..970f07c --- /dev/null +++ b/scripts/install.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +PKGLIST=/var/lib/slackpkg/pkglist + +exclude_packages() { + grep -v '^slackpkg-' +} + +install_series() { + echo "Installing series $1" + pkglist=$(sed -n -r -e 's/^slackware64 (([^ ]+) ){4}([^ ]+) .\/slackware64\/('"$1"') ([^ ]+)[[:space:]]*$/\3/p' $PKGLIST | exclude_packages) + if [ -n "$pkglist" ]; then + echo $pkglist | xargs slackpkg install + fi +} + +for s in $* +do + install_series $s +done diff --git a/scripts/slackpkg-init.sh b/scripts/slackpkg-init.sh new file mode 100644 index 0000000..5136833 --- /dev/null +++ b/scripts/slackpkg-init.sh @@ -0,0 +1,37 @@ +# ######################### +# slackpkg setup + +SLACKPKG_CONF=/etc/slackpkg/slackpkg.conf +MIRRORS=/etc/slackpkg/mirrors +PKGLIST=/var/lib/slackpkg/pkglist + +# ######################### +# Configure slackpkg +cat >> $SLACKPKG_CONF <<EOF +WGETFLAGS="--passive-ftp -nv" +DELALL=on +CHECKMD5=on +CHECKGPG=on +CHECKSIZE=off +PRIORITY=( patches %PKGMAIN extra pasture testing ) +POSTINST=off +DIALOG=off +DOWNLOAD_ALL=on +SPINNING=off +EOF + +cat > $MIRRORS <<EOF +https://pirx.gnu.org.ua/slackware/slackware64-14.2/ +EOF + +# ######################### +# Initialize slackpkg +slackpkg update + +# ######################### +# Reinstall existing packages +# Rationale: the ones installed by the image can be trimmed down +# to save space. Apparently that's the case with vbatts/slackware images. +find /var/log/packages -maxdepth 1 -type f -printf '%f\n' |\ + grep -v ^slackpkg |\ + while read name ; do slackpkg reinstall $name; done |