Skip to content

Commit

Permalink
almost got archlinux working
Browse files Browse the repository at this point in the history
  • Loading branch information
jedi4ever committed Feb 8, 2011
1 parent ff0c4a8 commit e5c0e37
Show file tree
Hide file tree
Showing 6 changed files with 150 additions and 59 deletions.
4 changes: 3 additions & 1 deletion lib/veewee/session.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -388,7 +388,9 @@ def self.destroy_vm(boxname)
Veewee::Shell.execute("#{command}") Veewee::Shell.execute("#{command}")


if File.exists?(d.location) if File.exists?(d.location)
puts "We tried to delete the disk file '#{d.location} but failed" puts "We tried to delete the disk file via vmware '#{d.location} but failed"
puts "Removing it manually"
FileUtils.rm(d.location)
exit exit
end end
#v.3 #v.3
Expand Down
3 changes: 3 additions & 0 deletions templates/Archlinux-experimental/autorun0
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

echo "we made it to autorun"
22 changes: 22 additions & 0 deletions templates/Archlinux-experimental/definition.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,22 @@
Veewee::Session.declare( {
:cpu_count => '1', :memory_size=> '256',
:disk_size => '10140', :disk_format => 'VDI',:disk_size => '10240' ,
:os_type_id => 'Linux',
:iso_file => "systemrescuecd-x86-2.0.0.iso",
:iso_src => "http://downloads.sourceforge.net/project/systemrescuecd/sysresccd-x86/2.0.0/systemrescuecd-x86-2.0.0.iso?r=http%3A%2F%2Fwww.sysresccd.org%2FDownload&ts=1297107227&use_mirror=ignum",
:iso_md5 => "51012e0bb943cff6367e5cea3a61cdbe",
:iso_download_timeout => "1000",
:boot_wait => "10",:boot_cmd_sequence => [
'<Tab> ',
'setkmap=us dodhcp=eth0 dhcphostname=%NAME% ar_source=http://%IP%:%PORT%/ autoruns=0 rootpass=vagrant',
'<Enter>'
],
:kickstart_port => "7122", :kickstart_timeout => "10000",:kickstart_file => "autorun0",
:ssh_login_timeout => "10000",:ssh_user => "root", :ssh_password => "vagrant",:ssh_key => "",
:ssh_host_port => "2222", :ssh_guest_port => "22",
:sudo_cmd => "sh '%f'",
:shutdown_cmd => "shutdown -H",
:postinstall_files => [ "postinstall.sh"],:postinstall_timeout => "10000"
}
)
#'setkmap=us dodhcp=eth0 dhcphostname=%NAME% ar_source=http://%IP%:%PORT%/ autoruns=0 rootpass=vagrant',
120 changes: 120 additions & 0 deletions templates/Archlinux-experimental/postinstall.sh
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,120 @@
#!/bin/bash

#https://wiki.archlinux.org/index.php/Install_from_Existing_Linux

ARCH=i686
mkdir /tmp/archlinux
cd /tmp/archlinux

alias wget='wget --trust-server-names'

wget http://www.archlinux.org/packages/core/$ARCH/pacman/download/
wget http://www.archlinux.org/packages/core/any/pacman-mirrorlist/download/

wget http://www.archlinux.org/packages/core/$ARCH/libfetch/download/
wget http://www.archlinux.org/packages/core/$ARCH/libarchive/download/
wget http://www.archlinux.org/packages/core/$ARCH/bzip2/download/
wget http://www.archlinux.org/packages/core/$ARCH/openssl/download/
wget http://www.archlinux.org/packages/core/$ARCH/xz/download/
wget http://www.archlinux.org/packages/core/$ARCH/expat/download/

for f in *.tar.xz ; do unxz -v $f ; done
for f in *.tar ; do tar xvf $f ; done
for f in *.tar.gz ; do tar xzvf $f ; done


export PATH=/tmp/archlinux/usr/bin:$PATH
export LD_LIBRARY_PATH=/tmp/archlinux/usr/lib:/tmp/archlinux/lib:$LD_LIBRARY_PATH
alias pacman="pacman --config /tmp/archlinux/etc/pacman.conf"

cd /
for f in /tmp/archlinux/pacman-*pkg.tar.gz ; do
tar xzf $f
done

#/etc/pacman.d/mirrorlist
#enable a mirror

#Partition the disk
sfdisk --force /dev/sda <<EOF
# partition table of /dev/sda
unit: sectors
/dev/sda1 : start= 2048, size= 18874368, Id=83
/dev/sda2 : start= 18876416, size= 2095104, Id=82
/dev/sda3 : start= 0, size= 0, Id= 0
/dev/sda4 : start= 0, size= 0, Id= 0
EOF

sleep 2

#Format the first disk
mkfs.ext3 /dev/sda1

#Format the swap and use it
mkswap /dev/sda2
swapon /dev/sda2

mkdir /newarch
mount /dev/sda1 /newarch

mkdir -p /newarch/var/lib/pacman

#setting pacman - mirror - Belgium
sed -i 's/^#\(.*kangaroot.*\)/\1/' /etc/pacman.d/mirrorlist

pacman -Sy -r /newarch

#pacman: error while loading shared libraries: libbz2.so.1.0: cannot open shared object file: No such file or directory
#require bzip2
pacman --noconfirm --cachedir /newarch/var/cache/pacman/pkg -S base -r /newarch

#Create the devices
cd /newarch/dev
rm -f console ; mknod -m 600 console c 5 1
rm -f null ; mknod -m 666 null c 1 3
rm -f zero ; mknod -m 666 zero c 1 5

#Copy the dns information (cp is aliased so we use the binary)
/bin/cp -f /etc/resolv.conf /newarch/etc/

#Mount the process architecture
mount -t proc proc /newarch/proc
mount -t sysfs sys /newarch/sys
mount -o bind /dev /newarch/dev

chroot /newarch pacman --noconfirm -S kernel26
#chroot /newarch pacman --noconfir -S packagename

#set the mirror list within the machine
chroot /newarch sed -i 's/^#\(.*kangaroot.*\)/\1/' /etc/pacman.d/mirrorlist
#/etc/fstab
#We need a partition!

echo "echo '/dev/sda1 / ext4 defaults,noatime 0 0' >> /etc/fstab"|chroot /newarch sh -
echo "echo '/dev/sda2 swap swap defaults 0 0'>> /etc/fstab"|chroot /newarch sh -

#/etc/rc.conf

#hostname
chroot /newarch sed -i 's/^HOSTNAME=\(.*\)/HOSTNAME=vagrant-arch/' /etc/rc.conf
#gateway

#/etc/hosts
#/etc/mkinitcpio.conf
#/etc/local.gen


#grub
chroot /newarch grep -v rootfs /proc/mounts > /etc/mtab
chroot /newarch grub-install /dev/sda
chroot /newarch cp -a /usr/lib/grub/i386-pc/* /boot/grub

#create vagrant user

#chef
cd /
umount /newarch/{proc,sys,dev}
umount /newarch

reboot
58 changes: 1 addition & 57 deletions templates/Sysrescuecd-2.0.0-experimental/autorun0
Original file line number Original file line Diff line number Diff line change
@@ -1,59 +1,3 @@
#!/bin/bash #!/bin/bash


#https://wiki.archlinux.org/index.php/Install_from_Existing_Linux echo "we made it to autorun"

ARCH=i686
mkdir /tmp/archlinux
cd /tmp/archlinux

alias wget='wget --trust-server-names'

wget http://www.archlinux.org/packages/core/$ARCH/pacman/download/
wget http://www.archlinux.org/packages/core/any/pacman-mirrorlist/download/

wget http://www.archlinux.org/packages/core/$ARCH/libfetch/download/
wget http://www.archlinux.org/packages/core/$ARCH/libarchive/download/
wget http://www.archlinux.org/packages/core/$ARCH/openssl/download/
wget http://www.archlinux.org/packages/core/$ARCH/xz/download/
wget http://www.archlinux.org/packages/core/$ARCH/expat/download/

for f in *.tar.gz ; do tar xzvf $f ; done

export PATH=/tmp/archlinux/usr/bin:$PATH
export LD_LIBRARY_PATH=/tmp/archlinux/usr/lib:$LD_LIBRARY_PATH
alias pacman="pacman --config /tmp/archlinux/etc/pacman.conf"

cd /
for f in /tmp/archlinux/pacman-*pkg.tar.gz ; do
tar xzf $f
done

#needs fdisk first
mkfs.ext3 /dev/sda1
mkfs.ext3 -j -O dir_index /dev/sda1

mkreiserfs /dev/sdxx

mkswap /dev/sda2
swapon /dev/sda2

mkdir /newarch
mount /dev/sda1 /newarch

mkdir -p /newarch/var/lib/pacman
pacman -Sy -r /newarch

pacman --cachedir /newarch/var/cache/pacman/pkg -S base -r /newarch

cd /newarch/dev
rm console ; mknod -m 600 console c 5 1
rm null ; mknod -m 666 null c 1 3
rm zero ; mknod -m 666 zero c 1 5

cp /etc/resolv.conf /newarch/etc/

mount -t proc proc /newarch/proc
mount -t sysfs sys /newarch/sys
mount -o bind /dev /newarch/dev

chroot /newroot pacman -S kernel26
2 changes: 1 addition & 1 deletion templates/Sysrescuecd-2.0.0-experimental/definition.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
:kickstart_port => "7122", :kickstart_timeout => "10000",:kickstart_file => "autorun0", :kickstart_port => "7122", :kickstart_timeout => "10000",:kickstart_file => "autorun0",
:ssh_login_timeout => "10000",:ssh_user => "root", :ssh_password => "vagrant",:ssh_key => "", :ssh_login_timeout => "10000",:ssh_user => "root", :ssh_password => "vagrant",:ssh_key => "",
:ssh_host_port => "2222", :ssh_guest_port => "22", :ssh_host_port => "2222", :ssh_guest_port => "22",
:sudo_cmd => "echo '%p'|sudo -S sh '%f'", :sudo_cmd => "sh '%f'",
:shutdown_cmd => "shutdown -H", :shutdown_cmd => "shutdown -H",
:postinstall_files => [ ],:postinstall_timeout => "10000" :postinstall_files => [ ],:postinstall_timeout => "10000"
} }
Expand Down

0 comments on commit e5c0e37

Please sign in to comment.