LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-13-2015, 01:38 PM   #31
davholla
Member
 
Registered: Jun 2003
Location: London
Distribution: Linux Mint 13 Maya
Posts: 729

Original Poster
Rep: Reputation: 32

part2
Code:
## Display version, release, last git commit and git retrieval date of the script when asked: ##
#
#   ./bootinfoscript -v
#   ./bootinfoscript -V
#   ./bootinfoscript --version 

version () {
  printf '\nBoot Info Script version: %s\nRelease date:             %s' "${VERSION}" "${RELEASE_DATE}";

  if [ ! -z "${LAST_GIT_COMMIT_SHORTLOG}" ] ; then
     printf '\nLast git commit:          %s\nCommit date:              %s' \
            "${LAST_GIT_COMMIT_SHORTLOG}" "${LAST_GIT_COMMIT_DATE}";
  fi

  printf '\n\n';

  exit 0;
}



## Gzip a copy of the output file? ##
gzip_output=0;	 # off=0

## Write the output to the standard output instead of to a file? ##
stdout_output=0; # off=0



## Get arguments passed to the script. ##

process_args () {
  if [ ${#@} -ge 1 ] ; then
     # Process arguments.
     case "$1" in
	-g	  ) gzip_output=1; if [ ! -z "$2" ] ; then LogFile_cmd="$2"; fi;;
	--gzip	  ) gzip_output=1; if [ ! -z "$2" ] ; then LogFile_cmd="$2"; fi;;
	-h	  ) help;;
	-help	  ) help;;
	--help	  ) help;;
	--stdout  ) stdout_output=1;;
	--update  ) update "$2";;
	-v	  ) version;;
	-V	  ) version;;
	--version ) version;;
	-*	  ) help;;
	*	  ) LogFile_cmd="$1";;
     esac
  fi
}




## Get arguments passed to the script. ##

process_args ${@};



## Display version number, release and git retrieval date. ##

printf '\nBoot Info Script %s      [%s]' "${VERSION}" "${RELEASE_DATE}";

if [ ! -z "${LAST_GIT_COMMIT_SHORTLOG}" ] ; then
   printf '\n  Last git commit:         %s\n  Commit date:             %s' \
          "${LAST_GIT_COMMIT_SHORTLOG}" "${LAST_GIT_COMMIT_DATE}";
fi

printf '\n\n';



## Check whether Boot Info Script is run with root rights or not. ##

if [ $(type whoami > /dev/null 2>&1 ; echo $?) -ne 0 ] ; then
   echo 'Please install "whoami" and run Boot Info Script again.' >&2;
   exit 1;
elif [ $(whoami) != 'root' ] ; then
   cat <<- EOF >&2
	Please use "sudo" or become "root" to run this script.
	
	  Run the script as sudoer:
	
	    sudo ${0} <outputfile>
	
	  or if your operating system does not use sudo:
	
	    su -
	    ${0} <outputfile>

	For more info, see the help:

	    ${0} --help
	
	EOF
   exit 1;
fi
 
Old 12-13-2015, 01:39 PM   #32
davholla
Member
 
Registered: Jun 2003
Location: London
Distribution: Linux Mint 13 Maya
Posts: 729

Original Poster
Rep: Reputation: 32
Code:
## Check if all necessary programs are available. ##

# Programs that are in /bin or /usr/bin.
Programs='
	basename
	cat
	chown
	dd
	dirname
	expr
	fold
	grep
	gzip
	hexdump
	ls
	mkdir
	mktemp
	mount
	printf
	pwd
	rm
	sed
	sort
	tr
	umount
	wc'

# Programs that are in /usr/sbin or /sbin.
Programs_SBIN='
	blkid
	fdisk
	filefrag
	losetup'


Check_Prog=1;

for Program in ${Programs} ${Programs_SBIN}; do
  if [ $(type ${Program} > /dev/null 2>&1 ; echo $?) -ne 0 ] ; then
     echo "\"${Program}\" could not be found." >&2;
     Check_Prog=0;
  fi
done



## Can we decompress a LZMA stream? ##
#
#   The Grub2 (v1.99-2.00) core_dir string is contained in a LZMA stream.
#   See if we have xz or lzma installed to decompress the stream.
#

if [ $(type xz > /dev/null 2>&1 ; echo $?) -eq 0 ] ; then
   UNLZMA='xz --format=lzma --decompress';
elif [ $(type lzma > /dev/null 2>&1 ; echo $?) -eq 0 ] ; then
   UNLZMA='lzma -cd';
else
   UNLZMA='none';
fi



## Do we have gawk or (a recent) mawk? ##
#
#   If we don't have gawk, look for "mawk v1.3.4" or newer.
#

if [ $(type gawk > /dev/null 2>&1 ; echo $?) -eq 0 ] ; then
   # Set awk binary to gawk.
   AWK='gawk';
elif [ $(type mawk > /dev/null 2>&1 ; echo $?) -eq 0 ] ; then
   MAWK_version="$(mawk -W version 2>&1)";
   MAWK_version="${MAWK_version:0:10}";

   if [ "${MAWK_version}" = 'mawk 1.3.3' ]; then
      printf '"mawk v1.3.3" has known bugs.\nInstall "mawk v1.3.4" or newer from http://invisible-island.net/mawk/ or use "gawk" instead.\n' >&2;
	  Check_Prog=0;
   else
      # Set awk binary to mawk (version 1.3.4 or higher).
      AWK='mawk';
   fi
else
   printf 'Install "gawk" or "mawk v1.3.4" (or newer) from http://invisible-island.net/mawk/.\n' >&2;
   Check_Prog=0;
fi



if [ ${Check_Prog} -eq 0 ] ; then
   printf '\nPlease install the missing program(s) and run Boot Info Script again.\n' >&2;
   exit 1;
fi



## List of folders which might contain files used for chainloading. ##

Boot_Codes_Dir='
	/
	/NST/
	'
 
Old 12-13-2015, 01:42 PM   #33
davholla
Member
 
Registered: Jun 2003
Location: London
Distribution: Linux Mint 13 Maya
Posts: 729

Original Poster
Rep: Reputation: 32
Actually it is easier to put the output like that.
Attached Files
File Type: txt diskinfo.txt (38.3 KB, 15 views)
 
Old 12-13-2015, 03:21 PM   #34
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,444

Rep: Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474
The output of the df -h command you ran from the installed Kubuntu shows it is on sdb8. The new bootinfoscript shows vista on both sda3 and sdb3, don't know why sdb3 won't boot. Your grub.cfg shows sdb9 under set root but has the correct UUID for sdb8 and it boots. The /etc/fstab shows root was on /dev/sdb9 during install but the UUID is correct for sdb8 and it boots. What's your question?

Last edited by yancek; 12-13-2015 at 03:26 PM.
 
Old 12-13-2015, 03:30 PM   #35
davholla
Member
 
Registered: Jun 2003
Location: London
Distribution: Linux Mint 13 Maya
Posts: 729

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by yancek View Post
The output of the df -h command you ran from the installed Kubuntu shows it is on sdb8. The new bootinfoscript shows vista on both sda3 and sdb3, don't know why sdb3 won't boot. Your grub.cfg shows sdb9 under set root but has the correct UUID for sdb8 and it boots. The /etc/fstab shows root was on /dev/sdb9 during install but the UUID is correct for sdb8 and it boots. What's your question?
My question is how to I reallocate the space. I think (I will have to check and probably won't be able now until Wednesday) I now know how to. Although I am still a little nervous/unsure about how to do this

Last edited by davholla; 12-13-2015 at 03:32 PM.
 
Old 12-13-2015, 03:36 PM   #36
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
Quote:
Originally Posted by davholla View Post
My question is how to I reallocate the space. I think (I will have to check and probably won't be able now until Wednesday) I now know how to. Although I am still a little nervous/unsure about how to do this
As my craft teacher used to say "Measure twice, cut once." -- the reason for all these commands is to get a picture of your disk. Remember that you can't undo these changes and you can't expand a partition into space that's not next to it.
 
1 members found this post helpful.
Old 12-13-2015, 06:23 PM   #37
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,444

Rep: Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474
I gave you some options in post 28 but there are multiple possibilities. You need to make the decision on what you want and your are right to be nervous about it. Any time you are modifying your partition structure it will be a risk of loss of data. It would probably be best to do everything from a Live CD or flash drive with a Live Cd or else download and burn GParted to a CD and use that. The link below is to the GParted Manual which you could review before beginning as it covers deleting, formatting and creating new partitions as well as pretty much anything else a partition manager could be used for.

http://gparted.org/display-doc.php3Fname%3Dhelp-manual

Last edited by yancek; 12-13-2015 at 06:32 PM.
 
1 members found this post helpful.
Old 12-14-2015, 12:10 PM   #38
davholla
Member
 
Registered: Jun 2003
Location: London
Distribution: Linux Mint 13 Maya
Posts: 729

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by yancek View Post
I gave you some options in post 28 but there are multiple possibilities. You need to make the decision on what you want and your are right to be nervous about it. Any time you are modifying your partition structure it will be a risk of loss of data. It would probably be best to do everything from a Live CD or flash drive with a Live Cd or else download and burn GParted to a CD and use that. The link below is to the GParted Manual which you could review before beginning as it covers deleting, formatting and creating new partitions as well as pretty much anything else a partition manager could be used for.

http://gparted.org/display-doc.php3Fname%3Dhelp-manual
Thanks I will look that. I will use the live CD to do this
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
fdisk question matrixon Linux - Software 1 02-24-2006 11:35 AM
Fdisk question satimis Linux - General 3 12-24-2005 07:51 AM
Fdisk question OhSnapWhat Slackware 5 09-04-2005 10:13 AM
fdisk question digsby0007 Linux - Software 1 05-02-2004 02:09 PM
fdisk question endezeichen Linux - General 8 11-23-2003 09:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration