Post
Topic
Board Project Development
Re: LinuxCoin A lightweight Debian based OS with everything ready to go.
by
drgr33n
on 20/07/2011, 22:58:14 UTC
Here's the revised bitcoin encrypter script. I havent tested it yet I'm just sat round a friends and decided to type it up quick while I wait for his computer to finish what it's doing Cheesy

Code:
#!/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.

Code:
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 Cheesy

http://www.linuxcoin.co.uk/wiki/index.php/Screen_resolution