setup a rpi image for burning on linux [raspberrypi]

based on:
http://www.forum-raspberrypi.de/Thread-tutorial-festplatten-sd-image-unter-linux-einbinden-mounten

setup your raspbian image:
sudo mkdir -p /mnt/sda2
cd ~/Downloads
sudo mount 2017-03-02-raspbian-jessie-lite.img /mnt/sda2 -o offset=$((8192*512))
cd /mnt/sda2/
sudo touch ssh
cd
sudo umount /mnt/sda2
cd ~/Downloads
sudo mount 2017-03-02-raspbian-jessie-lite.img /mnt/sda2 -o offset=$((137216*512))
cd /mnt/sda2/etc/wpa_supplicant/
sudo nano wpa_supplicant.conf

now add your wlan at the end like:
network={
ssid="YOUR_WLAN_SSID"
psk="YOUR_WLAN_PASSWORD"
}

and unmount the image:
cd
sudo umount /mnt/sda2

shrunk / backup / write / flash / burn raspberry pi image [raspberry pi,ubuntu]

to avoid problems if you remove a sd-card:
rechtsclick auf datenträger > aushängen!!!! (wie bei windows sicher entfernen)

first do steps 1-8
then steps a-f

shrunk image on sd-card [ubuntu] Continue reading