Advertisement
Guest User

Arch AIF- Install with pre-determined partitions

a guest
Jul 23rd, 2012
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.25 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. SOURCE=net
  4. MIRROR=('http://mirrors.xmission.com/archlinux/${repo}/os/${arch}' 'http://locke.suu.edu/linux/dist/archlinux/${repo}/os/${arch}')
  5. SYNC_URL=${MIRROR}
  6. TARGET_REPOSITORIES=(core ${SYNC_URL} extra ${SYNC_URL} community ${SYNC_URL})
  7.  
  8. HARDWARECLOCK=UTC
  9. TIMEZONE=MST
  10. KEYMAP=dvorak
  11. RUNTIME_REPOSITORIES=
  12. RUNTIME_PACKAGES=
  13.  
  14. systemd='systemd systemd-arch-units systemd-sysvcompat'
  15. xorg='xorg-server xorg-xinit xorg-server-utils'
  16. python='python python2 pygtk'
  17. sysv='initscripts sysvinit'
  18. # add this in if you want to run in a vm
  19. virtualbox='virtualbox-archlinux-additions'
  20.  
  21. # packages to install
  22. TARGET_GROUPS='base gnome'
  23. TARGET_PACKAGES_EXCLUDE="nano reiserfsprogs epiphany ${sysv}"
  24. TARGET_PACKAGES="${systemd} ${xorg} ${python} gdm vim networkmanager iproute2 sudo"
  25.  
  26. grok_partitions () {
  27.     local root_found=
  28.     local partitions=
  29.     for label in `ls /dev/disk/by-label | grep "Arch"`
  30.     do
  31.         if [ ${label} == "Arch" ]
  32.         then
  33.             mount_point="/"
  34.             root_found=true
  35.         else
  36.             IFS="-" read base mount <<< "${label}"
  37.             mount_point="/${mount}"
  38.         fi
  39.  
  40.         local partition=$(readlink -f /dev/disk/by-label/${label})
  41.         local fs=$(blkid -s TYPE -o value "${partition}")
  42.         partitions+="${partition} raw ${label} ${fs};yes;${mount_point};target;no_opts;${label};no_params\n"
  43.     done
  44.  
  45.     if [ ! ${root_found} ]
  46.     then
  47.         echo "No mount point specified for /. Refusing to continue."
  48.         exit 1
  49.     fi
  50.  
  51.     # do the swap
  52.     if [ -e /dev/disk/by-label/swap ]
  53.     then
  54.         local partition=$(readlink -f /dev/disk/by-label/swap)
  55.         partitions+="${partition} raw swap swap;yes;no_mountpoint;target;no_opts;swap;no_params"
  56.     else
  57.         # if there's no labeled swap, use the first one we find
  58.         local partition=$(blkid -t TYPE="swap" -o device | head -1)
  59.         if [ ! -e ${partition} ]
  60.         then
  61.             echo "No swap detected. Giving up."
  62.             exit 1
  63.         fi
  64.         partitions+="${partition} raw no_label swap;yes;no_mountpoint;target;no_opts;no_label;no_params"
  65.     fi
  66.  
  67.     echo -n ${partitions}
  68. }
  69.  
  70. PART_ACCESS=
  71.  
  72. # These variables are mandatory
  73.  
  74. GRUB_DEVICE=/dev/sda
  75.  
  76. # empty partition table (we've already set them up)
  77. # there has to be something here or aif will complain
  78. PARTITIONS="invalid"
  79.  
  80. BLOCKDATA=$(grok_partitions)
  81. # you can optionally also override some functions...
  82. # This way you can change/extend/remove pretty much all functionality in AIF !
  83.  
  84. worker_intro () {
  85.     inform "The following partition setup will be used:"
  86.     echo -e ${BLOCKDATA}
  87.     inform "This is your last chance to abort. Install starting in 3 seconds."
  88.     sleep 3
  89. }
  90.  
  91. # don't partition, we already have our disks set up
  92. # this is basically the same as prepare_disks, but
  93. # it does not create the partitions
  94. worker_prepare_disks () {
  95.     if ! process_filesystems
  96.     then
  97.         show_warning 'Disk processing' "Could not process_filesystems"
  98.         txt='also failed to execute properly'
  99.         rollback_filesystems && txt='ended successfully'
  100.         die_error "Something failed while processing the filesystem. A rollback was executed, which $txt"
  101.     fi
  102. }
  103.  
  104. worker_configure_system () {
  105.     preconfigure_target
  106.  
  107.     # store systemd-specific settings
  108.     echo "archy" > "${var_TARGET_DIR}/etc/hostname"
  109.     echo "KEYMAP=dvorak" > "${var_TARGET_DIR}/etc/vconsole.conf"
  110.     echo "America/Boise" > "${var_TARGET_DIR}/etc/timezone"
  111.  
  112.     postconfigure_target
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement