Created
November 3, 2012 22:08
-
-
Save fsmithred/4009041 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # testlabels1 | |
| # Check that xserver is running and user is root. | |
| [[ $DISPLAY ]] || { echo "There is no xserver running. Exiting..." ; exit 1 ; } | |
| if [[ $(id -u) -ne 0 ]] ; then | |
| zenity --error --text="You need to be root!" | |
| exit 1 | |
| fi | |
| use_labels="yes" | |
| # This shows a list of labeled partitions with a partial device name. | |
| find /dev/disk/by-label/* -printf %f\\t\\t%l\\n | sed -e 's/..\///g' | zenity --text-info --width 300 --title "Disk Labels - for reference" | |
| # This shows a checklist of partitions from which to choose one. | |
| install_dev=$(find /dev -mindepth 1 -maxdepth 1 -name "*[sh]d[a-z][1-9]*" \ | |
| | sort | awk '{print "FALSE\n" $0 }' \ | |
| | zenity --list --title="Root Partition" --text="Choose a partition to use for the installation of the operating system." \ | |
| --radiolist --multiple --column ' ' --column 'Partitions' --height 380 --width 150) | |
| # Get the disk label for the chosen partition. | |
| rootfslabel=$(e2label $install_dev) | |
| echo "You chose $install_dev" | |
| if [[ -n $rootfslabel ]]; then | |
| echo "which is labeled $rootfslabel" | |
| fi | |
| # Create fstab (on screen) | |
| if [[ $use_labels = yes ]]; then | |
| install_part="LABEL=$rootfslabel" | |
| else | |
| install_part="$install_dev" | |
| fi | |
| echo -e "\n Creating /etc/fstab...\n" | |
| echo -e "proc\t\t/proc\tproc\tdefaults\t0\t0 | |
| /swapfile\tswap\tswap\tdefaults\t0\t0 | |
| $install_part\t/\t$fs_type_os\tdefaults,noatime\t0\t1" | |
| exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment