mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

72 lines
2.0 KiB

#!/bin/bash
# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
#
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# Please add additional copyright information _after_ the line containing
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
#
# ROCK Linux: rock-src/target/lvp/x86/livesystem/etc_lvp_10-encryption.sh
# ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. A copy of the GNU General Public
# License can be found at Documentation/COPYING.
#
# Many people helped and are helping developing ROCK Linux. Please
# have a look at http://www.rocklinux.org/ and the Documentation/TEAM
# file for details.
#
# --- ROCK-COPYRIGHT-NOTE-END ---
encryption_start() {
if [ -e /lvp.data1 ] ; then
numfiles=0
files=""
echo -n "Found "
for x in /lvp.data* ; do
echo -n "${x} "
numfiles=$(( ${numfiles} + 1 ))
files="${files} /dev/loop/${numfiles}"
done
echo
echo "Starting crypto-subroutine"
exec 2>/dev/null
for x in /lvp.data* ; do
losetup /dev/loop/${x#/lvp.data} ${x}
done
mdadm --build /dev/md/0 -l linear --force -n ${numfiles} ${files}
while [ ! -e /mnt1/lvp.xml ] ; do
echo -n "Please enter passphrase: "
read -s pass
echo
pass="`echo ${pass} | md5sum`"
pass=${pass%% *}
echo 0 `/sbin/blockdev --getsize /dev/md/0` crypt aes-plain ${pass} 0 /dev/md/0 0 | /sbin/dmsetup create lvp_data
mount /dev/mapper/lvp_data /mnt1
if [ ! -e /mnt1/lvp.xml ] ; then
echo "Wrong Passphrase!"
dmsetup remove /dev/mapper/lvp_data
fi
done
exec 2>&1
fi
}
encryption_stop(){
umount /mnt1
dmsetup remove /dev/mapper/lvp_data
mdadm -S /dev/md/0
for x in /lvp.data* ; do
losetup -d /dev/loop/${x#/lvp.data}
done
}
encryption_(){
echo "Uh-Oh"
}
eval "encryption_${1}"