#!/bin/bash
# Bitcoin wallet encrypter
# Zarren Spry
# v0.2
# Ask for loop
LOOPDEV=$(zenity --entry --text "Please enter a loop device" --entry-text "/dev/loop7");
# Check for existing wallet in the .bitcoin folder
if [ -f ~/.bitcoin/wallet.dat ]; then
if zenity --question --text="An existing unencrypted wallet found ! Would you like me use this wallet ?."; then
USE_OLD_WALLET="1"
else
if zenity --question --text="The current wallet located in ~/.bitcoin is about to be deleted ! Are you sure ?"; then
rm ~/bitcoin/wallet.dat
else
zenity --info --text="Ok backing up existing wallet."
USE_OLD_WALLET="0"
fi
fi
# Start bitcoin
bitcoin -min&
# Check if a wallet already exists and if not create one
if [ -f /.wallet ]; then
sudo losetup $LOOPDEV /.wallet
RAW_PASSWORD=$(zenity --entry --text "Pleas enter your passphrase." --entry-text "Your passphrase here.");
PASSWORD=$(echo -n $RAW_PASSWORD | sha1sum | cut -d "-" -f 1)
echo $PASSWORD | echo $PASSWORD | sudo cryptsetup luksOpen $LOOPDEV wallet
sudo mount /dev/mapper/wallet ~/wallet
if [ $USE_OLD_WALLET == "1" ]; then
sudo mv ~/.bitcoin/wallet.dat ~/wallet/wallet$(date "+%Y%m%d-%H:%M:%S").dat
sudo ln -s ~/wallet/wallet$(date "+%Y%m%d-%H:%M:%S").dat ~/.bitcoin/wallet.dat
elif [ $USE_OLD_WALLET == "0" ]; then
sudo mv ~/.bitcoin/wallet.dat ~/wallet/wallet$(date "+%Y%m%d-%H:%M:%S").dat
WALLET_COUNT=0
for numof in $(ls ~/wallet/wallet); do
let WALLET_COUNT = WALLET_COUNT+1
done
if [ $WALLET_COUNT -gt 2 ]; then
zenity --info --text "Multiple wallets detected ! Please select a wallet."
WALLET_FILE=$(zenity --file-selection)
sudo ln -s ~/wallet/$WALLET_FILE ~/.bitcoin/wallet.dat
else
sudo rm ~/.bitcoin/wallet.dat
sudo ln -s ~/wallet/wallet.dat ~/.bitcoin/wallet.dat
fi
zenity --info --text "Your wallet has been mounted !"
else
# Create wallet
sudo dd if=/dev/urandom of=/.wallet bs=1024k count=50
mkdir ~/wallet
sudo losetup $LOOPDEV /.wallet
RAW_PASSWORD=$(zenity --entry --text "Pleas enter a passphrase." --entry-text "Your passphrase here.");
PASSWORD=$(echo -n $RAW_PASSWORD | sha1sum | cut -d "-" -f 1)
echo "YES" | echo $PASSWORD | echo $PASSWORD | sudo cryptsetup luksFormat $LOOPDEV
echo $PASSWORD | echo $PASSWORD | sudo cryptsetup luksOpen $LOOPDEV wallet
sudo mkfs.ext4 /dev/mapper/wallet
sudo mount /dev/mapper/wallet ~/wallet
if [ $USE_OLD_WALLET == "1" ]; then
sudo mv ~/.bitcoin/wallet.dat ~/wallet/wallet$(date "+%Y%m%d-%H:%M:%S").dat
sudo ln -s ~/wallet/wallet$(date "+%Y%m%d-%H:%M:%S").dat ~/.bitcoin/wallet.dat
else
sudo mv ~/.bitcoin/wallet.dat ~/wallet
sudo ln -s ~/wallet/wallet.dat ~/.bitcoin/wallet.dat
fi
zenity --info --text "Wallet encryption complete ! Your encrypted password is ${PASSWORD}."
fi
# Infinate loop to check if bitcoin is running. If not running clean up files.
while true; do
check_running=$(pidof bitcoin)
if [ -z $check_running ]; then
running="0"
else
running="1"
fi
if [ $running == "0" ]; then
sudo umount ~/wallet
sudo rm ~/./bitcoin/wallet.dat
sudo cryptsetup luksClose $LOOPDEV wallet
losetup -d $LOOPDEV
break
else
sleep 10
fi
done
Open up a terminal and type.
lxrandr
And you will be met with a GUI that you can change the resolution.
We really need to get this info in the wiki, also how to change the clock to different time zones, so annoying to see the clock always showing the time 6 hours off for me.
Get signed up and add the info !! I agree more people should use the wiki
http://www.linuxcoin.co.uk/wiki/index.php/Screen_resolution