You are not logged in.

#1 2010-02-09 21:09:49

tokland
Member
From: Barcelona
Registered: 2009-06-30
Posts: 10
Website

Bootstrap a base Arch Linux on another distro

Hi!

I needed to install an Arch Linux environment on a Debian server, so I searched the wiki and found this page:

http://wiki.archlinux.org/index.php/Archbootstrap

Unfortunately, the script is outdated. So I wrote a new one:

http://tokland.googlecode.com/svn/trunk … otstrap.sh

(tested only on Debian Lenny)

$ sudo bash arch-bootstrap.sh myarch i686

Now, my questions:

1) is there another script that performs this task better?
2) if not, can you please give some feedback so as to update the wiki with (a -hopefully- more polished version of) this script?

Last edited by tokland (2010-02-09 21:27:31)

Offline

#2 2010-02-10 00:07:25

sisco311
Member
From: Romania
Registered: 2008-05-23
Posts: 112

Re: Bootstrap a base Arch Linux on another distro

You can use pacman to install Arch from an existing Linux distro:
http://wiki.archlinux.org/index.php/Ins … ting_Linux

EDIT:

The script works well in Ubuntu Lucid Lynx, but it should download the packages in /tmp and/or delete them after the install.

Last edited by sisco311 (2010-02-10 21:28:46)


don't drink unwashed fruit juice.
i never make predictions, especially about the future.

Offline

#3 2010-02-10 21:19:09

tokland
Member
From: Barcelona
Registered: 2009-06-30
Posts: 10
Website

Re: Bootstrap a base Arch Linux on another distro

sisco311 wrote:

You can use pacman to install Arch from an existing Linux distro:
http://wiki.archlinux.org/index.php/Ins … ting_Linux

I am aware of this statically compiled pacman, but I have some concerns... will it always be there? why other mirrors do not include this package?

Last edited by tokland (2010-02-22 23:05:19)

Offline

#4 2010-02-10 21:33:32

sisco311
Member
From: Romania
Registered: 2008-05-23
Posts: 112

Re: Bootstrap a base Arch Linux on another distro

tokland wrote:
sisco311 wrote:

You can use pacman to install Arch from an existing Linux distro:
http://wiki.archlinux.org/index.php/Ins … ting_Linux

I am aware of this statically compiled pacman, but I have some concerns... will be always be there? why other mirrors do not include this file?

If you install pacman, pacman-mirror & libfetch it should work without pacman-static, at least it worked for me in Ubuntu Karmic & Lucid.

Of course, it's much easier to use your script, great job. I will use it (with some customizations) in the future.

Last edited by sisco311 (2010-02-10 21:53:39)


don't drink unwashed fruit juice.
i never make predictions, especially about the future.

Offline

#5 2010-02-10 21:59:28

tokland
Member
From: Barcelona
Registered: 2009-06-30
Posts: 10
Website

Re: Bootstrap a base Arch Linux on another distro

If you install pacman, pacman-mirror & libfetch it should work without pacman-static, at least it worked for me in Ubuntu Karmic & Lucid.

Really? I tried to narrow down the package list, but pacman wouldn't run if any of them was removed.

I'll update the wiki with the script. You can reports bugs/suggestions here:

http://code.google.com/p/tokland/issues/list

Offline

#6 2010-02-22 22:34:12

Lacsap
Member
From: France
Registered: 2009-01-09
Posts: 23

Re: Bootstrap a base Arch Linux on another distro

Hi,

I'm working on a script.
It's working with pacman-static.
pacman, in version 3.3.0, introduce xz archive format support and now, some packages use this format (mkinitcpio-0.6.3-1-any.pkg.tar.xz)
So, my script is endding with pacman-static error (unrecognized archive format) !

Where can I find the 3.3.0 (or more) pacman-static ?

Here's the script (it's a first step...) :

#!/bin/bash

# install an Arch in the specified location (debbootstrap like)
# work over pacman-static
# must run on GNU/Linux systems

# http://wiki.archlinux.org/index.php/Install_from_Existing_Linux
# http://wiki.archlinux.fr/install/chroot?DokuWiki=153b0c6847435682de50a6061e6f75a4



[ "${1}" ]  ||  { echo "usage: $( basename $0 ) chrootdir [packages]" >/dev/stderr  &&  exit 1; }



B='\033[29;1m'
b='\033[0m'



# load variables defined in configuration file
echo -e "${B}load configuration file...${b}"
. /usr/local/etc/$( basename $0 ).conf  ||  exit $?



# test packages cache
echo -e "${B}test packages cache...${b}"
[ "${abs_cache}" ]  ||  abs_cache=/var/cache/pacman/pkg
[ -d "${abs_cache}" ]  ||  { mkdir -vp ${abs_cache}  ||  exit $?; }
touch ${abs_cache}/$( basename $0 )  &&  rm ${abs_cache}/$( basename $0 )  ||  exit $?



# make minimal chroot for pacman
echo -e "${B}make minimal chroot...${b}"
abs_chroot=${1}
mkdir -v ${abs_chroot}  ||  exit $?
mkdir -vp ${abs_chroot}/etc/pacman.d
mkdir -vm 1777 ${abs_chroot}/tmp
mkdir -vp ${abs_chroot}/usr/bin
mkdir -vp ${abs_chroot}/var/lib/pacman



# install pacman.static in chroot
abs_static_package=$( find ${abs_cache} | grep pacman-static )
if [ ! "${abs_static_package}" ]
then
    # download it
    echo -e "${B}download pacman...${b}"
    [ "${abs_static_host}" ]  ||  abs_static_host="http://repo.archlinux.fr/i686"
    abs_static_package=$( curl -sSL ${abs_static_host} | egrep -io 'href="pacman-static[^"]+\.pkg\.tar\.gz"' | awk -F '"' '{print $2}' )
    [ "${abs_static_package}" ]  &&  abs_static_package=${abs_cache}/${abs_static_package}  ||  exit $?
    curl --progress-bar ${abs_static_host}/${abs_static_package} > ${abs_static_package}  ||  exit $?
fi
echo -e "${B}install pacman...${b}"
mkdir -p ${abs_chroot}/tmp/pacman
tar vxzf ${abs_static_package} -C ${abs_chroot}/tmp/pacman ||  exit $?
cp -v ${abs_chroot}/tmp/pacman/usr/bin/pacman.static ${abs_chroot}/usr/bin/
rm -vrf ${abs_chroot}/tmp/pacman
#  install pacman configuration in chroot
echo -e "${B}configure pacman...${b}"
[ "${abs_repository}" ]  ||  abs_repository='http://mirrors.kernel.org/archlinux/$repo/os/i686'
abs_pacman_conf=${abs_chroot}/tmp/pacman.conf
echo "
[core]
Server = ${abs_repository}
[extra]
Server = ${abs_repository}
[community]
Server = ${abs_repository}
" > ${abs_pacman_conf}



# install the core
echo -e "${B}install the core...${b}"
${abs_chroot}/usr/bin/pacman.static                \
    --sync                                        \
    --refresh                                    \
    --root ${abs_chroot}                        \
    --cachedir ${abs_cache}                        \
    --config ${abs_pacman_conf}                    \
    --logfile /dev/null                            \
    --verbose                                    \
    --noprogressbar                                \
    base  ||  exit $?

Offline

#7 2010-02-22 22:58:31

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Bootstrap a base Arch Linux on another distro

Lacsap - please use forum code tags when posting scripts. As you're new here, I'll fix it for you this time.

Offline

#8 2010-02-23 09:55:45

Lacsap
Member
From: France
Registered: 2009-01-09
Posts: 23

Re: Bootstrap a base Arch Linux on another distro

Hi,

Thanks for changes and ok for next time.

Offline

#9 2010-02-23 10:24:34

Lacsap
Member
From: France
Registered: 2009-01-09
Posts: 23

Re: Bootstrap a base Arch Linux on another distro

In the script above replace

    [ "${abs_static_package}" ]  &&  abs_static_package=${abs_cache}/${abs_static_package}  ||  exit $?
    curl --progress-bar ${abs_static_host}/${abs_static_package} > ${abs_static_package}  ||  exit $?

by

    [ "${abs_static_package}" ]  ||  exit $?
    curl --progress-bar ${abs_static_host}/${abs_static_package} > ${abs_cache}/${abs_static_package}  ||  exit $?
    abs_static_package=${abs_cache}/${abs_static_package}

Offline

#10 2010-02-23 12:00:29

tokland
Member
From: Barcelona
Registered: 2009-06-30
Posts: 10
Website

Re: Bootstrap a base Arch Linux on another distro

sisco311 wrote:

The script works well in Ubuntu Lucid Lynx, but it should download the packages in /tmp and/or delete them after the install

Last version of the script downloads packages to a directory (arch-bootstrap-packages/). I prefer not to delete the files so you can move the script along with the .tar.gz to another machine and still run it off-line (that's why the optional argument CORE_OS_INDEX exists).

Lacsap wrote:

In the script above replace [...]

Lacsap, I think the best option is that you:

1) Upload your script somewhere.
2) Update the wiki with a link to your code.
3) Delete my code from the wiki page, just keeping the description and links.

That way we can keep a clean page in the wiki.

Offline

#11 2010-02-23 21:45:59

Lacsap
Member
From: France
Registered: 2009-01-09
Posts: 23

Re: Bootstrap a base Arch Linux on another distro

The script called [wiki]Genesis[/wiki] is in the wiki.
Why delete your code ?

Offline

#12 2010-02-23 21:52:56

tokland
Member
From: Barcelona
Registered: 2009-06-30
Posts: 10
Website

Re: Bootstrap a base Arch Linux on another distro

Lacsap wrote:

The script called [wiki]Genesis[/wiki] is in the wiki.
Why delete your code ?

Well, I didn't mean to delete all my work but to remove the code box, keeping just the description and the link (and adding also yours). Maintaining code in a wiki is cumbersome, it's better to link to a repository.

It seemed logical to share wiki page since our scripts have the same goal.

Offline

#13 2010-03-07 12:21:11

bdheeman
Member
From: Chandigarh, PB, India
Registered: 2008-09-15
Posts: 10
Website

Re: Bootstrap a base Arch Linux on another distro

Copy pasting a script from wiki is absurd; why don;t try it yourself wink

Please post it to the AUR as a PKGBUILD; so that the user's of ArchLinux or other distributions may get the script and, or example config from Files smile


Balwinder S Dheeman
http://werc.homelinux.net/

Offline

#14 2010-03-13 20:57:22

Lacsap
Member
From: France
Registered: 2009-01-09
Posts: 23

Re: Bootstrap a base Arch Linux on another distro

Yes it is... smile
The code is now versionned here http://bitbucket.org/patatetom/genesis/

Offline

#15 2010-03-31 00:32:10

Lucky
Member
From: /dev/random
Registered: 2009-08-07
Posts: 28

Re: Bootstrap a base Arch Linux on another distro

Hi,
i wrote this little script to get pacman on debian. maybe it helps

http://lky.cc/getpac.sh

talk & update there:
http://bbs.archlinux.org/viewtopic.php? … 36#p734336

Last edited by Lucky (2010-06-01 16:45:56)

Offline

#16 2010-03-31 10:56:53

Dieter@be
Forum Fellow
From: Belgium
Registered: 2006-11-05
Posts: 2,001
Website

Re: Bootstrap a base Arch Linux on another distro

once you have a static pacman [and maybe mkinitcpio, not sure] you could just run aif on the debian or whatever system. as long as it has the other dependencies (grub1, bash, grep, coreutils etc) but that should be no problem.  aif is just a script. you can do an interactive or automatic installation or whatever, just make sure to pick the correct blockdevice(s) wink

there's also the mkarchroot script (in the package devtools, I think). I'm not sure which deps it has but I would guess it's a similar story as aif.


< Daenyth> and he works prolifically
4 8 15 16 23 42

Offline

Board footer

Powered by FluxBB