├── README.md └── flash-sdcard.sh /README.md: -------------------------------------------------------------------------------- 1 | ```html 2 | ___ ___ ___ _____ _ _ 3 | | _ \/ _ \| _ \_ _/_\ | | of ._ o 4 | | _/ (_) | / | |/ _ \| |__ |_)| 5 | |_| \___/|_|_\ |_/_/ \_\____| | 6 | ``` 7 | 8 | PORTAL of Pi - RaspberyPi based PORTAL device. Certified UNIX Network Technicians only! 9 | 10 | Development and Design Guide 11 | ============================= 12 | 13 | By: the grugq 14 | 15 | Guide 16 | ===== 17 | 18 | This will guide you through configuring an Arch based RaspberryPi installation 19 | which transparently forwards all TCP traffic over the Tor network. There is 20 | also a Tor SOCKS proxy for explicitly interacting with the Tor network, either 21 | for more security, or to access a Hidden Service. 22 | 23 | The configuration of access to the Internet is left as an exercise to the reader. 24 | -------------------------------------------------------------------------------- /flash-sdcard.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # flash-sdcard.sh 3 | # 4 | # Automated Arch Linux ARM install script 5 | # This script installs the latest version of Arch Linux ARM to an SD card. 6 | # 7 | # Based on official installation recommendations: 8 | # https://archlinuxarm.org/platforms/armv6/raspberry-pi#installation 9 | # 10 | # This script requires the following input: 11 | # 1. The full path to a block device where Arch ARM is to be installed. 12 | # 13 | # This script performs the following actions: 14 | # 1. Creates 100MB vfat (boot) partition on specified block device; 15 | # 2. Creates ext4 (root) parition on remaining space; 16 | # 3. Creates a temporary directory for mount points and download; 17 | # 4. Downloads a tarball of the lastest ArchARM distribution; 18 | # 5. Extracts files to new root partition; 19 | # 6. Moves /boot directory to boot partiton. 20 | # 21 | # Usage: 22 | # bash flash-sdcard.sh /dev/sdcard 23 | # 24 | 25 | ## Set flags 26 | set -u 27 | #set -e # fdisk may throw error codes even on successful writes. 28 | 29 | ## Check if input value was given and exists. 30 | ## Show usage message if not. 31 | if [ $# -ne 1 ] || [ ! -e $1 ]; then 32 | echo 33 | echo "Valid path to SD card device is a required argument." 34 | echo 35 | echo "Example:" 36 | echo " bash $0 /dev/mmcblk0" 37 | echo 38 | exit 1 39 | fi 40 | 41 | ## Wipe SD card. 42 | #dd if=/dev/zero of=$1 43 | 44 | ## Create partitions using fdisk by simulating user input. 45 | ## (fdisk was not designed with non-interactive use in mind.) 46 | echo "o 47 | n 48 | p 49 | 1 50 | 51 | +100M 52 | n 53 | p 54 | 2 55 | 56 | 57 | p 58 | w 59 | q 60 | " | fdisk $1 61 | 62 | ## Sync changes and update partition table. 63 | sync; partprobe $1; sync 64 | 65 | ## Create tempory directory for mounts and download. 66 | cd `mktemp -d` 67 | mkdir boot root 68 | 69 | ## If partition numbering for the device follows sda -> sda1 format. 70 | if [ -e "$1"1 ]; then 71 | mkfs.vfat "$1"1 72 | mount "$1"1 boot 73 | mkfs.ext4 "$1"2 74 | mount "$1"2 root 75 | 76 | ## If partition numbering for the device follows mmcblk0 -> mmcblk0p1 format. 77 | else 78 | mkfs.vfat "$1"p1 79 | mount "$1"p1 boot 80 | mkfs.ext4 "$1"p2 81 | mount "$1"p2 root 82 | fi 83 | 84 | ## Download tarball 85 | SRC="http://archlinuxarm.org/os/ArchLinuxARM-rpi-latest.tar.gz" #RasPi 86 | #SRC="http://archlinuxarm.org/os/ArchLinuxARM-rpi-2-latest.tar.gz" #RasPi 2 87 | wget $SRC 88 | 89 | ## Download and verify PGP signature 90 | ## (Best practice, but disabled for simplicity's sake.) 91 | #wget "$SRC".sig 92 | #gpg --recv-keys 2BDBE6A6 93 | #gpg --verify $SRC 94 | 95 | ## Extract tarball 96 | tar -xf ArchLinuxARM-rpi-latest.tar.gz -C root 97 | sync 98 | mv root/boot/* boot # Move /boot files to boot partition 99 | sync 100 | 101 | ## Unmount mounts 102 | umount boot root 103 | 104 | ## We're done. 105 | --------------------------------------------------------------------------------