Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


  Search this Thread
Old 09-12-2012, 12:46 PM   #1
LQ Newbie
Registered: Dec 2007
Posts: 24

Rep: Reputation: 1
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.

Old 09-12-2012, 01:35 PM   #2
Registered: Jan 2008
Posts: 156

Rep: Reputation: 64
setup assumes that destination is /mnt. Try to 'mount --bind' right directory to and go the usual way...
Old 09-12-2012, 03:28 PM   #3
LQ Newbie
Registered: Dec 2007
Posts: 24

Original Poster
Rep: Reputation: 1
Originally Posted by bormant View Post
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.

Old 09-12-2012, 04:24 PM   #4
Didier Spaier
LQ Addict
Registered: Nov 2008
Location: Paris, France
Distribution: Slackware{,64}-{14.1,current} on a Lenovo Thinkpad W520
Posts: 5,908

Rep: Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682
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?
Attached Files
File Type: txt probe.txt (10.9 KB, 9 views)

Last edited by Didier Spaier; 09-12-2012 at 04:56 PM. Reason: Last sentence edited (np for /proc and /sys)
Old 09-13-2012, 12:50 AM   #5
LQ Newbie
Registered: Dec 2007
Posts: 24

Original Poster
Rep: Reputation: 1
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!"


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Slackware guest on Linux-Vserver: patch & install script roberto967 Linux - Virtualization and Cloud 3 05-23-2013 12:29 AM
[SOLVED] The slackware package description in the install directory it isnt read by pkgtool Gerwar Linux - Software 2 05-29-2011 01:16 PM
Bash script to strip a certain directory out of directories in a directory? rylan76 Linux - General 3 08-29-2006 12:35 PM
shell script: delete all directories named directory.# except directory.N brian0918 Programming 3 07-13-2005 07:54 PM
No init.d directory in Slackware 9.1 install bugsbunny Linux - Newbie 4 04-05-2004 06:31 PM

All times are GMT -5. The time now is 08:48 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration