From: stack Date: Mon, 18 Mar 2013 18:05:01 +0000 (+0100) Subject: added make persistence script, ext3 fs X-Git-Url: https://v.licheni.net/stack/code/debianlive.git/commitdiff_plain/a98821a6bb503bab154c36b5482ac42428b5f357?ds=inline added make persistence script, ext3 fs --- diff --git a/make-persistence.sh b/make-persistence.sh new file mode 100755 index 0000000..533b3e7 --- /dev/null +++ b/make-persistence.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +if [ $# != 2 ];then + echo "$0, Wrong argument number" + echo " launch with $0 " + exit 1 +fi +if [ ! -f ./password ]; then + echo "Create a file ./password that is needed for encrypting luks persistence" + exit 1 +fi +if [ $(id -u) != 0 ];then + echo "Must run as root" + exit 1 +fi +if [ ! -x $(which parted) ];then + echo "parted executable must be in search path and persmission garanted" + exit 1 +fi +if [ ! -x $(which cryptsetup) ];then + echo "cryptsetup executable must be in search path and persmission garanted" + exit 1 +fi +device=$1 + +echo "Creating on device $device" +sleep 3 + +# Check for bad block on the device: +###badblocks -c 10240 -s -w -t random -v "${devicel}" || exit 1 + + +# Random data on the device: +###dd if=/dev/urandom of="${devicel}" || exit 1 + + +# DD THE binary.img to a usb +#dd if=binary.img of="${device}" || exit 1 + +# Make the partition +img_bytes=$(stat -c %s $2) +img_bytes=$((img_bytes+1)) + +parted "${device}" -- mkpart primary "${img_bytes}B" -1 || exit 1 + +# Ecnrypt partition +cryptsetup --verbose --batch-mode luksFormat "${device}2" << /mnt/persistence.conf || exit 1 + +# Umount +umount /dev/mapper/my_usb || exit 1 + +# Close LUKS +cryptsetup luksClose /dev/mapper/my_usb || exit 1 + +echo "All done." diff --git a/password b/password new file mode 100644 index 0000000..f1b4b17 --- /dev/null +++ b/password @@ -0,0 +1 @@ +monetine