LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-12-2012, 11:46 AM   #1
akschu
Member
 
Registered: Dec 2007
Posts: 96

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

schu
 
Old 09-12-2012, 12:35 PM   #2
bormant
Member
 
Registered: Jan 2008
Posts: 426

Rep: Reputation: 240Reputation: 240Reputation: 240
setup assumes that destination is /mnt. Try to 'mount --bind' right directory to and go the usual way...
 
Old 09-12-2012, 02:28 PM   #3
akschu
Member
 
Registered: Dec 2007
Posts: 96

Original Poster
Rep: Reputation: 39
Quote:
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.

schu
 
Old 09-12-2012, 03:24 PM   #4
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,057

Rep: Reputation: Disabled
Well, to list the available Linux partitions to serve as targets the 'setup' script runs the 'probe' script:
Code:
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
else
 dialog --title "NO LINUX PARTITIONS DETECTED" \
 --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
fi
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, 14 views)

Last edited by Didier Spaier; 09-12-2012 at 03:56 PM. Reason: Last sentence edited (np for /proc and /sys)
 
Old 09-12-2012, 11:50 PM   #5
akschu
Member
 
Registered: Dec 2007
Posts: 96

Original Poster
Rep: Reputation: 39
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:
Code:
#!/bin/sh

# this is a dumb slackware installer.

PATH=$PATH:/usr/lib/setup

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

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

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;
fi

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
                       
  done
  
done

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!"
 
  


Reply



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-22-2013 11:29 PM
[SOLVED] The slackware package description in the install directory it isnt read by pkgtool Gerwar Linux - Software 2 05-29-2011 12:16 PM
Bash script to strip a certain directory out of directories in a directory? rylan76 Linux - General 3 08-29-2006 11:35 AM
shell script: delete all directories named directory.# except directory.N brian0918 Programming 3 07-13-2005 06:54 PM
No init.d directory in Slackware 9.1 install bugsbunny Linux - Newbie 4 04-05-2004 05:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:06 AM.

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