Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions get_paths.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ _usage() {
}

_release_base() {
echo "${1}" | cut -d - -f 1
echo "${1}" | cut -d - -f 1 | sed 's/armedslack/slackware/;s/slackwarearm/slackware/;s/slackwareaarch64/slackware/'
}

_fetch_file_list() {
Expand Down Expand Up @@ -84,21 +84,30 @@ main() {
esac
done
shift $((OPTIND-1))

tmp_dir="$(mktemp -d)"
tmp_file_list="${tmp_dir}/FILE_LIST"
if [ -n "${fetch_patches}" ] ; then
_fetch_file_list "${mirror}" "${release}" "patches" >> "${tmp_file_list}"
ret=$?
if [ $ret -ne 0 ] ; then
echo "ERROR fetching FILE_LIST" >&2
exit $ret
fi
elif [ -n "${fetch_extra}" ] ; then
_fetch_file_list "${mirror}" "${release}" "extra" >> "${tmp_file_list}"
ret=$?
if [ $ret -ne 0 ] ; then
echo "ERROR fetching FILE_LIST" >&2
exit $ret
fi
else
_fetch_file_list "${mirror}" "${release}" "$(_release_base "${release}")" > "${tmp_file_list}"
fi

ret=$?
if [ $ret -ne 0 ] ; then
echo "ERROR fetching FILE_LIST" >&2
exit $ret
ret=$?
if [ $ret -ne 0 ] ; then
echo "ERROR fetching FILE_LIST" >&2
exit $ret
fi
fi

if [ -n "${fetch_tagfiles}" ] ; then
Expand All @@ -112,7 +121,7 @@ main() {
done
fi

grep '\.t.z$' "${tmp_file_list}" | awk '{ print $8 }' | sed -e 's|\./\(.*\.t.z\)$|\1|g'
grep '\.t.z$' "${tmp_file_list}" | awk '{ print $(NF) }' | sed -e 's|\./\(.*\.t.z\)$|\1|g'
}

_is_sourced || main "${@}"
Expand Down
107 changes: 82 additions & 25 deletions mkimage-slackware.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH="" ;;
arm*) ARCH=arm ;;
aarch64) ARCH=aarch64 ;;
*) ARCH=64 ;;
esac
fi
Expand All @@ -15,9 +16,16 @@ BUILD_NAME=${BUILD_NAME:-"slackware"}
VERSION=${VERSION:="current"}
RELEASENAME=${RELEASENAME:-"slackware${ARCH}"}
RELEASE=${RELEASE:-"${RELEASENAME}-${VERSION}"}
MIRROR=${MIRROR:-"http://slackware.osuosl.org"}
if [ -z "$MIRROR" ]; then
if [ "$ARCH" = "arm" ] || [ "$ARCH" = "aarch64" ] ; then
MIRROR=${MIRROR:-"http://slackware.uk/slackwarearm"}
else
MIRROR=${MIRROR:-"http://slackware.osuosl.org"}
fi
fi
CACHEFS=${CACHEFS:-"/tmp/${BUILD_NAME}/${RELEASE}"}
ROOTFS=${ROOTFS:-"/tmp/rootfs-${RELEASE}"}
MINIMAL=${MINIMAL:-yes}
CWD=$(pwd)

base_pkgs="a/aaa_base \
Expand All @@ -30,6 +38,7 @@ base_pkgs="a/aaa_base \
a/pam \
a/cracklib \
a/libpwquality \
a/lzlib \
a/e2fsprogs \
a/nvi \
a/pkgtools \
Expand Down Expand Up @@ -78,6 +87,11 @@ base_pkgs="a/aaa_base \
n/iproute2 \
n/openssl"

if [ "$VERSION" = "15.0" ] && [ "$ARCH" = "arm" ] ; then
base_pkgs="installer_fix \
$base_pkgs"
fi

function cacheit() {
file=$1
if [ ! -f "${CACHEFS}/${file}" ] ; then
Expand All @@ -90,16 +104,35 @@ function cacheit() {

mkdir -p $ROOTFS $CACHEFS

cacheit "isolinux/initrd.img"
if [ -z "$INITRD" ]; then
if [ "$ARCH" = "arm" ] ; then
case "$VERSION" in
12*|13*|14.0|14.1) INITRD=initrd-versatile.img ;;
*) INITRD=initrd-armv7.img ;;
esac
elif [ "$ARCH" = "aarch64" ] ; then
INITRD=initrd-armv8.img
else
INITRD=initrd.img
fi
fi

if [ "$ARCH" = "aarch64" ] ; then
cacheit "installer/$INITRD"
mv ${CACHEFS}/installer ${CACHEFS}/isolinux
cacheit "installer/$INITRD"
else
cacheit "isolinux/$INITRD"
fi

cd $ROOTFS
# extract the initrd to the current rootfs
## ./slackware64-14.2/isolinux/initrd.img: gzip compressed data, last modified: Fri Jun 24 21:14:48 2016, max compression, from Unix, original size 68600832
## ./slackware64-current/isolinux/initrd.img: XZ compressed data
if $(file ${CACHEFS}/isolinux/initrd.img | grep -wq XZ) ; then
xzcat "${CACHEFS}/isolinux/initrd.img" | cpio -idvm --null --no-absolute-filenames
if file ${CACHEFS}/isolinux/$INITRD | grep -wq XZ ; then
xzcat "${CACHEFS}/isolinux/$INITRD" | cpio -idvm --null --no-absolute-filenames
else
zcat "${CACHEFS}/isolinux/initrd.img" | cpio -idvm --null --no-absolute-filenames
zcat "${CACHEFS}/isolinux/$INITRD" | cpio -idvm --null --no-absolute-filenames
fi

if stat -c %F $ROOTFS/cdrom | grep -q "symbolic link" ; then
Expand Down Expand Up @@ -131,15 +164,20 @@ fi

# an update in upgradepkg during the 14.2 -> 15.0 cycle changed/broke this
root_env=""
root_flag="--root /mnt"
root_flag=""
if [ -f ./sbin/upgradepkg ] && grep -qw -- '"--root"' ./sbin/upgradepkg ; then
root_flag="--root /mnt"
elif [ -f ./usr/lib/setup/installpkg ] && grep -qw -- '"-root"' ./usr/lib/setup/installpkg ; then
root_flag="-root /mnt"
fi
if [ "$VERSION" = "current" ] || [ "${VERSION}" = "15.0" ]; then
root_env='ROOT=/mnt'
root_flag=''
fi

relbase=$(echo ${RELEASE} | cut -d- -f1)
relbase=$(echo ${RELEASE} | cut -d- -f1 | sed 's/armedslack/slackware/;s/slackwarearm/slackware/;s/slackwareaarch64/slackware/')
if [ ! -f ${CACHEFS}/paths ] ; then
bash ${CWD}/get_paths.sh -r ${RELEASE} > ${CACHEFS}/paths
bash ${CWD}/get_paths.sh -r ${RELEASE} -m ${MIRROR} > ${CACHEFS}/paths
fi
if [ ! -f ${CACHEFS}/paths-patches ] ; then
bash ${CWD}/get_paths.sh -r ${RELEASE} -m ${MIRROR} -p > ${CACHEFS}/paths-patches
Expand All @@ -149,6 +187,12 @@ if [ ! -f ${CACHEFS}/paths-extra ] ; then
fi
for pkg in ${base_pkgs}
do
installer_fix=false
if [ "$pkg" = "installer_fix" ] ; then
# see slackwarearm-15.0 ChangeLog entry from Thu Sep 15 08:08:08 UTC 2022
installer_fix=true
pkg=a/aaa_glibc-solibs
fi
path=$(grep "^packages/$(basename "${pkg}")-" ${CACHEFS}/paths-patches | cut -d : -f 1)
if [ ${#path} -eq 0 ] ; then
path=$(grep ^${pkg}- ${CACHEFS}/paths | cut -d : -f 1)
Expand All @@ -166,7 +210,17 @@ do
else
l_pkg=$(cacheit patches/$path)
fi
if [ -e ./sbin/upgradepkg ] ; then
if $installer_fix ; then
echo PATH=/bin:/sbin:/usr/bin:/usr/sbin \
chroot . /bin/tar-1.13 -xvf ${l_pkg} lib/incoming/libc-2.33.so
PATH=/bin:/sbin:/usr/bin:/usr/sbin \
chroot . /bin/tar -xvf ${l_pkg} lib/incoming/libc-2.33.so
mv lib/incoming/libc-2.33.so lib && rm -rf lib/incoming
echo PATH=/bin:/sbin:/usr/bin:/usr/sbin \
chroot . /bin/test -x /bin/sh
PATH=/bin:/sbin:/usr/bin:/usr/sbin \
chroot . /bin/test -x /bin/sh # confirm bug is fixed
elif [ -e ./sbin/upgradepkg ] ; then
echo PATH=/bin:/sbin:/usr/bin:/usr/sbin \
ROOT=/mnt \
chroot . /sbin/upgradepkg ${root_flag} ${install_args} ${l_pkg}
Expand Down Expand Up @@ -200,18 +254,21 @@ if [ ! -e ./root/.gnupg ] ; then
fi

set -x
echo "export TERM=linux" >> etc/profile.d/term.sh
chmod +x etc/profile.d/term.sh
echo ". /etc/profile" > .bashrc
echo "${MIRROR}/${RELEASE}/" >> etc/slackpkg/mirrors
sed -i 's/DIALOG=on/DIALOG=off/' etc/slackpkg/slackpkg.conf
sed -i 's/POSTINST=on/POSTINST=off/' etc/slackpkg/slackpkg.conf
sed -i 's/SPINNING=on/SPINNING=off/' etc/slackpkg/slackpkg.conf
if [ "$VERSION" = "current" ] ; then
mkdir -p var/lib/slackpkg
touch var/lib/slackpkg/current
if [ "$MINIMAL" = "yes" ] || [ "$MINIMAL" = "1" ] ; then
echo "export TERM=linux" >> etc/profile.d/term.sh
chmod +x etc/profile.d/term.sh
echo ". /etc/profile" > .bashrc
fi
if [ -e etc/slackpkg/mirrors ] ; then
echo "${MIRROR}/${RELEASE}/" >> etc/slackpkg/mirrors
sed -i 's/DIALOG=on/DIALOG=off/' etc/slackpkg/slackpkg.conf
sed -i 's/POSTINST=on/POSTINST=off/' etc/slackpkg/slackpkg.conf
sed -i 's/SPINNING=on/SPINNING=off/' etc/slackpkg/slackpkg.conf
if [ "$VERSION" = "current" ] ; then
mkdir -p var/lib/slackpkg
touch var/lib/slackpkg/current
fi
fi

if [ ! -f etc/rc.d/rc.local ] ; then
mkdir -p etc/rc.d
cat >> etc/rc.d/rc.local <<EOF
Expand All @@ -225,9 +282,11 @@ fi

# now some cleanup of the minimal image
set +x
rm -rf usr/share/locale/*
rm -rf usr/man/*
find usr/share/terminfo/ -type f ! -name 'linux' -a ! -name 'xterm' -a ! -name 'screen.linux' -exec rm -f "{}" \;
if [ "$MINIMAL" = "yes" ] || [ "$MINIMAL" = "1" ] ; then
rm -rf usr/share/locale/*
rm -rf usr/man/*
find usr/share/terminfo/ -type f ! -name 'linux' -a ! -name 'xterm' -a ! -name 'screen.linux' -exec rm -f "{}" \;
fi
umount $ROOTFS/dev
rm -f dev/* # containers should expect the kernel API (`mount -t devtmpfs none /dev`)

Expand All @@ -239,5 +298,3 @@ for dir in cdrom dev sys proc ; do
umount $ROOTFS/$dir
fi
done