master 201ff5b3998b cached
3 files
3.9 KB
1.2k tokens
1 requests
Download .txt
Repository: RayViljoen/Raspberry-PI-SD-Installer-OS-X
Branch: master
Commit: 201ff5b3998b
Files: 3
Total size: 3.9 KB

Directory structure:
gitextract_ha_92_1_/

├── .gitignore
├── README.md
└── install

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
.DS_Store

================================================
FILE: README.md
================================================
# Raspberry PI SD Installer OS X

### Shell Script for creating Raspberry PI SD card on OS X.

---

##### Usage:

1. Simply execute the install script from Terminal and pass the image to write. (Image, not ZIP)

	eg. `sudo ./install ~/Downloads/wheezyDebian.img`

2. Select the disk to write the image to by selecting the disk number provided in the output.

3. Wait for disk to finish writing. You can check the write progress with `Ctrl+T`.

---

##### CAUTION:

**Make absolutely sure to select the correct disk from the list of mounted disks output by the script.
Selecting your system drive WILL overwrite it!**

If you are unsure which disk you need to select you can remove the SD card, check the mounted disks by running `df -hl` and 
then re-check after re-inserting the SD card.

The disk name will likely be something similar to: `/dev/disk2s1`

---

#### [Download SD Card Images here.](http://www.raspberrypi.org/downloads)

================================================
FILE: install
================================================
#!/bin/bash

# Raspberry PI Install Script
# Author: Ray Viljoen

# Quit on error
set -e

_piline="------------------------------------------------------------------------------------"

# Display colorized information output
function _info() {
    COLOR='\033[00;32m' # green
    RESET='\033[00;00m' # white
    echo -e "${COLOR}${@}${RESET}"
}
 
# Display colorized warning output
function _warn() {
    COLOR='\033[00;31m' # red
    RESET='\033[00;00m' # white
    echo -e "${COLOR}${@}${RESET}"
}

_info '
__________.___  .___                 __         .__  .__                
\______   \   | |   | ____   _______/  |______  |  | |  |   ___________ 
 |     ___/   | |   |/    \ /  ___/\   __\__  \ |  | |  | _/ __ \_  __ \
 |    |   |   | |   |   |  \\___ \  |  |  / __ \|  |_|  |_\  ___/|  | \/
 |____|   |___| |___|___|  /____  > |__| (____  /____/____/\___  >__|   
                         \/     \/            \/               \/       
'


# Set $1 as image path
DISTRO="$1"

# Check image path is set else exit
if [ -z "$DISTRO" ]; then
    _warn $_piline
    _warn "ERR: No image path supplied"
    _warn $_piline
    exit 0
fi



# Selected disk
_udisk=""

function promptDisk() {

    # ================================================
    # Check connected disks and save paths to array
    # ================================================

    # Counter
    i=0

    echo $_piline

    # Loop over df -lh
    while read line; do

        # Print with local mount only and add counter to select disk
        if [ "$i" -gt 0 ]; then
            echo "$i) $line"
            # Asign first work (path) to array with corresponding counter
            _mount[i]=$( echo $line | awk '{print $1;}')
        else
            _info "   $line"
            echo $_piline
        fi

        # Increment counter
        ((i++))

    done <<< "$(df -h)"
    echo -e "$_piline\n"

    _opts=''
    for i in "${!_mount[@]}"; do
        [ -z "$_opts" ] && _opts="${_opts}${i}" || _opts="${_opts}, ${i}"
    done

    # Ask user to select mounted disk
    echo "Select the disk to use by enetering the disk number."
    _warn "*** MAKE SURE YOU SELECT THE CORRECT DISK ***"
    _warn "*** Refer to the Readme if uncertain ***"
    echo -n -e "\nUse disk [ $_opts ] #"
    read ans

    # Set selected disk
    _udisk=${_mount[$ans]}

    # Test if valid disk selected
    if [ -z "$_udisk" ]; then
        _warn "\n ======= Invalid selection ======= \n"
        promptDisk
    fi
}

# Run prompt
promptDisk

# ===========================================================
# Past this point a valid disk has been selected, so proceed.
# ===========================================================

# Format disk name to raw format
_rawdisk=$( echo $_udisk | awk 'sub("..$", "")' | sed 's/disk/rdisk/')

# Unmount Disk
echo "Unmounting Disk"
diskutil unmount $_udisk

echo "Writing image"
echo "Ctrl+T to see progress.."
sudo dd bs=1m if=${DISTRO} of=${_rawdisk}

# Eject disk
echo "Ejecting Disk"
diskutil eject ${_rawdisk}

_info "All Done!"
Download .txt
gitextract_ha_92_1_/

├── .gitignore
├── README.md
└── install
Condensed preview — 3 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (4K chars).
[
  {
    "path": ".gitignore",
    "chars": 9,
    "preview": ".DS_Store"
  },
  {
    "path": "README.md",
    "chars": 936,
    "preview": "# Raspberry PI SD Installer OS X\n\n### Shell Script for creating Raspberry PI SD card on OS X.\n\n---\n\n##### Usage:\n\n1. Sim"
  },
  {
    "path": "install",
    "chars": 3040,
    "preview": "#!/bin/bash\n\n# Raspberry PI Install Script\n# Author: Ray Viljoen\n\n# Quit on error\nset -e\n\n_piline=\"---------------------"
  }
]

About this extraction

This page contains the full source code of the RayViljoen/Raspberry-PI-SD-Installer-OS-X GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 3 files (3.9 KB), approximately 1.2k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!