#!/bin/bash if [ -f /usr/share/OBI/partition-help ] then dpath="/usr/share/OBI" elif [ -f "$HOME/partition-help" ] then dpath="$HOME" elif [ -f "$PWD/partition-help" ] then dpath="$PWD" else echoout "Error finding the OBI path... must abort, this is inconceivable" exit fi filename="$HOME/partition-help.txt" LC_ALL=C;LANG=C ram=$(free -m|grep "Mem:"|tr -s ' ' '\t'|cut -f 2) devices=($(lsblk|sed 's/..sd*//'|grep sd| sed 's/ .*//')) device=${devices[*]} num_devices="${#devices[@]}" intro="$num_devices devices" if [ "$num_devices" == "1" ] then device="/dev/${devices[0]}" intro="$num_devices device" fi drive_size=$(lsblk |grep "^${devices[0]}" | awk '{print $4}') if [[ $ram -ge 3000 ]] then ramG=$(free -g|grep "Mem:"|tr -s ' ' '\t'|cut -f 2) swapsize=$(( (ramG/2) )) swapsize="${swapsize} GB" if [[ $ramG -ge 4 ]] then laptop="4 GB" ram="${ramG} GB" else laptop=$(( (ramG*2) )) laptop="${laptop} GB" ram="${ramG} GB" fi else if [[ $ram -le 512 ]] then swapsize="512MB" laptop="512 MB" else swapsize="${ram} MB NOTE: you could get by on around 512MB" laptop=$(( (ram*2) )) laptop="${laptop} MB" ram="${ram} MB" fi fi redtext="\0033[31m" greentext="\0033[32m" resetvid="\0033[0m" text="You can install a system from a tarball into two partitions: one root file system partition and one swap partition This way it is possible to create a *dual boot* device with an existing (already installed) operating system. It is also possible to create a separate *data partition*, that can be used by linux as well as Windows. (Must be FAT32, FAT16, or NTFS) OSX uses HFS and HFS+, though FAT32 will work well with both OSX and Linux. NTFS is usable by OSX through 3rd party apps. OBI detects $intro ${redtext}${device}${resetvid} Edit and create partitions! Apply with the ${greentext}green tick${resetvid} in gparted One partition should be labeled ${redtext}obi-root${resetvid} One (smaller) partition should be labeled ${redtext}obi-swap${resetvid} These labeled partitions can be identified and selected automatically Manual selection is also possible, if you do not want to temporarily label them this way. For example: The drive ${devices[0]} is $drive_size You have $ram RAM, so the swap should be around $swapsize NOTE, if you want to hibernate you should use around $laptop for your swap" echo -e "${text}" > "${filename}" if which xterm >/dev/null 2>&1 then xterm -sb -rightbar -fa default -fg black -bg beige -fs 12 -geometry 80x32 -title "Help to partition" -hold -e fold -sw 80 "${filename}" & fi sleep 3 sudo gparted && sudo "$dpath/obi"