Guest User

setup script

a guest
May 22nd, 2010
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 5.94 KB | None | 0 0
  1. #!/bin/bash
  2. # ~/.bin/setup
  3. # run as root on a fresh system to install base and gui packages and create user
  4. echo -n "Is your network up and running? (y/n) "
  5.   if read -q; then
  6.     echo "Good. Proceeding."
  7.   else
  8.     echo "You'll need internet access."
  9.     echo "Please configure your network before calling this script again."
  10.     return 0
  11.   fi
  12.    
  13.   echo -n "Did you configure pacman.conf to include [archlinuxfr]? "
  14.   if read -q; then
  15.     echo "Good. Proceeding."
  16.   else
  17.     echo "Don't worry. I'll do it for you."
  18.     echo " " >> /etc/pacman.conf
  19.     echo "[archlinuxfr]" >> /etc/pacman.conf
  20.       if [[ `uname --machine` = i686 ]];then
  21.         echo "Server = http://repo.archlinux.fr/i686" >> /etc/pacman.conf
  22.     echo "Your pacman.conf is now updated to include the 32bit repository of archlinuxfr."
  23.       elif [[ `uname --machine` = x86_64 ]];then
  24.     echo "Server = http://repo.archlinux.fr/x86_64" >> /etc/pacman.conf
  25.     echo "Your pacman.conf is now updated to include the 64bit repository of archlinuxfr."
  26.       else
  27.     echo "Sorry, but i can't read the system architecture."
  28.     echo "Please configure pacman.conf manually."
  29.     echo "Exiting now."
  30.     return 0
  31.     fi
  32.   fi
  33.    
  34.   echo -n "Are you using a fast and up-to-date mirror? "
  35.   if read -q; then
  36.     echo "Good. Proceeding."
  37.       echo -n "Did you sync the mirrorlist yet? "
  38.       read answer
  39.       case "$answer" in
  40.         yes|y|'') echo "Good. Proceeding."
  41.           ;;
  42.     no|n)     echo "Okay. Let's do it now."
  43.                   pacman -Syy
  44.                   echo "Done. Proceeding with setup."
  45.           ;;
  46.       esac
  47.   else
  48.     echo "NP. Doing it for you. I may need input though."
  49.     echo "Checking if reflector is installed."
  50.     if [[ $(pacman -Qsl | grep -c reflector) = 0 ]];then
  51.       echo "Not installed. Downloading reflector."
  52.       pacman -Sy reflector
  53.     else
  54.       echo "Good. Reflector is installed."
  55.     fi
  56.     echo "Updating your mirrorlist now."
  57.     reflector -l 8 -r -o /etc/pacman.d/mirrorlist
  58.     pacman -Syy
  59.     echo "Your mirrorlist should now be updated."
  60.     echo "Proceeding."
  61.   fi
  62.  
  63.   echo -n "Download and install Base and GUI now? (base/both/none) "
  64.   read answer
  65.   case "$answer" in
  66.     both) echo "Both basic system and gui packages will now be installed and downloaded."
  67.           echo "No input needed for the next ~30 minutes. Go do some work."
  68.       pacman -S alsa-utils acpid pm-utils cpufrequtils nfs-utils rpcbind rsync tree  \
  69.             calc bc dosfstools ntfsprogs abs cups pmount samba openssh  ntfs-3g  \
  70.             autojump ethtool lm_sensors stress reflector yaourt          \
  71.             lzop unzip rar p7zip unrar zip xz-utils unace xclip xsel         \
  72.             ncmpc smartmontools beep zsh grc cowsay fortune-mod vim htop screen  \
  73.                     irssi wgetpaste scrot curl clamav powertop laptop-mode-tools slock   \
  74.             mpc moc imagemagick wol aumix-gtk mlocate                \
  75.             xorg xf86-input-evdev xf86-video-intel               \
  76.             openbox openbox-themes obconf obmenu tint2               \
  77.             gamin transset-df gxmessage xdg-user-dirs xcompmgr           \
  78.             ttf-dejavu ttf-ms-fonts ttf-bitstream-vera               \
  79.             terminal galculator gvim feh gmrun medit xarchiver epdfview      \
  80.             mirage conky sonata gmpc firefox thunderbird flashplugin vlc
  81.       echo "Delete libxft and cairo to replace them with lcd packages later on."
  82.       pacman -Rd libxft cairo          
  83.       echo "Some more packages from the AUR."
  84.       yaourt -S fortune-mod-tbbt fortune-mod-montypython fortune-mod-himym       \
  85.             fortune-mod-chucknorris zsh-lovers sleepd-git            \
  86.             fontconfig-lcd cairo-lcd pcmanfm-git clyde-git diffuse       \
  87.             aurvote firebrand thunderbrand abiword-light stiler
  88.       pacman -S libxft-lcd
  89.       ;;
  90.     base) echo "Only basic system packages will now be downloaded and installed."
  91.       echo "Downloading basic packages"
  92.       pacman -S alsa-utils acpid pm-utils cpufrequtils nfs-utils rpcbind rsync tree  \
  93.             calc bc dosfstools ntfsprogs abs cups pmount samba openssh  ntfs-3g  \
  94.             autojump ethtool lm_sensors stress reflector yaourt          \
  95.             lzop unzip rar p7zip unrar zip xz-utils unace xclip xsel         \
  96.             ncmpc smartmontools beep zsh grc cowsay fortune-mod vim htop screen  \
  97.                     irssi wgetpaste scrot curl clamav powertop laptop-mode-tools slock   \
  98.             mpc moc imagemagick wol aumix-gtk mlocate
  99.      echo "Some fun stuff from the AUR."
  100.      yaourt -S --aur fortune-mod-tbbt fortune-mod-montypython fortune-mod-himym  \
  101.             fortune-mod-chucknorris zsh-lovers sleepd-git clyde-git
  102.      ;;
  103.     none) echo "Skipping download and installation."
  104.      ;;
  105.   esac
  106.    
  107.   echo -n "Setup User now? "
  108.     if read -q; then
  109.       echo "Preparing to create user."
  110.         echo -n "Setup demian or slave? "
  111.     read answer
  112.     case "$answer" in
  113.       demian|d|1) echo "Proceeding for demian."
  114.               echo "Creating user demian, his password and some directories."
  115.               useradd -m -G users,audio,lp,optical,storage,video,wheel,power -s /bin/zsh demian
  116.               echo "Please specify a password:"
  117.               passwd demian
  118.               echo "Creating directories in /media:"
  119.               mkdir -v /media/share /media/daten
  120.               echo "Downloading some last packages:"
  121.               pacman -Sy yaourt
  122.               yaourt -S tp_smapi phc-intel netcfg wpa_actiond ifplugd slim
  123.               echo "System is installed and ready to configure."
  124.               ;;
  125.        slave|s|2) echo "Proceeding for slave."
  126.               echo "Creating user slave, his password and some directories"
  127.               useradd -m -G users,audio,lp,optical,storage,video,wheel,power -s /bin/zsh slave
  128.               echo "Please specify a password:"
  129.               passwd slave
  130.               echo "Creating directories in /media:"
  131.               mkdir -v /media/movies /media/music /media/series /media/share /media/usbhdd
  132.               echo "Downloading some last packages:"
  133.               pacman -Sy lighttpd fcgi php php-cgi mpd rtorrent yaourt
  134.               yaourt -S phc-intel eaccelerator
  135.               echo "System is installed and ready to configure."
  136.               ;;
  137.           esac
  138.   else
  139.     echo "Skipping user creation. Setup is done."
  140.   fi
Advertisement
Add Comment
Please, Sign In to add comment