You are not logged in.

#1 2009-03-25 23:59:23

Wrinkliez
Member
Registered: 2009-02-08
Posts: 18

newarch crashes?

Hey, I am trying to install via live cd of another distro.  I have been following this tutorial

http://wiki.archlinux.org/index.php/Ins … m_a_LiveCD

And I want to run the script, but the script always closes out the terminal shortly after trying to install pacman.  Any Ideas?  My newarch file is this



#! /bin/bash
#
# newarch
#
# Author: gradgrind <mt.42@web.de>
#
# This file is part of the larch project.
#
#    larch is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    larch is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with larch; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA #
#----------------------------------------------------------------------------
#

#----------------------------- CONFIGURATION ------------------

# WARNING! Relative paths (those not starting with /) are relative
# to the directory containing this file, and should be processed
# with 'readlink -f' in order to make them absolute, e.g.:
#      VAR1=$( readlink -f ../dir/file )

# Allows customizing of the cache for downloaded packages, default:
#PKGCACHE=/var/cache/pacman/pkg
# setting it to "" will cause the cache to be built and left in
# the destination directory
#PKGCACHE=""
PKGCACHE=/var/cache/pacman/pkg

# directory to contain the freshly installed Arch Linux
DESTDIR=/arch

# pacman version, for ease of maintaining in case it get's updated.
PACVER="3.0.6-2"

# choose method for acquiring list of base packages
#getbasepacks=basepacks_cvs
getbasepacks=basepacks_ftp

# list of base packages which should NOT be installed
# e.g. BASEVETO="pkga pkgb"
BASEVETO="devfsd lshwd"
# devfsd is deprecated, but apparently still in base
# lshwd is buggy and not usually needed any more

#----------------------------- END OF CONFIGURATION -----------

# Get path to directory containing this script
SCRIPTDIR="`dirname \`readlink -f $0\``"

echo "Changing current directory to $SCRIPTDIR"
cd $SCRIPTDIR

echo
echo "newarch will do an automated Archlinux installation to the directory"
echo "            $DESTDIR"
echo
echo "It only installs the packages, without configuration."
echo
echo "It runs two stages:"
echo "                    install base packages - should generally be left unaltered"
echo "       (optional)   install additional packages - main point of customization"
echo

if [ "$(whoami)" != 'root' ]; then
       echo "You must run this as 'root'"
       exit 1
fi

if [ -z "`echo $DESTDIR | grep '^/'`" ]; then
       DESTDIR=`pwd`/$DESTDIR
fi

echo "**********************************************************"
echo "This will delete EVERYTHING under"
echo
echo "       $DESTDIR"
echo
echo "I really mean it ... Are you sure you want to do this?"
echo "**********************************************************"
# Await yes or no
read -p "[y/N]: " ans
if [ -z "`echo $ans | grep '^ *[yY]'`" ]; then exit 0; fi

echo
echo "Downloaded packages will be cached at      $PKGCACHE"
echo
# Await yes or no
read -p "OK? [y/N]: " ans
if [ -z "`echo $ans | grep '^ *[yY]'`" ]; then exit 0; fi

#if [ ! -d $DESTDIR ]; then
#       mkdir -p $DESTDIR
#else
#       rm -rf $DESTDIR/*
#       if [ $? -ne 0 ]; then
#               echo "ERROR: couldn't remove $DESTDIR"
#               exit 1
#       fi
#fi

if [ -x /usr/bin/pacman ]; then
    PACMAN="pacman --config pacman.conf --noconfirm"
else
    echo
    echo "Downloading pacman"
    echo
    # use wget to download pacman
    # Updated to core and removed the setup/ subdir as noted in the discussion.
    # Please note: Apparently somebody removed the 'pacman.pkg.tar.gz' file, I'm
    # changing to it's current version. I would appreciate if somebody re-upload
    # the pacman.pkg.tar.gz or give me a better solution. :-) -- Felipe Mendes
    wget ftp://ftp.archlinux.org/core/os/i686/pa … pkg.tar.gz
    (($? > 0)) && echo 'Looks like your pacman download failed. Please ensure the PACVER \
                   variable is set to the latest pacman version and release.' && exit 1
    tar -xzf pacman-$PACVER-i686.pkg.tar.gz -O usr/bin/pacman.static >pacman.static
    chmod 755 pacman.static
    PACMAN="./pacman.static --config pacman.conf --noconfirm"
fi

# Generate the list of base packages using cvs.archlinux.org
basepacks_cvs ()
{
    echo
    echo "*********** Getting base package list from cvs.archlinux.org ***********"
    echo
    # Download index.html file for current/base
    rm -f index.html
    wget http://cvs.archlinux.org/cgi-bin/viewcvs.cgi/base/
    # bad style, but working thou
    # There was a problem with this function. Somebody forgot to close sed quotes:
    cat index.html | grep '^<a name="[^A]' | sed 's|.*name="\(.\+\)" h.*|\1|' > packages.temp
    BASEPKGS=`cat packages.temp | sed 's|-|[^-]\+-[0-9].[0-9]\+\.pkg.*||'`
}

# Generate the list of base packages from ftp.archlinux.org/.../packages.txt
basepacks_ftp ()
{
    echo
    echo "** Getting base package list from ftp.archlinux.org/.../packages.txt **"
    echo
    rm -f packages.txt
    wget ftp://ftp.archlinux.org/core/os/i686/packages.txt
    # The sed regexp didn't worked with versions such as:
    # pam-0.99.8.1-3.1.pkg.tar.gz
    # and gcc-4.2.1-3.1.pkg.tar.gz
    # So I adapted it.
    BASEPKGS=`cat packages.txt | egrep '^base/' | \
            sed 's|^.*/||;s/-[0-9]\+.*//'`
}

# Fetch the list of packages from core/base to BASEPKGS
$getbasepacks
# Build basepacks by filtering BASEPKGS
echo -n "" > basepacks
#
# I'm sure this next bit (filter out vetoed packages) can be done better,
# any ideas? bash has so much weird syntax ... too complicated for me.
#
for p in $BASEPKGS; do
       for v in $BASEVETO; do
               if [ "$v" == "$p" ]; then
                       p=""
                       break
               fi
       done
       if [ -n "$p" ]; then
               echo $p >> basepacks
       fi
done

doInstall() {
    echo "Installing following packages:"
    echo $PKGLIST
    $PACMAN -r $DESTDIR -S $PKGLIST
    if [ $? -gt 0 ]; then
       echo
       echo "Package installation from $pklist FAILED."
       echo
       exit 1
    fi
}

# This redirects the package cache, so that an existing one can be used.
if [ -n "$PKGCACHE" ]; then
    mkdir -p $DESTDIR/var/cache/pacman
    mkdir -p $PKGCACHE
    ln -s $PKGCACHE $DESTDIR/var/cache/pacman/pkg
fi

echo
echo "************** Synchronising package dbs **************"
echo
$PACMAN -r $DESTDIR -Sy

echo
echo "************** Installing base package set **************"
echo
pklist="basepacks"
PKGLIST=`cat $pklist | grep -v "#"`
doInstall

echo
echo "************** Additional packages **************"
echo
pklist="addedpacks"
if [ -f $pklist ]; then
    PKGLIST=`cat $pklist | grep -v "#"`
    doInstall
else
    echo " ... package list file 'addedpacks' not found"
    echo
fi

if [ -n "$PKGCACHE" ]; then
# Remove the package cache redirection
    rm $DESTDIR/var/cache/pacman/pkg
fi

echo
echo "Would you like to create a 'tar.gz' of the installation?"
# Await yes or no
read -p "[y/N]: " ans
if [ -z "`echo $ans | grep '^ *[yY]'`" ]; then exit 0; fi
echo "Doing     tar -czf archiball.tar.gz -C $DESTDIR ."
echo "This could take a while ..."
tar -czf archiball.tar.gz -C $DESTDIR .
echo
echo "+++ All done! +++"
echo

Thanks guys

Offline

#2 2009-03-26 21:19:08

byte
Member
From: Düsseldorf (DE)
Registered: 2006-05-01
Posts: 2,046

Re: newarch crashes?

This article is out of date.
It may contain old, confusing and wrong information. Please help improve the wiki by updating the article and correcting mistakes.

You should have seen that note, it's there for a reason. The 'newarch' script must have been outdated at least half a year ago (there's no cvs.archlinux.org, no packages.txt, etc).


1000

Offline

#3 2009-03-26 23:40:52

Xiong Chiamiov
Member
From: central coast, california
Registered: 2008-06-18
Posts: 142
Website

Re: newarch crashes?

1. [ code] tags.  Please.
2.

I am trying to install via live cd of another distro.

Wait, why?  There *is* a live Arch CD, y'know, and you obviously don't have problems booting a CD...

Offline

#4 2009-03-27 10:14:24

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

Re: newarch crashes?

Installing Arch from a LiveCD
From ArchWiki

This guide has been supplanted by: Install From Existing Linux

I have also added another note at the top of the page with that ancient script (http://wiki.archlinux.org/index.php/Qui … stallation).

But if you only want to install, the official installer is probably significantly easier.

Offline

Board footer

Powered by FluxBB