You are not logged in.

#1 2009-03-08 06:43:17

brando56894
Member
From: NYC
Registered: 2008-08-03
Posts: 681

Part 2 Install Script

Edit: Updated, check last post

I got tired of the long and annoying process of manually installing everything after the base system was installed, so I got bored one night about two weeks ago and decided to write this script.  It will pretty much do everything I normally had to do and everything is taken from the Beginners Install Guide, such as:

asks you if you want to display or hide the output of pacman and other operations
configure the internet for dhcp
rank mirrors based on speed
update the system
installs NTFS-3g
implement a custom fstab (it got annoying to add 5 or so partitions in everytime manually)
add a user
installs alsa
installs the xserver along with the nvidia driver from the arch repo
installs commonly used fonts
gives you the choice of installing kdemod 3 or 4
installs firefox thunderbird compiz-fusion emerald and fusion-icon and others
copies desktop and autostart links
links my windows thunderbird and firefox profiles to my linux ones so that theyre in sync
and finally starts the appropriate desktop manager when everything is installed.


Eeverything in the script is well documented and is easy to read since my bash scripting knowledge isnt that advanced, so its easy to edit it for your own needs. You could just copy the script from here but I recommend you download the tar ball since the script refers to a lot of custom files that I made (such as specific rc.confs and pacman.confs for kde 3 and kde 4) and everything will work out of the box, you might have to change a few paths in the script though.

If anyone finds any bugs or can offer suggestions on how to improve the script I'd love to hear them! I'm still looking for a way to feed the firefox and thunderbird profile names directly into variables so that you dont have to enter them manually like you have to now. Edit: one more thing I just thought of, I'd like to colorize some of the outputs such as the ":: Installing [package name]" parts with the :: being blue and the text being white (just like it is when you boot up arch) but I have no idea on how to do it.

#! /bin/bash

##############################
# Written By Brandon Golway (Brando56894)#
##############################

echo "Do you want to display the output of the commands?"
echo "1) Yes"
echo "2) No"
echo
read output

if [[ "$output" == 1 ]]; then

echo "Which interface are you using?"
read interface
dhcpcd $interface

#location of where the script is being ran from
echo "Storing current location..."
location=`pwd`

#checks to see if the directory logs exists inside of the install.arch folder
#if it exists the directory is cleared, if it doesnt exist it is created
echo 
echo "Checking to see if "$location"/logs exists..."
if [ -d logs ]; then
   rm -f logs/*
   echo "It does so old logs were erased"
else
   mkdir logs
   echo "It doesn't so the directory was created"
fi
    
#ranking mirrors based on speed
cp mirrorlist /etc/pacman.d/mirrorlist.bak
cd /etc/pacman.d
echo
echo ":: Updating package list and installing Python..."
pacman -Syy 
pacman -S --noconfirm python
echo
echo "Ranking mirrors, this could take a few minutes..."
rm mirrorlist
rankmirrors -n 6 mirrorlist.bak > mirrorlist
cd $location

#copying pacman.conf with kdemod repositories
echo
echo "::Updating pacman and the system..."
pacman -Syy --noconfirm pacman
pacman -Syu --noconfirm
cp -f pacman.conf_kdemod3 /etc/pacman.conf

pacman -Syy 
echo
echo "::Installing NTFS-3g..."
pacman -S --noconfirm ntfs-3g 
echo
read -p "Edit fstab to correspond to the current partition layout (Hit Enter)"
nano fstab
clear
cp fstab /etc/fstab
mkdir /media/w7; mkdir /media/xp; mkdir /media/media;mkdir /media/mybook; mkdir /media/mint 
mount -a

#adding users and groups
echo
echo "Name your user:"
read user
useradd -m -G users,audio,lp,optical,storage,video,wheel,power -s /bin/bash $user
passwd $user
pacman -S --noconfirm sudo > logs/install.sudo
echo
read -p "Add this line to the sudoers file: "$user" ALL=(ALL) ALL"
EDITOR=nano visudo 
clear

#configuring ALSA
echo
echo "::Installing ALSA..."
pacman -S --noconfirm alsa-utils alsa-oss 
cp -f asound.state /etc/asound.state

#installing the Xserver
echo
echo "::Installing the Xserver..."
pacman -S --noconfirm xorg xf86-input-evdev mesa nvidia 
cp -f xorg.conf /etc/X11/xorg.conf
depmod -a

#setting login manager
cp xinitrc /home/$user/.xinitrc

#installing common fonts
echo
echo "::Installing commonly used fonts..."
pacman -S --noconfirm ttf-ms-fonts ttf-dejavu ttf-bitstream-vera 

echo
echo "Install KDEmod 3 or KDEmod 4?"
echo "1) KDEmod 3"
echo "2) KDEmod 4"
read decision
if [[ "$decision" == 1 ]]
then
    echo
    echo "::Installing KDEmod 3..."
    cp -f pacman.conf_kdemod3 /etc/pacman.conf
    pacman -Syy --noconfirm kdemod3 kdemod3-kdeutils-superkaramba 
    cp -f locale.gen /etc/locale.gen
    locale-gen 
    cp -f rc.conf_kdemod3 /etc/rc.conf
    cp -Rf Autostart /home/$user/.kde/
else 
    echo
    echo "::Installing KDEmod 4..."
    cp -f pacman.conf_kdemod4 /etc/pacman.conf
    pacman -Syy > logs/pkg.update
    pacman -S --noconfirm kdemod kdemod-kdeutils-superkaramba 
    cp -f locale.gen /etc/locale.gen
    locale-gen 
    cp -f rc.conf_kdemod4 /etc/rc.conf
    cp -Rf Autostart /home/$user/.kde4/
fi

echo
/etc/rc.d/hal start

#installing other stuff
echo
echo "::Installing firefox, thunderbird, yakuake, etc..."
pacman -S --noconfirm firefox thunderbird libdvdcss yakuake compiz-fusion-plugins-main compiz-fusion-plugins-extra compizconfig-backend-kconfig ccsm emerald fusion-icon ktorrent pidgin jre shaman samba lm_sensors 

#customizing
cp bashrc /home/$user/.bashrc
mkdir /home/$user/Desktop
cp -f Desktop/* /home/$user/Desktop/
cp -Rf emerald /home/$user/.emerald
echo

echo "What is the name of the firefox profile?"
ls /media/w7/Users/Bran/AppData/Roaming/Mozilla/Firefox/Profiles
read firefox_profile
echo
echo "What is the name of the thunderbird profile?"
ls /media/w7/Users/Bran/AppData/Roaming/Thunderbird/Profiles
read thunderbird_profile
ln -s /media/w7/Users/Bran/AppData/Roaming/Firefox/$firefox_profile /home/$user/.firefox
ln -s /media/w7/Users/Bran/AppData/Roaming/Thunderbird/$thunderbird_profile /home/$user/.thunderbird

chown -R $user:$user /home/$user/

if [ "$decision" = 1 ]; then
    /etc/rc.d/kdm3 start
else
    /etc/rc.d/kdm start
fi
fi




#hides output
if [[ "$output" == 2 ]]; then

echo "Which interface are you using?"
read interface
dhcpcd eth1  $interface

#location of where the script is being ran from
echo "Storing current location..."
location=`pwd`

#checks to see if the directory logs exists inside of the install.arch folder
#if it exists the directory is cleared, if it doesnt exist it is created
echo 
echo "Checking to see if "$location"/logs exists..."
if [ -d logs ]; then
   rm -f logs/*
   echo "It does so old logs were erased"
else
   mkdir logs
   echo "It doesn't so the directory was created"
fi

#ranking mirrors based on speed
cp mirrorlist /etc/pacman.d/mirrorlist.bak
cd /etc/pacman.d
echo
echo ":: Updating package list and installing Python..."
pacman -Syy>$location/logs/pkg.update 
pacman -S --noconfirm python > $location/logs/install.python
echo
echo "Ranking mirrors, this could take a few minutes..."
rm mirrorlist
rankmirrors -n 6 mirrorlist.bak > mirrorlist
cd $location

#copying pacman.conf with kdemod repositories
echo
echo "::Updating pacman and the system..."
pacman -Syy --noconfirm pacman > logs/update.pacman
pacman -Syu --noconfirm > update.system
cp -f pacman.conf_kdemod3 /etc/pacman.conf

pacman -Syy > logs/pkg.refresh
echo
echo "::Installing NTFS-3g..."
pacman -S --noconfirm ntfs-3g > logs/install.ntfs3g
echo
read -p "Edit fstab to correspond to the current partition layout (Hit Enter)"
nano fstab
clear
cp fstab /etc/fstab
mkdir /media/w7; mkdir /media/xp; mkdir /media/media;mkdir /media/mybook; mkdir /media/mint 
mount -a

#adding users and groups
echo
echo "Name your user:"
read user
useradd -m -G users,audio,lp,optical,storage,video,wheel,power -s /bin/bash $user
passwd $user
pacman -S --noconfirm sudo > logs/install.sudo
echo
read -p "Add this line to the sudoers file: "$user" ALL=(ALL) ALL"
EDITOR=nano visudo 
clear

#configuring ALSA
echo
echo "::Installing ALSA..."
pacman -S --noconfirm alsa-utils alsa-oss > logs/install.alsa
cp -f asound.state /etc/asound.state

#installing the Xserver
echo
echo "::Installing the Xserver..."
pacman -S --noconfirm xorg xf86-input-evdev mesa nvidia > logs/install.xserver
cp -f xorg.conf /etc/X11/xorg.conf
depmod -a

#setting login manager
cp xinitrc /home/$user/.xinitrc

#installing common fonts
echo
echo "::Installing commonly used fonts..."
pacman -S --noconfirm ttf-ms-fonts ttf-dejavu ttf-bitstream-vera > logs/install.fonts

echo
echo "Install KDEmod 3 or KDEmod 4?"
echo "1) KDEmod 3"
echo "2) KDEmod 4"
read decision
if [[ "$decision" == 1 ]]
then
    echo
    echo "::Installing KDEmod 3..."
    cp -f pacman.conf_kdemod3 /etc/pacman.conf
    pacman -Syy --noconfirm kdemod3 kdemod3-kdeutils-superkaramba > logs/install.kdemod3
    cp -f locale.gen /etc/locale.gen
    locale-gen > /dev/null
    cp -f rc.conf_kdemod3 /etc/rc.conf
    cp -Rf Autostart /home/$user/.kde/

else 
    echo
    echo "::Installing KDEmod 4..."
    cp -f pacman.conf_kdemod4 /etc/pacman.conf
    pacman -Syy > logs/pkg.update
    pacman -S --noconfirm kdemod kdemod-kdeutils-superkaramba > logs/install.kdemod4
    cp -f locale.gen /etc/locale.gen
    locale-gen > /dev/null
    cp -f rc.conf_kdemod4 /etc/rc.conf
    cp -Rf Autostart /home/$user/.kde4/
fi

echo
/etc/rc.d/hal start

#installing other stuff
echo
echo "::Installing firefox, thunderbird, yakuake, etc..."
pacman -S --noconfirm firefox thunderbird libdvdcss yakuake compiz-fusion-plugins-main compiz-fusion-plugins-extra compizconfig-backend-kconfig ccsm emerald fusion-icon ktorrent pidgin jre shaman samba lm_sensors > logs/install.otherstuff

#customizing
cp bashrc /home/$user/.bashrc
mkdir /home/$user/Desktop
cp -f Desktop/* /home/$user/Desktop/
cp -Rf emerald /home/$user/.emerald
echo

echo "What is the name of the firefox profile?"
ls /media/w7/Users/Bran/AppData/Roaming/Mozilla/Firefox/Profiles
read firefox_profile
echo
echo "What is the name of the thunderbird profile?"
ls /media/w7/Users/Bran/AppData/Roaming/Thunderbird/Profiles
read thunderbird_profile
ln -s /media/w7/Users/Bran/AppData/Roaming/Firefox/$firefox_profile /home/$user/.firefox
ln -s /media/w7/Users/Bran/AppData/Roaming/Thunderbird/$thunderbird_profile /home/$user/.thunderbird

chown -R $user:$user /home/$user/

if [ "$decision" = 1 ]; then
    /etc/rc.d/kdm3 start
else
    /etc/rc.d/kdm start
fi

fi

I thought you were able to attach files but I dont see the option anywhere so heres a link to megashare: Install Arch

Last edited by brando56894 (2009-05-17 02:09:19)

Offline

#2 2009-03-08 07:11:18

3nd3r
Member
From: /dev/null
Registered: 2002-12-08
Posts: 301
Website

Re: Part 2 Install Script

very nice
ill try it out

Offline

#3 2009-05-17 02:37:43

brando56894
Member
From: NYC
Registered: 2008-08-03
Posts: 681

Re: Part 2 Install Script

I've made a lot of changes to the script so its easier for me to use such as:

removed the option to show or hide output, the only option is to show the output
it now checks which architecture youre running (32 or 64 bit)
removed the Firefox and Thunderbird linking
removed the need to press 'Enter' to edit fstab
removed the need to use visudo, it copies an already edited sudoers file (which you have to add)
added samba config
various bug fixes

#! /bin/bash

#determining architecture
arch=$(uname -m)

clear
#add if statement to see if /var/run/dhcpcd-eth0.pid exists
dhcpcd eth0

#location of where the script is being ran from
ialocation=`pwd`

#ranking mirrors based on speed
if [ "$arch" == "x86_64" ]
then
    cp mirrorlist /etc/pacman.d/mirrorlist.bak
else
    cp mirrorlist.x32 /etc/pacman.d/mirrorlist.bak
fi

cd /etc/pacman.d
echo
echo ":: Updating package list and installing Python..."
pacman -Syu 
pacman -S --noconfirm --needed python
echo
echo "Ranking mirrors, this could take a few minutes..."
rm mirrorlist
rankmirrors -n 4 mirrorlist.bak > mirrorlist
cd $ialocation

echo
echo "::Installing NTFS-3g..."
pacman -S --noconfirm --needed ntfs-3g 

cp fstab.template fstab
nano fstab
clear
cp fstab /etc/fstab
rm fstab
mkdir /media/w7; mkdir /media/xp; mkdir /media/media; mkdir /media/mybook 
mount -a

#adding users and groups
echo
echo "Name your user:"
read user
useradd -m -G users,audio,lp,optical,storage,video,wheel,power -s /bin/bash $user
passwd $user
cp -f sudoers /etc/sudoers
clear

#configuring ALSA
echo
echo "::Installing ALSA..."
pacman -S --noconfirm --needed alsa-utils alsa-oss 
cp -f asound.state /etc/asound.state

#installing the Xserver
echo
echo "::Installing the Xserver..."
pacman -S --noconfirm --needed xorg xf86-input-evdev mesa nvidia 
cp -f xorg.conf /etc/X11/xorg.conf
depmod -a

#setting login manager
cp xinitrc /home/$user/.xinitrc

#installing common fonts
echo
echo "::Installing commonly used fonts..."
pacman -S --noconfirm --needed ttf-ms-fonts ttf-dejavu ttf-bitstream-vera 

echo
echo "Install KDEmod 3 or KDEmod 4?"
echo "1) KDEmod 3"
echo "2) KDEmod 4"
read kde_version
if [[ "$kde_version" == 1 ]]
then
    echo
    echo "::Installing KDEmod 3..."
    if [ "$arch" == "x86_64" ]
       then
        cp -f pacman.conf_kdemod3 /etc/pacman.conf
       else
        cp -f pacman.conf_kdemod3.x32 /etc/pacman.conf 
    fi
    pacman -Sy --noconfirm --needed kdemod3 
    pacman -S --noconfirm --needed kdemod3-kdeutils-superkaramba amarok kdemod3-kdegraphics-ksnapshot
    cp -f locale.gen /etc/locale.gen
    locale-gen 
    cp -f rc.conf_kdemod3 /etc/rc.conf
    cp -Rf Autostart /home/$user/.kde/
    #cd kdesudo-2.6
    #./configure 
    #needs QT >=3.1 but <4.0
    #make -s 
    #make -s install
    #mv /opt/kde/bin/kdesu /opt/kde/bin/kdesu1
    #ln -s /opt/kde/bin/kdesudo /opt/kde/bin/kdesu
else 
    echo
    echo "::Installing KDEmod 4..."
    if [ "$arch" == "x86_64" ]
       then
        cp -f pacman.conf_kdemod4 /etc/pacman.conf
       else
        cp -f pacman.conf_kdemod4.x32 /etc/pacman.conf 
    fi
    pacman -Syy --noconfirm --needed kdemod kdemod-kdeutils-superkaramba kdemod-kdebase-kwrite amarok-base
    cp -f locale.gen /etc/locale.gen
    locale-gen 
    cp -f rc.conf_kdemod4 /etc/rc.conf
    cp -Rf Autostart /home/$user/.kde4/
fi

#echo
#/etc/rc.d/hal start

if [ "$arch" == "x86_64" ]
 then
  #installing 32bit chroot environment
  mkdir /opt/arch32
  cd /etc/pacman.d
  mv mirrorlist mirrorlist.x64
  cp $ialocation/mirrorlist.x32 mirrorlist
  pacman --root /opt/arch32 --cachedir /opt/arch32/var/cache/pacman/pkg -Sy --needed base base-devel schroot ttf-bitstream-vera ttf-ms-fonts
  mv -f mirrorlist.x64 mirrorlist
  cd /opt/arch32/etc
  ln -f /etc/passwd*  .
  ln -f /etc/shadow*  .
  ln -f /etc/group*   .
  ln -f /etc/rc.conf  .
  ln -f /etc/resolv.conf  .
  ln -f /etc/localtime    .
  ln -f /etc/locale.gen   .
  ln -f /etc/profile.d/locale.sh profile.d
  cp /etc/vimrc .
  cp /etc/mtab  .
  cd $ialocation
fi


#installing other stuff
echo
echo "::Installing firefox, thunderbird, yakuake, etc..."
pacman -S --noconfirm --needed firefox thunderbird libdvdcss kdemod3-yakuake ktorrent pidgin jre shaman samba flashplugin lm_sensors gdb libsexy cups filelight
pacman -S --noconfirm --needed compiz-fusion-kde

echo
echo "::Installing and Configuring Samba"
pacman -S --noconfirm --needed samba
cp smb.conf /etc/samba/smb.conf
smbpasswd -a $user
pacman -Rd --noconfirm --needed fam
pacman -S --noconfirm --needed gamin


#customizing
cp bashrc /home/$user/.bashrc
mkdir /home/$user/Desktop
cp -f Desktop/* /home/$user/Desktop/
cp -Rf emerald /home/$user/.emerald
mkdir -p /home/$user/.config/compiz
chown $user:$user /home/$user/.config/compiz
cp bashrc /root/.bashrc
echo

chown -R $user:$user /home/$user/

read -p "Press Enter to reboot"
reboot

Install Arch Archive

Last edited by brando56894 (2009-05-17 02:38:40)

Offline

#4 2009-05-17 06:34:31

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

Re: Part 2 Install Script

Have a look at AIF's automatic procedure, it's easier to just write a config for that.
(example: http://projects.archlinux.org/?p=aif.gi … 2a0bc85570 )


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

Offline

#5 2009-05-18 06:55:31

brando56894
Member
From: NYC
Registered: 2008-08-03
Posts: 681

Re: Part 2 Install Script

is that for the installation of the base system (aka stage one?) and how do I implement it and is there a document on how to write one of these configs?

the script that I wrote may be overly complex and unneeded but it gives me something to work on when Im bored, something that I can learn with, an easy way to install everything that I want and something to show off to people wink

Offline

#6 2009-05-18 07:40:03

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

Re: Part 2 Install Script

brando56894 wrote:

is that for the installation of the base system (aka stage one?) and how do I implement it and is there a document on how to write one of these configs?

the script that I wrote may be overly complex and unneeded but it gives me something to work on when Im bored, something that I can learn with, an easy way to install everything that I want and something to show off to people wink

yes.  there is a readme and a sample config file...


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

Offline

Board footer

Powered by FluxBB