-   Slackware (
-   -   Script to install slackware to a directory. (

akschu 09-12-2012 11:46 AM

Script to install slackware to a directory.
I thought I would ask before I write one. But is there a script in the initrd that will install slackware to a directory? I have a situation where I want to install to a mounted directory instead of a partition. This is useful for building up a slackware machine for a virtual environment or iscsi.

Basically I want to point it to a install dir and a tagfiles dir and have it install all of the packages. I'll deal with config after.


bormant 09-12-2012 12:35 PM

setup assumes that destination is /mnt. Try to 'mount --bind' right directory to and go the usual way...

akschu 09-12-2012 02:28 PM


Originally Posted by bormant (Post 4778701)
setup assumes that destination is /mnt. Try to 'mount --bind' right directory to and go the usual way...

I mounted the new filesystem to /mnt but the installer complains that it doesn't have a target.


Didier Spaier 09-12-2012 03:24 PM

1 Attachment(s)
Well, to list the available Linux partitions to serve as targets the 'setup' script runs the 'probe' script:

if probe -l 2> /dev/null | egrep 'Linux$' 1> /dev/null 2> /dev/null ; then
 probe -l 2> /dev/null | egrep 'Linux$' | sort 1> $TMP/SeTplist 2> /dev/null
 --msgbox "There don't seem to be any partitions on this machine of type \
Linux.  You'll need to make at least one of these to install Linux.  \
To do this, you'll need to leave 'setup', and make the partitions using \
'cfdisk' or 'fdisk'.  For more information, read the 'setup' help \
file from the next menu." 10 60

The 'probe' script is "a wrapper for using fdisk to gather drive info for the Slackware setup scripts."
So I suppose that to do what you want you would need to modify the installer itself. Good luck.

But maybe I am wrong and somebody will propose you an easier way ?

I append /sbin/probe found in the installer for Slackware-almost14 though that be probably useless.

PS maybe it's possible to set up an initrd including the whole tree of a complete Slackware installation, then cp it in a directory. But that would need a lot of RAM and it's probably simpler to use rsync to mirror an existing Slackware installation into your target directory then. But what about /dev in that case?

akschu 09-12-2012 11:50 PM

So after hacking around in the setup script for a while, it was just easier to write my own. This is really useful if you want to install slackware to an iscsi target that you mount in initrd, or in my case, setup slackware 14.0 on linode using the emergency boot option. I made a file system on /dev/xvdb, mounted it in the boot disk, rsync'd the slackware install files, then called my script. Once everything was installed, I simply used a linode kernel and kicked the machine.

Here is the script:


# this is a dumb slackware installer.


# Process command line:
if [ $# -gt 0 ]; then # there are arguments to the command
  while [ $# -gt 0 ]; do
  case "$1" in
    TAGDIR=`echo $2` ; shift 2 ;;
    PKGDIR=`echo $2` ; shift 2 ;;
    DSTDIR=`echo $2` ; shift 2 ;;
    echo "Unrecognized option $1" ; shift 1 ;;
  echo "Usage: ./ --tagdir <tagdir> --pkgdir <pkgdir> --dstdir <dstdir>"
  exit 1;

# make sure we have everything
if [[ -z "$DSTDIR" || -z "$TAGDIR" || -z "$PKGDIR" ]]; then
    echo "Usage: ./ --tagdir <tagdir> --pkgdir <pkgdir> --dstdir <dstdir>"
    exit 1;

echo "Are you sure you want to install slackware from $PKGDIR to $DSTDIR using tags $TAGDIR ?"
echo "If you don't define directories correctly this will make a huge mess"
echo "y/n"
read yn

if [ $yn != "y" ]; then
  echo "Aborting.."
  exit 0;

for FOO in $TAGDIR* ; do
  SERIES=`basename $FOO`
  for PACKAGE in ${PKGDIR}${SERIES}/*.t?z ; do
    installpkg -root $DSTDIR -menu -tagfile ${TAGDIR}${SERIES}/tagfile $PACKAGE

echo "Done installing packages. Now You need to do the following things:"
echo "1.  Set a root password"
echo "2.  Run the setup tools: $DSTDIR/var/log/setup/<setup.script> <rootdev> <root>
echo "3.  Setup an /etc/fstab"
echo "I'm not going to do these things for you because you probably don't"
echo "want a boot disk or lilo if you are using this tool."
echo "And as always, have nice day!"

All times are GMT -5. The time now is 12:32 PM.