You are not logged in.

#1 2006-03-07 21:06:30

raskolnikov
Member
From: France
Registered: 2006-01-08
Posts: 100

custinst - quickinst enhanced

Well, that script is a derivate of quickinst with some features I find useful :

:arrow: blacklist some packages in the base category (who need devfs with a 2.6 kernel and udev ?)

:arrow: install some packages not found in the base category (lynx and irssi, but you can put any package here - just as next point say)

:arrow: use not only current but also extra and community repos during setup

:arrow: get a log of pacman messages (can be used with -Syu, maybe for another script  wink )

It can be used to clone an existing Arch install (but not its config files, maybe for the next version ?), too.

And now, the code smile

#!/bin/sh

# Written by raskolnikov (Gabriel Linder) - 20060307

# This script is an alternative to (and based on) the quickinst script.
# It allows you to select packages you want to install, not more not less.

# Please note that in order to run, this script require /tmp mounted with exec.

# Put here the URI to your favorite Arch mirror
# (the directory where current, extra and community are)
PKGROOT="ftp://acer/ftp.archlinux.org"

# Packages you do not want (from the "base" category)
PKGSKIP="devfsd grub nano ppp rp-pppoe"

# Additional packages you want (you can use current, extra and community)
PKGSUPP="elinks irssi"

# Where to install (of course you have to format and mount by yourself)
DESTDIR="/mnt"

# Actually not an obligation, but pacman won't let you install anyway
if [ $EUID -gt 0 ]; then
    echo "You have to be root to run this script"
    exit 1
fi

# Our dirty work will reside here
cd /tmp

# Fetch pacman
wget $PKGROOT/current/os/i686/setup/pacman.pkg.tar.gz
if [ $? -gt 0 ]; then
    echo "error fetching pacman"
    exit 1
fi

# Fetch package list
wget $PKGROOT/current/os/i686/setup/packages.txt
if [ $? -gt 0 ]; then
    echo "error fetching package list"
    exit 1
fi

# Unpack pacman
tar -xzf pacman.pkg.tar.gz
if [ $? -gt 0 ]; then
    echo "error unpacking pacman"
    exit 1
fi

# Minimal config file for pacman
echo -e "[current]nServer = $PKGROOT/current/os/i686" > pacman.conf
echo -e "[extra]nServer = $PKGROOT/extra/os/i686" >> pacman.conf
echo -e "[community]nServer = $PKGROOT/community/os/i686" >> pacman.conf

# Clean "base" packages of unwanted ones
packages=""
skipdone=0
for pkg in `cat "packages.txt" | grep "^base/" | cut -d "/" -f "2"`; do
    skipme=0
    current=${pkg%-*-*}
    for skip in $PKGSKIP; do
        if [ $current = $skip ]; then
            if [ $skipdone -eq 0 ]; then
                echo -n "Skipping :"
                skipdone=1
            fi
            echo -n " $current"
            skipme=1
            break
        fi
    done
    if [ $skipme -eq 0 ]; then
        packages="$packages $current"
    fi
done

# Add the other requested packages
packages="$packages $PKGSUPP"

# Notify the user
echo -e "nnInstalling :$packagesn"

# Download the packages
/tmp/usr/bin/pacman.static --root $DESTDIR --config /tmp/pacman.conf --noconfirm -Syw $packages
if [ $? -gt 0 ]; then
    echo "error fetching packages"
    exit 1
fi

# Install the packages and log output for future use
/tmp/usr/bin/pacman.static --root $DESTDIR --config /tmp/pacman.conf --noconfirm -S $packages 2>&1 | tee /tmp/pacman.log
if [ $? -gt 0 ]; then
    echo "error installing packages"
    exit 1
fi

# Notify the user
echo -e "nInstallation complete, edit /tmp/pacman.log to review output messages"
echo "You have now to install or compile a kernel, and configure a bootloader"
# TODO : How to install a kernel and configure a bootloader (like quickinst)
# TODO : How to compile a kernel (chroot is your friend)
echo "Good luck ;^)"
exit 0

You can download a file here.

Let me know if this is useful to you wink

BTW, I had the following error durint my tests :

installing udev... done.
sbin/migrate-udev: line 8: mktemp: command not found
sbin/migrate-udev: line 12: mount: command not found
creating device nodes: mknod: `dev/console': No such file or directory
console mknod: `dev/null': No such file or directory
null mknod: `dev/zero': No such file or directory
zero 
sbin/migrate-udev: line 28: umount: command not found

And the device nodes are not created in /dev... Someone know why ? :?


Excessive showering, grooming, and toothbrushing is not only vain, it wastes valuable coding time.

Offline

#2 2006-03-07 23:34:26

raskolnikov
Member
From: France
Registered: 2006-01-08
Posts: 100

Re: custinst - quickinst enhanced

Just installed Arch with this script (modified to use snarf instead of wget) from the 0.7.1 iso, worked fine. I had the same errors with udev (commands not found) but nodes are in /dev, this time. Bah.


Excessive showering, grooming, and toothbrushing is not only vain, it wastes valuable coding time.

Offline

#3 2006-03-08 07:48:52

gradgrind
Member
From: Germany
Registered: 2005-10-06
Posts: 921

Re: custinst - quickinst enhanced

This idea is quite similar to the 'mkarch' script of my 'larch' live CD kit (see www.fsphost.com/gradgrind). Anyone is invited to look there for a very slightly different angle on it.

I also noticed the problem with udev - I have posted a bug report. The install script doesn't work well with 'pacman -r'. In spite of the messages the device nodes seem to be created most of the time (it has to do with the order in which various packages are installed). But - just in case - I added a fix to my mkarch script (after installation of the base packages):

echo "Fix for udev install script ... may be unnecessary"
echo -n "creating device nodes: "
rm -f $DESTDIR/dev/console
rm -f $DESTDIR/dev/null
rm -f  $DESTDIR/dev/zero
mknod  $DESTDIR/dev/console c 5 1
echo -n "console "
mknod -m 666  $DESTDIR/dev/null c 1 3
echo -n "null "
mknod -m 666  $DESTDIR/dev/zero c 1 5
echo -n "zero "
echo

(where DESTDIR is of course the mount point of the system being installed)
Even if the nodes were created properly this fix does no harm, it just recreates them.

Offline

#4 2006-03-08 13:18:17

raskolnikov
Member
From: France
Registered: 2006-01-08
Posts: 100

Re: custinst - quickinst enhanced

gradgrind wrote:

This idea is quite similar to the 'mkarch' script of my 'larch' live CD kit (see www.fsphost.com/gradgrind).

Indeed smile If I knew it before writing my script, it would have save me some problems... This was my first shell script, btw :oops:

I also noticed the problem with udev - I have posted a bug report. The install script doesn't work well with 'pacman -r'. In spite of the messages the device nodes seem to be created most of the time (it has to do with the order in which various packages are installed).

From my tests, this bug seems related to the location where we run the script : if I use / as my base directory, nodes are created (with errors about commands not found). But if I use any directory other than /, nodes are not created. Anyway I will add your workaround, it's good wink

I have done an install with the repos testing/current/extra last night, worked great (including glibc 2.3.6 with en_US ISO-8859-15 locale), but I do not remember if udev bug is still there... Can't retry as my laptop hard disk died after with lots of crunky noises sad


Excessive showering, grooming, and toothbrushing is not only vain, it wastes valuable coding time.

Offline

Board footer

Powered by FluxBB