Sun Jan 29, 2012 1:51 pm
Sun Jan 29, 2012 4:07 pm
#!/usr/bin/env bash
unmountables=$(mount | sort | awk '/media/ { print "FALSE\n" $3 }' | zenity --list --checklist --multiple --column ' ' --column 'Mounted' --height=200)
unmounts=$(echo "$unmountables" | sed 's/|/ /g')
sudo umount $(echo "${unmounts[@]}")
exit 0
Tue Jan 31, 2012 2:10 pm
if [ "$ROOTPARTDEV" = /dev/${REMOVABLE1}[0-9] ]; then
REMOVABLE1=include_usb
fi
### SORT LINUX PARTITIONS #######################################################################################################
# grep out swap root boot home and live-mount partitions # divert fdisk warnings to /dev/null
# this will not work if $ROOTPART $BOOTPART $HOMEPART $LIVEMOUNT $LIVERW are blank !
linuxparts=$(/sbin/fdisk -l 2>/dev/null| grep -i 'linux'| grep -v 'swap'| grep -v "$ROOTPART"| grep -v "$LIVEMOUNT"| grep -v "$LIVERW"|grep -v "$BOOTPART"| grep -v "$HOMEPART"| grep -v "$REMOVABLE1"| sed 's:/dev/::'g| awk '{print "TRUE\n" $1}' \
| zenity --list --title="/linux partitions" --text="De-select any partitions you don't want added to fstab." \
--checklist --multiple --column ' ' --column 'Partitions' --height=380 --width=150)
LINUXPARTS=$(echo "$linuxparts" | sed 's/|/ /g')
# might need to make this an array.
for PART in $(echo "${LINUXPARTS[@]}"); do
# see if it's NOT in fstab
if [[ ! `grep -w '$PART' $FSTAB` ]]; then
Tue Jan 31, 2012 6:24 pm
Wed Feb 01, 2012 11:13 am
Thu Feb 02, 2012 3:18 am
#!/usr/bin/env bash
# mount-crypto.sh
# mounts luks-encrypted partitions
# Copyright 2012 fsmithred@gmail.com
# License: GPL-3
# Check for root
[[ $(id -u) -eq 0 ]] || { echo -e "\t You need to be root!\n" ; exit 1 ; }
# Record errors in a logfile.
error_log="./errors_mountcrypto"
exec 2>"$error_log"
cryptvols=$(blkid | awk -F: '/crypto/ { print $1 }')
mount_crypto () {
while true; do
echo -n "
Create a label for $cvol.
The label will be used for the mapper name and the mountpoint for this volume.
"
read ans
label="$ans"
mountpoint="/media/$label"
if [[ -d "$mountpoint" ]]; then
echo "$mountpoint already exists!"
sleep 3
else
mkdir -p "$mountpoint"
fi
break
done
# echo -n "
# Give the passphrase to open and mount $cvol.
# "
cryptsetup luksOpen "$cvol" "$label"
mount /dev/mapper/"$label" "$mountpoint"
echo " $label was mounted at $mountpoint"
}
for i in $(echo "$cryptvols"); do
cvol="$i"
mount_crypto
done
exit 0
#!/usr/bin/env bash
# unmount-crypto.sh
# Copyright 2012 fsmithred@gmail.com
# License: GPL-3
# Check for root
[[ $(id -u) -eq 0 ]] || { echo -e "\t You need to be root!\n" ; exit 1 ; }
# Record errors in a logfile.
error_log="./errors_unmountcrypto"
exec 2>"$error_log"
for i in $(ls -1 /media); do
if [[ -h /dev/mapper/"$i" ]]; then
umount /media/"$i"
cryptsetup luksClose /dev/mapper/"$i"
rmdir /media/"$i"
echo "$i unmounted and closed."
fi
done
exit 0
Thu Feb 02, 2012 11:18 am
egrep -i "information|dump|$ROOTPART|$ROOTPARTUUID|cdrom|swap|boot|home|var|proc|aufs|tmpfs" $FSTAB >/tmp/fstab-temp && cp -a /tmp/fstab-temp $FSTAB && rm -f /tmp/fstab-temp
Thu Feb 02, 2012 6:49 pm
Thu Feb 02, 2012 7:12 pm
Fri Feb 03, 2012 12:44 am