You are not logged in.
Here's a little (actually, fairly large) script I wrote for post installation things such as:
- Selecting a mirror
- Installing X
- Installing misc. things (keyboard, mouse, touchpad)
- Installing video card
- Configuring X
- Installing/configuring a DE
- Installing/configuring a WM
- Installing a web browser
- Installing an AUR helper
The code is really crappy, sorry. Bash is not my forte, and all it really is is a bunch if scattered functions. All I know is that it works
#!/bin/bash
clear
# Define text colors
txtwhite='\e[0;37m' # White
txtgreen='\e[0;32m' # Green
txtyellow='\e[0;33m' # Yellow
txtred='\e[0;31m' # Red
function txt {
echo -e "${txtwhite}"
}
# Check if the user is root
if [ "$(id -u)" != "0" ]; then
echo -e "${txtred}This script must be run as root" 1>&2
txt
exit 1
fi
echo -e "${txtyellow}Welcome to the Arch Linux beginner configuration script"
echo -e "${txtyellow}You will be guided through the process of post-installation configuration"
txt
echo -e "${txtgreen}You must uncomment a server line in /etc/pacman.d/mirrorlist"
echo -e "${txtgreen}To do this, remove the # from the beginning of a line. To exit nano, hit Ctrl+X"
txt
sleep 5
nano /etc/pacman.d/mirrorlist
if [ -f /var/lib/pacman/db.lck ]; then
echo -e "${txtgreen}Removing database lock..."
txt
rm /var/lib/pacman/db.lck
fi
# Run an update
echo -e "${txtgreen}Running system upgrade..."
txt
pacman -Syu
clear
# Add a user
function user_add {
echo -en "${txtgreen}"
read -p "Would you like to create an initial user? [y/n] " -e answer
if [ $answer == "y" ]; then
echo -en "Entering the ${txtyellow}adduser${txtgreen} program..."
txt
adduser
elif [ $answer == "n" ]; then
return
else
echo -e "${txtred}Incorrect option"
user_add
fi
}
user_add
clear
# AUR Helper
function aur_config {
echo -en "${txtgreen}"
read -p "Which of the following AUR helpers would you like to install? [yaourt/packer/clyde/none] " -e answer
if [ $answer == "yaourt" ]; then
if [ ! -e /usr/bin/wget ]; then
pacman -S wget
fi
echo -en "Downloading package-query tarball..."
wget http://aur.archlinux.org/packages/package-query/package-query.tar.gz
tar xvf package-query.tar.gz
cd package-query
echo -en "Building package..."
makepkg -s --asroot
pacman -U package-query*.pkg.tar.xz
cd .. && rm -r package-query
echo -en "Downloading yaourt tarball..."
wget http://aur.archlinux.org/packages/yaourt/yaourt.tar.gz &> /dev/null
tar xvf yaourt.tar.gz
cd yaourt
echo -en "Building package..."
makepkg -s --asroot
pacman -U yaourt*.pkg.tar.xz
cd .. && rm -r yaourt
aur_helper="yaourt"
elif [ $answer == "packer" ]; then
if [ ! -e /usr/bin/wget ]; then
pacman -S wget
fi
echo -en "Downloading packer tarball..."
wget http://aur.archlinux.org/packages/packer/packer.tar.gz
tar xvf packer.tar.gz
cd packer
echo -en "Building package..."
makepkg -s --asroot
pacman -U packer*.pkg.tar.xz
cd .. && rm -r packer
aur_helper="packer"
elif [ $answer == "clyde" ]; then
if [ ! -e /usr/bin/wget ]; then
pacman -S wget
fi
echo -en "Downloading clyde tarball..."
wget http://aur.archlinux.org/packages/clyde-git/clyde-git.tar.gz
tar xvf clyde-git.tar.gz
cd clyde-git
echo -en "Building package..."
makepkg -s --asroot
pacman -U clyde*.pkg.tar.xz
cd .. && rm -r clyde-git
aur_helper="clyde"
elif [ $answer == "none" ]; then
aur_helper="none"
return
else
echo -e "${txtred}Incorrect option"
aur_config
fi
}
aur_config
clear
# Install X
function x_install {
echo -en "${txtgreen}"
read -p "Would you like to install and setup X? [y/n] " -e answer
if [ $answer == "y" ]; then
echo -en "Installing X via pacman..."
txt
pacman -S xorg
elif [ $answer == "n" ]; then
clear
echo -e "${txtgreen}Arch Linux config complete"
txt
exit
else
echo -e "${txtred}Incorrect option"
x_install
fi
}
x_install
clear
# Keyboard
function keyboard_install {
echo -en "${txtgreen}"
read -p "Will you be using a keyboard? [y/n] " -e answer
if [ $answer == "y" ]; then
echo -en "Installing keyboard driver via pacman..."
txt
pacman -S xf86-input-keyboard
elif [ $answer == "n" ]; then
return
else
echo -e "${txtred}Incorrect option"
keyboard_install
fi
}
keyboard_install
clear
# Touchpad
function synaptics_install {
echo -en "${txtgreen}"
read -p "Will you be using a laptop touchpad? [y/n] " -e answer
if [ $answer == "y" ]; then
echo -en "Installing touchpad driver via pacman..."
txt
pacman -S xf86-input-synaptics
elif [ $answer == "n" ]; then
return
else
echo -e "${txtred}Incorrect option"
synaptics_install
fi
}
synaptics_install
clear
# Mouse
function mouse_install {
echo -en "${txtgreen}"
read -p "Will you be using a mouse? [y/n] " -e answer
if [ $answer == "y" ]; then
echo -en "Installing mouse driver via pacman..."
txt
pacman -S xf86-input-mouse
elif [ $answer == "n" ]; then
return
else
echo -e "${txtred}Incorrect option"
mouse_install
fi
}
mouse_install
clear
function ati_install {
echo -en "${txtgreen}"
echo "NOTE: ati fits most cards and radeonhd is for r500/r600 cards"
read -p "Which of the following would you like to use? [ati/radeonhd/none] " -e answer
if [ $answer == "ati" ]; then
echo -en "Installing ATI driver via pacman..."
txt
pacman -S xf86-video-ati
elif [ $answer == "radeonhd" ]; then
echo -en "Installing ATI radeonhd driver via pacman..."
txt
pacman -S xf86-video-radeonhd
elif [ $answer == "none" ]; then
return
else
echo -e "${txtred}Incorrect option"
ati_install
fi
}
function nvidia_install {
echo -en "${txtgreen}"
echo "NOTE: nouveau is open source. You must add nouveau to the MODULES array in /etc/rc.conf"
read -p "Which of the following would you like to use? [nouveau/none] " -e answer
if [ $answer == "nouveau" ]; then
echo -en "Installing nVidia nouveau driver via pacman..."
txt
pacman -S xf86-video-nouveau
elif [ $answer == "none" ]; then
return
else
echo -e "${txtred}Incorrect option"
nvidia_install
fi
}
# Video card
function video_install {
echo -en "${txtgreen}"
read -p "Which brand of video card do you have installed in this PC? [ati/intel/nvidia/all/none] " -e answer
if [ $answer == "ati" ]; then
clear
ati_install
txt
elif [ $answer == "nvidia" ]; then
clear
nvidia_install
txt
elif [ $answer == "intel" ]; then
pacman -S xf86-video-intel
txt
elif [ $answer == "all" ]; then
clear
ati_install
nvidia_install
pacman -S xf86-video-intel
txt
elif [ $answer == "none" ]; then
return
else
echo -e "${txtred}Incorrect option"
video_install
fi
}
video_install
clear
# X user config
function x_user_config {
echo -en "${txtgreen}"
read -p "(If applicable) Enter the username of your previously created user [your username/none] " -e user
if [ $user == "none" ]; then
return
elif [ $user == "" ]; then
echo -e "${txtred}Incorrect option"
x_user_config
elif [ $user == " " ]; then
echo -e "${txtred}Incorrect option"
x_user_config
else
echo -e "#!/bin/sh\n" >> /home/$user/.xinitrc
chmod 755 /home/$user/.xinitrc
fi
}
x_user_config
clear
# Configure X
function x_config {
echo -en "${txtgreen}"
read -p "Would you like to automatically configure X (recommended)? [y/n] " -e answer
if [ $answer == "y" ]; then
echo -en "Automatically configuring X..."
txt
X -configure &> /dev/null
cp /root/xorg.conf.new /etc/X11/xorg.conf
echo -e "#!/bin/sh\n" >> /root/.xinitrc
chmod +x /root/.xinitrc
elif [ $answer == "n" ]; then
return
else
echo -ue "${txtred}Incorrect option"
x_config
fi
}
x_config
clear
# Desktop environment
function de_config {
echo -en "${txtgreen}"
read -p "Which desktop environment would you like to install? [gnome/kde/xfce/none] " -e answer
if [ $answer == "gnome" ]; then
echo -en "Installing gnome via pacman..."
txt
pacman -S gnome
echo "exec gnome-session" >> /root/.xinitrc
if [ $user != "none" ]; then
echo "exec gnome-session" >> /home/$user/.xinitrc
fi
elif [ $answer == "kde" ]; then
echo -en "Installing kde via pacman..."
txt
pacman -S kde
echo "exec startkde" >> /root/.xinitrc
if [ $user != "none" ]; then
echo "exec startkde" >> /home/$user/.xinitrc
fi
elif [ $answer == "xfce" ]; then
echo -en "Installing xfce4 via pacman..."
txt
pacman -S xfce4
echo "exec ck-launch-session startxfce4" >> /root/.xinitrc
if [ $user != "none" ]; then
echo "exec ck-launch-session startxfce4" >> /home/$user/.xinitrc
fi
elif [ $answer == "none" ]; then
return
else
echo -ue "${txtred}Incorrect option"
de_config
fi
}
de_config
clear
# Window manager
function wm_config {
echo -en "${txtgreen}"
read -p "Which window manager would you like to install? [awesome/dwm/evilwm/enlightenment/fluxbox/i3/jwm/musca/openbox/pekwm/pawm/ratpoison/sawfish/scrotwm/xmonad/wmii/none] " -e answer
if [ $answer == "awesome" ]; then
echo -en "Installing awesome via pacman..."
txt
pacman -S awesome
echo "exec awesome" >> /root/.xinitrc
mkdir -p /root/.config/awesome/
cp /etc/xdg/awesome/rc.lua /root/.config/awesome
if [ $user != "none" ]; then
echo "exec awesome" >> /home/$user/.xinitrc
mkdir -p /home/$user/.config/awesome/
cp /etc/xdg/awesome/rc.lua /home/$user/.config/awesome
fi
elif [ $answer == "dwm" ]; then
echo -en "Installing dwm via pacman..."
txt
pacman -S dwm dmenu
echo "exec dwm" >> /root/.xinitrc
if [ $user != "none" ]; then
echo "exec dwm" >> /home/$user/.xinitrc
fi
elif [ $answer == "evilwm" ]; then
echo -en "Installing evilwm via pacman..."
txt
pacman -S evilwm
echo "exec evilwm" >> /root/.xinitrc
if [ $user != "none" ]; then
echo "exec evilwm" >> /home/$user/.xinitrc
fi
elif [ $answer == "enlightenmnt" ]; then
echo -en "Installing enlightenment via pacman..."
txt
pacman -S enlightenment
echo "exec enlightenment" >> /root/.xinitrc
if [ $user != "none" ]; then
echo "exec enlightenment" >> /home/$user/.xinitrc
fi
elif [ $answer == "fluxbox" ]; then
echo -en "Installing enlightenment via pacman..."
txt
pacman -S fluxbox
echo "exec startfluxbox" >> /root/.xinitrc
if [ $user != "none" ]; then
echo "exec startfluxbox" >> /home/$user/.xinitrc
fi
elif [ $answer == "i3" ]; then
echo -en "Installing i3 via pacman..."
txt
pacman -S fluxbox
echo "exec i3" >> /root/.xinitrc
if [ $user != "none" ]; then
echo "exec i3" >> /home/$user/.xinitrc
fi
elif [ $answer == "jwm" ]; then
echo -en "Installing jwm via pacman..."
txt
pacman -S jwm
echo "exec jwm" >> /root/.xinitrc
if [ $user != "none" ]; then
echo "exec jwm" >> /home/$user/.xinitrc
fi
elif [ $answer == "openbox" ]; then
echo -en "Installing openbox via pacman..."
txt
pacman -S openbox
echo "exec openbox-session" >> /root/.xinitrc
mkdir -p /root/.config/openbox/
cp /etc/xdg/openbox/rc.xml /root/.config/openbox/rc.xml
cp /etc/xdg/openbox/menu.xml /root/.config/openbox/menu.xml
if [ $user != "none" ]; then
echo "exec openbox-session" >> /home/$user/.xinitrc
mkdir -p /home/$user/.config/openbox/
cp /etc/xdg/openbox/rc.xml /home/$user/.config/openbox/rc.xml
cp /etc/xdg/openbox/menu.xml /home/$user/.config/openbox/menu.xml
chmod -R 755 /home/$user/.config/openbox/
fi
elif [ $answer == "pekwm" ]; then
echo -en "Installing pekwm via pacman..."
txt
pacman -S pekwm
echo "exec pekwm" >> /root/.xinitrc
if [ $user != "none" ]; then
echo "exec pekwm" >> /home/$user/.xinitrc
fi
elif [ $answer == "pawm" ]; then
echo -en "Installing pawm via pacman..."
txt
pacman -S pawm
echo "exec pawm" >> /root/.xinitrc
if [ $user != "none" ]; then
echo "exec pawm" >> /home/$user/.xinitrc
fi
elif [ $answer == "ratpoison" ]; then
echo -en "Installing ratpoison via pacman..."
txt
pacman -S ratpoison
echo "exec ratpoison" >> /root/.xinitrc
if [ $user != "none" ]; then
echo "exec ratpoison" >> /home/$user/.xinitrc
fi
elif [ $answer == "sawfish" ]; then
echo -en "Installing sawfish via pacman..."
txt
pacman -S sawfish
echo "exec sawfish" >> /root/.xinitrc
if [ $user != "none" ]; then
echo "exec sawfish" >> /home/$user/.xinitrc
fi
elif [ $answer == "scrotwm" ]; then
echo -en "Installing scrotwm via pacman..."
txt
pacman -S scrotwm dmenu
echo "exec scrotwm" >> /root/.xinitrc
if [ $user != "none" ]; then
echo "exec scrotwm" >> /home/$user/.xinitrc
fi
elif [ $answer == "xmonad" ]; then
echo -en "Installing xmonad via pacman..."
txt
pacman -S xmonad
echo "exec xmonad" >> /root/.xinitrc
if [ $user != "none" ]; then
echo "exec xmonad" >> /home/$user/.xinitrc
fi
elif [ $answer == "wmii" ]; then
echo -en "Installing wmii via pacman..."
txt
pacman -S wmii
echo "exec wmii" >> /root/.xinitrc
if [ $user != "none" ]; then
echo "exec wmii" >> /home/$user/.xinitrc
fi
elif [ $answer == "musca" ]; then
if [ $aur_helper == "none" ]; then
echo -e "${txtred}You must have an AUR helper to install musca"
txt
wm_config
fi
echo -en "Installing musca via $aur_helper"
$aur_helper -S musca
echo "exec musca" >> /root/.xinitrc
if [ $user != "none" ]; then
echo "exec musca" >> /home/$user/.xinitrc
fi
elif [ $answer == "none" ]; then
return
else
echo -ue "${txtred}Incorrect option"
de_config
fi
}
wm_config
clear
# Web Browser
function browser_config {
echo -en "${txtgreen}"
read -p "Which of the following web browsers would you like to install? [firefox/seamonkey/uzbl/jumanji/none] " -e answer
if [ $answer == "firefox" ]; then
echo -en "Installing firefox via pacman..."
txt
pacman -S firefox
elif [ $answer == "seamonkey" ]; then
echo -en "Installing seamonkey via pacman..."
txt
pacman -S seamonkey
elif [ $answer == "uzbl" ]; then
echo -en "Installing uzbl via pacman..."
txt
pacman -S uzbl-tabbed
elif [ $answer == "jumanji" ]; then
if [ $aur_helper == "none" ]; then
echo -e "${txtred}You must have an AUR helper to install jumanji"
txt
browser_config
fi
echo -en "Installing jumanji-git via $aur_helper..."
txt
$aur_helper -S jumanji-git
elif [ $answer == "none" ]; then
return
else
echo -ue "${txtred}Incorrect option"
browser_config
fi
}
browser_config
clear
echo -e "${txtgreen}Arch Linux config complete"
txt
exit
Hopefully some Arch-newbies can use this
I've rigorously tested it, so it should be fine. If I missed something, just mention it
EDIT 1: Fixed nvidia_install issue. Thanks ziv
EDIT 2: Added musca and jumanji, as well as move the AUR helpers to the beginning of the script. (Thanks Inxsible ). Had to remove aurget due to a problem with running it as root. Is there a workaround? I also removed unnecessary wget installs.
Last edited by cesura (2010-07-15 19:18:29)
Offline
You're a day too late, kiddo - I've just finished configuring my other Arch box.
Offline
You're a day too late, kiddo - I've just finished configuring my other Arch box.
Now I won't get the satisfaction of configuring karol's Arch box!
Offline
> Now I won't get the satisfaction
You mean 'the privilege', right?
Offline
> Now I won't get the satisfaction
You mean 'the privilege', right?
Oh, yes, sorry. I must have mistyped that
Offline
Haven't used it as my Arch installs are very very old. But I am sure it could help out some newbies. The only thing is, they should be aware enough and search for it and use it (which considering the threads i have seen from newbies is a hit and miss)
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
Haven't used it as my Arch installs are very very old. But I am sure it could help out some newbies. The only thing is, they should be aware enough and search for it and use it (which considering the threads i have seen from newbies is a hit and miss)
I suppose it could be included in the Beginner's Guide
EDIT: Even including it in there might not be enough as a select group of new users believe they are to good for the Beginner's Guide and skip right over it.
EDIT EDIT: Here's a small description I added to the Beginner's Guide. I was in a rush when I was typing it, so feel free to elaborate on what's there:
http://wiki.archlinux.org/index.php/Beg … on_methods
Last edited by cesura (2010-07-15 04:31:03)
Offline
> I suppose it could be included in the Beginner's Guide
Aaaaaaaand?
> EDIT: Even including it in there (...)
Bingo!
Offline
> I suppose it could be included in the Beginner's Guide
Aaaaaaaand?> EDIT: Even including it in there (...)
Bingo!
I think I'm on sleep deprivation as well
Edited because I fail at typing
Last edited by cesura (2010-07-15 05:12:40)
Offline
function nvidia_install {
echo -en "${txtgreen}"
echo "NOTE: nouveau is open source. You must add nouveau to the MODULES array in /etc/rc.conf"
read -p "Which of the following would you like to use? [nouveau/none] " -e answer
if [ $answer == "ati" ]; then
echo -en "Installing nVidia nouveau driver via pacman..."
txt
pacman -S xf86-video-nouveau
elif [ $answer == "none" ]; then
return
else
echo -e "${txtred}Incorrect option"
nvidia_install
fi
}
You should probably change "ati" to "nouveau".
Offline
You should probably change "ati" to "nouveau".
Nice catch ziv.
Also, brad, If you give them the option of installing the aur helper earlier, then you could possibly include more wms like musca (nudge* nudge*) or browsers like jumanji etc
Last edited by Inxsible (2010-07-15 07:17:43)
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
Also, brad, If you give them the option of installing the aur helper earlier, then you could possibly include more wms like musca (nudge* nudge*) or browsers like jumanji etc
Sounds good to me. I'll do that and repost it.
Nice one ziv I'll change the first post and fix that.
Offline
Offline
ugh. you can do this much simpler and cleaner by plugging into AIF.
< Daenyth> and he works prolifically
4 8 15 16 23 42
Offline