Skip to content

Instantly share code, notes, and snippets.

@jaos jaos/dockerimgbuild.sh
Last active Feb 10, 2020

Embed
What would you like to do?
slack minimal root filesystem tarballs for docker import
#!/bin/bash -ex
ROOT=/tmp/rfs
OUT=/tmp
function dobuild() {
set -ex
slackrel=${1:-slackware-15.0}
imgtype=${2:-minimal}
rm -rf $ROOT
mkdir -p ${ROOT}/etc/slapt-get
mkdir -p ${ROOT}/var/lib/pkgtools/packages
echo "WORKINGDIR=${ROOT}/var/cache/slapt-get" >> ${ROOT}/etc/slapt-get/slapt-getrc
case "$slackrel" in
slackware64-15.0)
echo "SOURCE=https://storage.googleapis.com/slackpacks.jaos.org/slackware64-15.0/:OFFICIAL" >> ${ROOT}/etc/slapt-get/slapt-getrc
echo "SOURCE=http://slackware.uk/slackware/slackware64-current/:OFFICIAL" >> ${ROOT}/etc/slapt-get/slapt-getrc
;;
slackware-15.0)
echo "SOURCE=https://storage.googleapis.com/slackpacks.jaos.org/slackware-15.0/:OFFICIAL" >> ${ROOT}/etc/slapt-get/slapt-getrc
echo "SOURCE=http://slackware.uk/slackware/slackware-current/:OFFICIAL" >> ${ROOT}/etc/slapt-get/slapt-getrc
;;
slackwarearm-15.0)
echo "SOURCE=https://storage.googleapis.com/slackpacks.jaos.org/slackwarearm-15.0/:OFFICIAL" >> ${ROOT}/etc/slapt-get/slapt-getrc
echo "SOURCE=http://slackware.uk/slackwarearm/slackwarearm-current/:OFFICIAL" >> ${ROOT}/etc/slapt-get/slapt-getrc
;;
slarm64-15.0)
echo "#SOURCE=http://dl.fail.pp.ua/slackware/slarm64-current/:OFFICIAL" >> ${ROOT}/etc/slapt-get/slapt-getrc
echo "SOURCE=http://mirrors.slackware.bg/slarm64/slarm64-current/:OFFICIAL" >> ${ROOT}/etc/slapt-get/slapt-getrc
echo "SOURCE=https://storage.googleapis.com/slackpacks.jaos.org/slarm64-15.0/:OFFICIAL" >> ${ROOT}/etc/slapt-get/slapt-getrc
;;
esac
ROOT=${ROOT} slapt-get -c ${ROOT}/etc/slapt-get/slapt-getrc --update
case "$imgtype" in
"minimal")
ROOT=${ROOT} slapt-get -c ${ROOT}/etc/slapt-get/slapt-getrc --install aaa_base aaa_elflibs aaa_terminfo bash grep coreutils elvis etc bin file procps-ng findutils glibc-solibs gzip less openssl-solibs patch pkgtools sed tar util-linux xz which pcre pcre2 gnupg slapt-get curl dialog gawk file time libpsl nghttp2 libunistring libgcrypt gettext utempter libcgroup diffutils tree hostname sqlite icu4c
ROOT=${ROOT} slapt-get -c ${ROOT}/etc/slapt-get/slapt-getrc --remove binutils --no-dep -y
;;
"small")
ROOT=${ROOT} slapt-get -c ${ROOT}/etc/slapt-get/slapt-getrc --install aaa_base aaa_elflibs aaa_terminfo bash grep bzip2 coreutils cpio devs vim etc bin file procps-ng findutils glibc-solibs gzip lbzip2 less lzlib openssl-solibs patch pkgtools sed tar util-linux xz which pcre pcre2 wget gnupg ncurses slapt-get readline curl dialog gawk file time libpsl nghttp2 libunistring libgcrypt mpfr gettext utempter libcgroup diffutils net-tools iproute2 tree hostname iputils ntp openssh sqlite icu4c
;;
"dev")
ROOT=${ROOT} slapt-get -c ${ROOT}/etc/slapt-get/slapt-getrc --install aaa_base aaa_elflibs aaa_terminfo bash grep bzip2 coreutils cpio devs vim etc bin file procps-ng findutils glibc-solibs gzip lbzip2 less lzlib openssl-solibs patch pkgtools sed tar util-linux xz which pcre pcre2 wget gnupg ncurses slapt-get readline curl dialog gawk file time libpsl nghttp2 libunistring libgcrypt mpfr utempter libcgroup diffutils net-tools iproute2 tree hostname iputils ntp openssh sqlite icu4c gcc gcc-g++ gc guile make autoconf git glibc kernel-headers autoconf automake libtool m4 gettext gettext-tools pkg-config intltool atk glib2 gtk+2 pango zlib openssl curl slapt-get mesa libdrm libXxf86vm libunistring readline expat libxshmfence fribidi graphite2 libpthread-stubs xorgproto shared-mime-info gslapt slapt-src graphite2 fribidi shared-mime-info libmpc flex bison libcroco libxml2 perl python libglvnd font-misc-misc binutils texinfo adwaita-icon-theme hicolor-icon-theme libXtst at-spi2-atk at-spi2-core dbus gtk+3 libepoxy
pushd $ROOT/root && for r in slapt-get slapt-src gslapt cpan2tgz;do git clone https://software.jaos.org/git/$r;done; popd
update-mime-database /usr/share/mime
;;
esac
if [ -d $ROOT/lib64 ]; then
if [ ! -e $ROOT/lib64/libdl.so.2 ]; then pushd $ROOT/lib64; ln -s libdl-*.so libdl.so.2 ;popd;fi
if [ ! -e $ROOT/lib64/libc.so.6 ]; then pushd $ROOT/lib64; ln -s libc-*.so libc.so.6; popd;fi
else
if [ ! -e $ROOT/lib/libdl.so.2 ]; then pushd $ROOT/lib; ln -s libdl-*.so libdl.so.2 ;popd;fi
if [ ! -e $ROOT/lib/libc.so.6 ]; then pushd $ROOT/lib; ln -s libc-*.so libc.so.6; popd;fi
fi
chroot $ROOT ldconfig
sed -i -re "s|$ROOT||" ${ROOT}/etc/slapt-get/slapt-getrc
rm -rf ${ROOT}/var/cache/slapt-get
pushd ${ROOT}/root && ln -s ../etc/profile .bashrc; popd
echo "update-mime-database /usr/share/mime" >> ${ROOT}/etc/profile.d/fix-images.sh
echo "gdk-pixbuf-query-loaders-64 > /usr/lib64/gdk-pixbuf-2.0/2.10.0/loaders.cache" >> ${ROOT}/etc/profile.d/fix-images.sh
pushd ${ROOT} && tar cf $OUT/${slackrel}-${imgtype}.tar *
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.