LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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
LQ Newbie
 
Registered: Dec 2007
Posts: 16

Rep: Reputation: 0
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: 90

Rep: Reputation: 38
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
LQ Newbie
 
Registered: Dec 2007
Posts: 16

Original Poster
Rep: Reputation: 0
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
Senior Member
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slackware{,64}-{14.1,current} on a Lenovo Thinkpad T61 6457-4XG
Posts: 4,043

Rep: Reputation: 977Reputation: 977Reputation: 977Reputation: 977Reputation: 977Reputation: 977Reputation: 977Reputation: 977
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, 8 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
LQ Newbie
 
Registered: Dec 2007
Posts: 16

Original Poster
Rep: Reputation: 0
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


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


All times are GMT -5. The time now is 05:26 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration