You are not logged in.

#1 2010-08-19 22:02:37

gelendir
Member
From: Québec
Registered: 2009-11-29
Posts: 7

my AIF config file for installing my workstation

Hello everyone,

I work in a open source web development company and everyone at my job uses ubuntu on their work stations. Everyone, except my project manager. He's also a big arch fan, so when his hard disk crashed he put arch instead of ubuntu. Unfortunately, I don't have as good an excuse for reinstalling and I don't expect any hardware failures soon. But after talking for a while with my project manager, He said that If i was able to get an arch installed, configured, and in working condition within an hour that he would give me some time to do it.

After that discussion, I remembered Dieter's talk about AIF and ArchCon and thought I would give it a try. Although i'm pretty confident that I could get an arch up and running using the interactive install, an automated approach can useful in lots of situations. Besides, I wouldn't be a geek if I didn't like trying out new stuff wink So here's my (still incomplete) AIF config using the automatic procedure. Right now it installs the Awesome WM, rails, mysql, postgresql, python, and a few other things. I still need to add apache and other web frameworks like pylons and symfony before it's complete. I also just noticed that vicious-git isn't properly installed, so I have to debug that. Tell what you think about it!

# this config explains the (all) available options.
# the variables are optional and we define their defaults here (so you could omit the
# definitions), unless otherwise specified.

SOURCE=net
FILE_URL=
SYNC_URL='ftp://mirror.csclub.uwaterloo.ca/archlinux/$repo/os/i686'
HARDWARECLOCK=localtime
TIMEZONE=Canada/Eastern
# Do you want to have additional pacman repositories or packages available at runtime (during installation)?
# RUNTIME_REPOSITORIES = array like this ('name1' 'location of repo 1' ['name2' 'location of repo2',..])
RUNTIME_REPOSITORIES=
# space separated list
RUNTIME_PACKAGES="wget"

# packages to install
TARGET_GROUPS="base base-devel xorg" # all packages in this group will be installed (defaults to base if no group and no packages are specified)
TARGET_PACKAGES_EXCLUDE= # Exclude these packages if they are member of one of the groups in TARGET_GROUPS.  example: 'nano reiserfsprogs' (they are in base)
TARGET_PACKAGES="awesome firefox thunderbird vim alsa-utils openssh mplayer rxvt-unicode openoffice-base zim python fortune-mod gpicview meld giggle ruby pidgin irssi wicd chromium ttf-ms-fonts ttf-dejavu ttf-bitstream-vera terminus-font nvidia xf86-video-vesa git mercurial mysql postgresql rubygems" 
# you can also specify separate packages to install (this is empty by default)

HOST_NAME="archvm"
#personal user name
USER_NAME="gregory"
#generated with mkpasswd
#TODO: find a way of generating hash using live cd. perhaps using a RUNTIME_PACKAGE ?
ENCRYPTED_PASSWORD="mmP84k.mbYqPc"
MYSQL_ROOT_PASSWORD="1qaz"

# you can optionally also override some functions...
worker_intro () {
    inform "Automatic procedure running greg's workstation config.  THIS WILL ERASE AND OVERWRITE YOUR /DEV/SDA.  IF YOU DO NOT WANT THIS PRESS CTRL+C WITHIN 10 SECONDS"
    sleep 10
}

#worker automatic network configuration not implemented yet. see http://bbs.archlinux.org/viewtopic.php?id=95824
worker_runtime_network() {
    dhcpcd eth0
}

worker_install_packages() {
    #HACK: the SYNC_URL is only used for the core repo. other repos fall back to /etc/pacman.d/mirrorlist.
    echo "Server = $SYNC_URL" > /etc/pacman.d/tmp_mirrorlist
    cat /etc/pacman.d/mirrorlist >> /etc/pacman.d/tmp_mirrorlist
    mv /etc/pacman.d/tmp_mirrorlist /etc/pacman.d/mirrorlist
    
    target_prepare_pacman core extra community
    installpkg
    #HACK: For some reason, in the automatic procedure worker, it doesn't check if there was an error while installing packages. 
    #This was pretty annoying when i accidentally misspelled a package name and worker_configure_system would spout a bunch of errors.
    #In my opinion, worker_configure_system should not execute if the was an error in installing packages, since there aren't any packages installed and thus no system to configure.
    if [ $? -ne 0 ]
    then
        echo "Error during package installation. exiting"
        exit 1
    fi
}

worker_configure_system () {
    prefill_configs

    echo "configuring rc.conf"
    sed -i "s/^HOSTNAME=.*/HOSTNAME=\"$HOST_NAME\"/" $var_TARGET_DIR/etc/rc.conf
    sed -i 's/^LOCALE=.*/LOCALE="en_CA.UTF-8"/' $var_TARGET_DIR/etc/rc.conf
    sed -i 's/^DAEMONS=.*/DAEMONS=(syslog-ng dbus @network @netfs @crond @sshd @alsa @wicd @mysqld @postgresql)/' $var_TARGET_DIR/etc/rc.conf

    echo "configuring hosts.*"
    echo "sshd : ALL : ALLOW" >> $var_TARGET_DIR/etc/hosts.allow
    sed -i "s/localhost$/localhost $HOST_NAME/g" $var_TARGET_DIR/etc/hosts

    echo "configuring locales"
    sed -i 's/#en_CA/en_CA/' $var_TARGET_DIR/etc/locale.gen
    sed -i 's/#fr_CA/fr_CA/' $var_TARGET_DIR/etc/locale.gen
    sed -i 's/#fr_FR/fr_FR/' $var_TARGET_DIR/etc/locale.gen
    chroot $var_TARGET_DIR locale-gen

    echo "adjusting fstab"
    sed -i 's/#\/dev\/dvd/\/dev\/dvd/' $var_TARGET_DIR/etc/fstab
    mkdir $var_TARGET_DIR/media/dvd

    #TODO: i'd like a cleaner way of setting the root password besides hacking /etc/shadow or asking for the password at the prompt
    echo "setting root password"
    chroot $var_TARGET_DIR passwd

    echo "adding personal user"
    chroot $var_TARGET_DIR useradd -d /home/$USER_NAME/ -m -g users -p $ENCRYPTED_PASSWORD -s /bin/bash $USER_NAME

    echo "adding awesome to xinitrc for personal user account"
    echo "exec awesome" >> $var_TARGET_DIR/home/$USER_NAME/.xinitrc

    #TODO: find out if there's a worker where we could execute a bunch of commands inside a chroot
    echo "installing vicious-git from AUR"
    cd $var_TARGET_DIR/tmp
    wget http://aur.archlinux.org/packages/vicious-git/vicious-git.tar.gz
    tar -xvf vicious-git.tar.gz
    chroot $var_TARGET_DIR cd /tmp/vicious-git && makepkg --asroot && pacman -U vicious-git-*.pkg.tar.xz

    #TODO:clone git repo with dotfiles and place in user account
    
    echo "installing rails through rubygems"
    chroot $var_TARGET_DIR gem install rails

    #TODO: configure postgresql
    #TODO: configure mysql
    
    #TODO: apache or nginx ? think about how to manage typo3 instances on localhost

}

# These variables are mandatory

GRUB_DEVICE=/dev/sda
PARTITIONS='/dev/sda 512:swap *:ext4:+'
#Change the first 'no' to 'yes' to format the partitions during installation
BLOCKDATA='/dev/sda1 raw no_label swap;no;no_mountpoint;target;no_opts;no_label;no_params
/dev/sda2 raw no_label ext4;no;/;target;no_opts;no_label;no_params'

I am a classical musician. I am a programmer. I am an open source enthusiast. For a while now, I have been looking for some kind of sign that could link these 3 traits together. Now, i finally have : The debian logo is just like a vertically flipped F Key !
<img src="http://www.nerdtests.com/images/badge/nt2/b86cfc385cb81a0d.jpg">

Offline

#2 2010-08-20 11:02:55

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

Re: my AIF config file for installing my workstation

Allright, glad you like it.  About vicious-git not properly getting installed, maybe it is not included in the repository you specified?


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

Offline

#3 2010-08-20 11:50:00

anrxc
Member
From: Croatia
Registered: 2008-03-22
Posts: 835
Website

Re: my AIF config file for installing my workstation

I also just noticed that vicious-git isn't properly installed

Was it d/l at all? PKGBUILD is simple, so that's the only problem I can see. Repository is being served over http and it sometimes causes problems for users.


You need to install an RTFM interface.

Offline

#4 2010-08-20 12:37:59

gelendir
Member
From: Québec
Registered: 2009-11-29
Posts: 7

Re: my AIF config file for installing my workstation

Dieter@be wrote:

Allright, glad you like it.  About vicious-git not properly getting installed, maybe it is not included in the repository you specified?

vicious-git isn't in any repository, I download it from AUR. It gets properly downloaded and uncompressed, but the chroot doesn't, fails with a 'cannot execute cd : no such file or directory' Once i've got some spare time this afternoon (still early in the morning over here smile ) I'll try to find out why

By the way, is there any functionality in AIF to execute a worker in a chroot on the target system ? I looked quickly through the list of workers in the automatic procedures and didn't see anything specific. Although I can configure most stuff from the configure_system worker, there are a few things where you really need to be running inside the system to configure. For example : you need to have the mysql daemon started if you want to change the password, and you need to be chrooted if you want to have all the dependencies when building a PKGBUILD If not, I was thinking of generating a bash script that would contain all my chrooted stuff, so I would only need to execute chroot once in the worker.


I am a classical musician. I am a programmer. I am an open source enthusiast. For a while now, I have been looking for some kind of sign that could link these 3 traits together. Now, i finally have : The debian logo is just like a vertically flipped F Key !
<img src="http://www.nerdtests.com/images/badge/nt2/b86cfc385cb81a0d.jpg">

Offline

Board footer

Powered by FluxBB