Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #-------------------------------------------------------------------------------
- #Created by Gary Perreault mailto: tuxhatlinuxdistro[at]gmail[dot]com
- #inspired by script that was created by user helmuthdu & Vincent0ne-
- #mailto: helmuthdu[at]gmail[dot]com
- #Contribution: flexiondotorg
- #mailto: Vincent[at]gmail[dot]com
- #-------------------------------------------------------------------------------
- #This program is free software: you can redistribute it and/or modify
- #it under the terms of the GNU General Public License as published by
- #the Free Software Foundation, either version 3 of the License, or
- #(at your option) any later version.
- #
- #This program is distributed in the hope that it will be useful,
- #but WITHOUT ANY WARRANTY; without even the implied warranty of
- #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- #GNU General Public License for more details.
- #
- #You should have received a copy of the GNU General Public License
- #along with this program. If not, see <http://www.gnu.org/licenses/>.
- #-------------------------------------------------------------------------------
- # Run this script after your first boot with archlinux (as root)
- #--------------------------------------------------------------------------------
- # Explaination of the Script: this is the script disk functions for the
- # arch-setup installer script.
- # Keep it simple!
- # What you see, is what you get!
- PS3="$prompt1"
- TMP=/tmp/tmp.$$
- TMP2=/tmp/tmp2.$$
- SELECTEDDSK="No Disk Selected: $DEV$DISK"
- SelectDisk() { #{{{
- print_line
- echo "Available Disks on Computer"
- echo
- lsblk | grep disk > $TMP
- printf "%-10s \t %-10s\n" 'Available Disk' 'Total Size'
- print_dbline
- awk '{printf "%-17s %-10s\n", $1, $4}' $TMP
- print_line
- echo
- echo "sda usually means whole disk so no partition"
- echo "number is required"
- echo
- echo "There is no need to put /dev on front as it is"
- echo "a default directory."
- echo
- echo -n "What Disk do you want to use: "
- read DISK
- echo "You selected $DEV$DISK"
- TASK1="${Bold}${White}[${Bold}${Green}X${Bold}${White}] is Set"
- echo
- rm $TMP
- pause_function
- } #}}}}
- PartitionDisks() { #{{{
- if [ "$DISK" != "NULL" ]
- then
- echo "What partition program to use on $DEV$DISK"
- echo
- echo "F - Fdisk"
- echo "C - Cfdisk"
- echo "P - Parted"
- echo
- print_askopt
- read PARTPROG
- case $PARTPROG in
- F|f)
- fdisk $DEV$DISK
- TASK2="${Bold}${White}[${Bold}${Green}X${Bold}${White}] is Set"
- ;;
- C|c)
- cfdisk $DEV$DISK
- TASK2="${Bold}${White}[${Bold}${Green}X${Bold}${White}] is Set"
- ;;
- P|p)
- parted $DEV$DISK
- TASK2="${Bold}${White}[${Bold}${Green}X${Bold}${White}] is Set"
- ;;
- esac
- else
- echo "No Disk is Selected, please select one"
- sleep 5
- fi
- pause_function
- } #}}}
- format_drive () {
- # Shows the Selected Disk and Partition
- lsblk | grep $Disk
- }
- cpisoskeltohd() {
- echo ""
- echo "${Green}Copying ISO Skel to HDD"
- time (cp -ax /{home,root} /mnt)
- cp -avr /opt /mnt
- TASK4="${Bold}${White}[${Bold}${Green}X${Bold}${White}] is Set"
- }
- install_bootloader() {
- syslinux-install_update -iam
- cp -v $SLCFGFILE $SLCFGFILE.orig
- cp -v $CVSPLASH /boot/syslinux
- sleep 1
- selectsyslinuxcfg
- }
- selectsyslinuxcfg(){
- ROOTDSK=`df / | sed '1d' | awk '{print $1}'`
- print_title0
- local cfgfiles=(`cat $SLTXT | sed 's/\/.*$//' | uniq`);
- print_line
- echo "${Bold}${Red}Select Syslinux cfg file that is right for your root disk${Reset}"
- print_line
- select SLCFG in "${cfgfiles[@]}"
- do
- if contains_element "$SLCFG" "${cfgfiles[@]}"
- then
- echo "cp -v $SLFILES/$SLCFG $SYSLINUXCFG"
- cp -v $SLFILES/$SLCFG $SLCFGFILE
- echo ""
- break
- else
- invalid_option
- fi
- done
- }
- network_interface(){
- ip link show
- pause_function
- read -p "dhcp-interface: " dhcpif
- dhcpif=`echo $dhcpif | tr '[:upper:]' '[:lower:]'`
- systemctl enable dhcpcd@${dhcpif}.service
- systemctl start dhcpcd@${dhcpif}.service
- }
- formatrootpart() {
- if [ "$DISK" != "NULL" ]
- then
- print_line
- lsblk |grep $DISK
- print_line
- echo
- echo "You can select the Non Swap partition as the chosen"
- echo "root drive, usually the 1st partition"
- echo
- echo -n "Partition name without the /dev: "
- read ROOTDISK
- print_line
- echo 1. Ext2
- echo 2. Ext3
- echo 3. Ext4
- echo 4. ReiserFS
- echo
- print_askopt
- read FSOPT
- case $FSOPT in
- 1)
- mkfs.ext2 $DEV$ROOTDISK
- ;;
- 2)
- mkfs.ext3 $DEV$ROOTDISK
- ;;
- 3)
- mkfs.ext4 $DEV$ROOTDISK
- ;;
- 4)
- mkfs.reiserfs $DEV$ROOTDISK
- ;;
- esac
- TASK3="${Bold}${White}[${Bold}${Green}X${Bold}${White}] is Set"
- echo Mounting $DEV$ROOTDISK to $MNT
- mount $DEV$ROOTDISK $MNT
- sleep 10
- else
- echo "You must select a disk"
- sleep 1
- fi
- }
Advertisement
Add Comment
Please, Sign In to add comment