Advertisement
adnan360

install.sh / Parabola installation hck for Parabola GNOME

Sep 12th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 6.17 KB | None | 0 0
  1. #!/bin/bash
  2. #Temporal is a file that contains parameters to use when access to chroot
  3.  
  4. pacman -Sy parabola-keyring --noconfirm
  5. pacman-key --populate parabola
  6. pacman-key --refresh-keys
  7.  
  8. partition(){
  9.    
  10.     #Search and show the Hard Disks to select
  11.     aux=$(ls /dev/sd?)
  12.     index=0
  13.     for i in $aux; do
  14.         hdds[$index]="${i} ${i#/*/} off"
  15.         index=$((index+1)) 
  16.     done
  17.  
  18.     hdd=$(dialog --stdout --radiolist "Select Hard Disk" 20 70 50 ${hdds[@]})
  19.        
  20.     #If exist the line delete
  21.     if (cat ~/.scriptsInstallation/temporal | grep "hdd=") &>/dev/null
  22.     then
  23.         sed -i -e '/hdd=*/d' ~/.scriptsInstallation/temporal
  24.     fi
  25.  
  26.     #And add the new line with new parameter
  27.     echo "hdd=$hdd" >> ~/.scriptsInstallation/temporal
  28.    
  29.     selection=$(dialog --stdout --menu "Partitioning method"  20 70 50 \
  30.             1 "Use all disk with swap (1GB) and /" \
  31.             2 "Use gparted to customize" )
  32.  
  33.     case $selection in
  34.         1)
  35.             umount /mnt &> /dev/null
  36.             #Create msdos partition table
  37.             parted -s $hdd -- mklabel msdos
  38.  
  39.             #Create partition swap and /
  40.             parted -s $hdd -- mkpart primary 1MiB 1000MiB mkpart primary 1000MiB -1s
  41.                        
  42.                         #Boot option partition /
  43.                         parted -s $hdd -- set 2 boot on
  44.  
  45.             #Format and partitions and mount /
  46.             (echo t; echo 1; echo 82; echo w) | fdisk $hdd
  47.             mkswap ${hdd}1
  48.             mkfs.ext4 ${hdd}2
  49.             mount ${hdd}2 /mnt
  50.             ;;
  51.         2) 
  52.             gparted $hdd
  53.  
  54.             #Search and show the partitions that select before.
  55.             aux=$(ls $hdd?)
  56.             index=0;
  57.             for i in $aux; do
  58.                 partitions[$index]="${i} ${i#/*/} off"
  59.                 index=$((index+1))
  60.             done
  61.  
  62.             partition=$(dialog --stdout --radiolist "Mount / Partition" 20 70 50 ${partitions[@]})
  63.    
  64.             #Mount partition /
  65.             umount /mnt &> /dev/null
  66.             mount $partition /mnt
  67.  
  68.             #Ask if you want mount other partitions
  69.             other=0
  70.             while [ $other != 3 ]; do
  71.                 other=$(dialog --stdout --menu "Mount other partition?" 20 70 50 1 "/home" 2 "/boot" 3 "No")
  72.    
  73.                 case $other in
  74.                 1)
  75.                     umount /mnt/home &> /dev/null
  76.                     mkdir /mnt/home &> /dev/null
  77.                     mount $(dialog --stdout --radiolist "Mount /home Partition" 20 70 50 ${partitions[@]}) /mnt/home
  78.                     ;;
  79.                 2)
  80.                     umount /mnt/boot &> /dev/null  
  81.                     mkdir /mnt/boot &> /dev/null
  82.                     mount $(dialog --stdout --radiolist "Mount /boot Partition" 20 70 50 ${partitions[@]}) /mnt/boot
  83.                     ;;
  84.                 *) 
  85.                     other=3
  86.                     ;;
  87.                 esac
  88.             done
  89.             ;;
  90.         esac   
  91. }
  92.  
  93.  
  94. option=0
  95. while [ option != 7 ]; do
  96.     option=$(dialog --stdout --menu "Parabola Installation CLI"  20 70 50 \
  97.             1 "Format and Mount Partitions" \
  98.             2 "Install Base System" \
  99.             3 "Install GRUB" \
  100.             4 "System Configure" \
  101.             5 "(Optional) Install Live DVD Desktop/Applications" \
  102.             6 "Create User Account" \
  103.             7 "Exit" )
  104.  
  105.     case $option in
  106.         1)
  107.             partition
  108.             ;;
  109.         2) 
  110.             #Install base system
  111.             pacstrap /mnt
  112.             pacstrap /mnt dialog
  113.             ;;
  114.         3)
  115.             #Install grub
  116.             pacstrap /mnt grub grub2-theme-gnuaxiom
  117.             #Enable Parabola theme for grub
  118.             sed -i 's|[#]GRUB_THEME=["]/path/to/gfxtheme["]|GRUB_THEME="/boot/grub/themes/GNUAxiom/theme.txt"|' /mnt/etc/default/grub
  119.             ;;
  120.         4)
  121.             #Generate fstab and acces to chroot to do System Config
  122.             genfstab -p /mnt >> /mnt/etc/fstab
  123.             cp ~/.scriptsInstallation/temporal /mnt
  124.             cp ~/.scriptsInstallation/systemConfig.sh /mnt
  125.             chmod +x /mnt/systemConfig.sh
  126.             arch-chroot /mnt /systemConfig.sh
  127.             rm -r /mnt/systemConfig.sh  
  128.             ;;
  129.         5)
  130.             #Packages to the X11 live
  131.             packages=(  "xorg-server"
  132.                     "xf86-input-evdev"
  133.                     "xf86-input-synaptics"
  134.                     "xf86-video-vesa"
  135.                     "xf86-video-intel"
  136.                     "xf86-video-nouveau"
  137.                     "xf86-video-ati"
  138.                     "xf86-video-apm"
  139.                     "xf86-video-ark"
  140.                     "xf86-video-chips"
  141.                     "xf86-video-dummy"
  142.                     "xf86-video-fbdev"
  143.                     "xf86-video-glint"
  144.                     "xf86-video-i128"
  145.                     "xf86-video-i740"
  146.                     "xf86-video-intel"
  147.                     "xf86-video-mach64"
  148.                     "xf86-video-neomagic"
  149.                     "xf86-video-nv"
  150.                     "xf86-video-openchrome"
  151.                     "xf86-video-r128"
  152.                     "xf86-video-rendition"
  153.                     "xf86-video-s3"
  154.                     "xf86-video-s3virge"
  155.                     "xf86-video-savage"
  156.                     "xf86-video-siliconmotion"
  157.                     "xf86-video-sis"
  158.                     "xf86-video-sisusb"
  159.                     "xf86-video-tdfx"
  160.                     "xf86-video-trident"
  161.                     "xf86-video-tseng"
  162.                     "xf86-video-vmware"
  163.                     "xf86-video-voodoo"
  164.                     "xorg-xinit"
  165.                     "sudo"
  166.                     "gst-plugins-good"
  167.                     "gst-libav"
  168.                     "octopi"
  169.                     "octopi-cachecleaner"
  170.                     "octopi-notifier"
  171.                     "octopi-repoeditor"
  172.                     "ambiance-radiance-colors-suite"
  173.                     "rave-x-colors"
  174.                     "pulseaudio-alsa"
  175.                     "alsa-utils"
  176.                     "networkmanager"
  177.                     "network-manager-applet"
  178.                     "ath9k-htc-firmware"
  179.                     "gnome-keyring"
  180.                     "iceweasel"
  181.                     "gparted"
  182.                     "leafpad"
  183.                     "grub2-theme-gnuaxiom"
  184.                     "p7zip"
  185.                     "unar"
  186.                     "unzip"
  187.                     "zip"
  188.                     "gnome-shell"
  189.                     "gdm"
  190.                     )
  191.            
  192.             #Install packages          
  193.             pacstrap /mnt ${packages[@]}
  194.             user=$(cat ~/.scriptsInstallation/temporal | grep "userName" )
  195.            
  196.             #Copy skel in the new system and desktop's background
  197.             cp -a /etc/skel/ /mnt/etc/
  198.             cp -a /etc/wallpaper.png /mnt/etc/wallpaper.png
  199.  
  200.             #Uncomment to allow members of group wheel to execute any command
  201.             sed -i 's|[#] [%]wheel ALL=[(]ALL[)] ALL|%wheel ALL=(ALL) ALL|' /mnt/etc/sudoers
  202.  
  203.             #Enable services
  204.             cp -a ~/.scriptsInstallation/x11.sh /mnt
  205.  
  206.             #Enable services with systemd
  207.             chmod +x /mnt/x11.sh
  208.             arch-chroot /mnt /x11.sh
  209.             rm /mnt/x11.sh
  210.             ;;
  211.         6) 
  212.             #Create a new username and save in temporal, to use after
  213.             if (cat ~/.scriptsInstallation/temporal | grep "userName=") &>/dev/null
  214.             then   
  215.                 sed -i -e '/userName=*/d' ~/.scriptsInstallation/temporal
  216.             fi
  217.  
  218.             echo "userName=$(dialog --stdout --inputbox "Enter an User Name" 8 40)" >> ~/.scriptsInstallation/temporal
  219.             cp ~/.codecheck /mnt
  220.             cp ~/.scriptsInstallation/temporal /mnt
  221.             cp ~/.scriptsInstallation/userAccount.sh /mnt
  222.             chmod +x /mnt/userAccount.sh
  223.             arch-chroot /mnt /userAccount.sh
  224.             rm -r /mnt/userAccount.sh
  225.             ;;
  226.         *)
  227.             #Delete temporal file and umount partitions
  228.             rm -r /mnt/.codecheck
  229.             rm -r /mnt/temporal
  230.             umount /mnt/boot &> /dev/null
  231.             umount /mnt/home &> /dev/null
  232.             umount /mnt &> /dev/null       
  233.             exit
  234.             ;;
  235.     esac
  236. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement