Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env
- clear
- ipCheckCount=0
- function CreateMountPointY(){
- if [ ! -d /mnt/y ]; then
- sudo mkdir /mnt/y
- fi
- sudo umount /mnt/y
- return 0
- }
- function DetectSubnetPrefix(){
- ipCheckCount+=
- GW=`route -n|tail -n1|awk '{ print $2 }'`
- subNetPrefix=""
- if [ ${GW:0:9} == "192.168.26" ]; then
- echo "You are in the test lab."
- subNetPrefix="192.168.26."
- else
- if [ ${GW:0:10} == "192.15.101" ]; then
- echo "You are live!"
- subNetPrefix="192.15.101."
- fi
- fi
- if [ $subNetPrefix == "" ]; then
- if [ $ipCheckCount -gt 10 ]; then
- Echo should have given up by now
- fi
- Sleep 5
- DetectSubnetPrefix
- fi
- }
- function MountYDrive(){
- sudo mount -t cifs //${subNetPrefix}31/results /mnt/y -o username=PEDriveMapper,password={removedforpastebin},dir_mode=0777,file_mode=0777
- }
- function CreateAndMountPartitions(){
- declare -a arrVol
- declare -a arrPar
- intVol=0
- intPar=0
- for i in $(ls -d /dev/sd*);
- do
- if [ ${#i} == 8 ]; then
- #echo intVol is $intVol
- arrVol[$intVol]=${i%%}
- intVol+=
- echo Found a volume: ${i:0:8}
- else
- #echo intPar is $intPar
- arrPar[$intPar]=${i%%}
- intPar+=
- echo Found a partition: ${i%%}
- fi
- done
- for i in "${arrPar[@]}"
- do
- echo Remove partition $i
- sudo umount $i
- sudo parted --s ${i:0:8} rm ${i##${i:0:8}}
- done
- strMountPoint=0
- for i in "${arrVol[@]}"
- do
- echo Create single large partition on $i
- echo sudo parted --s $i mkpart primary 0 -- -0
- sudo parted --s $i mkpart primary 0 -- -0
- echo sudo mkfs.ntfs -Q ${i}1
- sudo mkfs.ntfs -Q ${i}1
- echo Mount it
- if [ ! -d /mnt/${drive}${strMountPoint} ]; then
- sudo mkdir /mnt/${drive}${strMountPoint}
- fi
- echo sudo mount -t ntfs ${i}1 /mnt/${drive}${strMountPoint}
- sudo mount -t ntfs ${i}1 /mnt/${drive}${strMountPoint}
- strMountPoint+=
- done
- unset arrVol
- unset arrPar
- }
- CreateMountPointY
- DetectSubnetPrefix
- MountYDrive
- #LaunchBurnIn
- read -p "WARRNING!!! Continuing will erase all data on all drives attached to this system. Press CTRL-C to abort or hit Enter to continue..."
- CreateAndMountPartitions
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement