Skip to content

Commit

Permalink
Add install instructions for other OSs
Browse files Browse the repository at this point in the history
* Linux updated to include debian/ubuntu packages
* Windows via WSL
* Mac via docker
  • Loading branch information
Drewsif committed Oct 5, 2024
1 parent aa14313 commit 1fe1137
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 2 deletions.
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM debian:bookworm

# Install requirments
RUN apt update && apt install -y wget parted gzip pigz xz-utils udev e2fsprogs && apt clean

# Setup Env
ENV LANG=C.UTF-8
ENV TERM=xterm-256color
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /workdir

# Copy pishrink in
COPY pishrink.sh /usr/local/bin/pishrink
RUN chmod +x /usr/local/bin/pishrink
ENTRYPOINT [ "/usr/local/bin/pishrink" ]
32 changes: 30 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ using multiple cores is supported.

## Usage ##

```
```text
Usage: $0 [-adhrsvzZ] imagefile.img [newimagefile.img]
-s Don't expand filesystem when image is booted the first time
Expand Down Expand Up @@ -35,19 +35,47 @@ Default options for compressors can be overwritten by defining PISHRINK_GZIP or

If you are running PiShrink in VirtualBox you will likely encounter an error if you
attempt to use VirtualBox's "Shared Folder" feature. You can copy the image you wish to
shrink on to the VM from a Shared Folder, but shrinking directctly from the Shared Folder
shrink on to the VM from a Shared Folder, but shrinking directly from the Shared Folder
is know to cause issues.

If using Ubuntu, you will likely see an error about `e2fsck` being out of date and `metadata_csum`. The simplest fix for this is to use Ubuntu 16.10 and up, as it will save you a lot of hassle in the long run.

## Installation ##

### Linux Instructions ###

If you are on Debian/Ubuntu you can install all the packages you would need by running: `sudo apt update && sudo apt install -y wget parted gzip pigz xz-utils udev e2fsprogs`

Run the block below to install PiShrink onto your system.

```bash
wget https://raw.githubusercontent.com/Drewsif/PiShrink/master/pishrink.sh
chmod +x pishrink.sh
sudo mv pishrink.sh /usr/local/bin
```

### Windows Instructions ###

PiShrink can be ran on Windows using [Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/about) (WSL 2).

1. In an Administrator command prompt run `wsl --install -d Debian`. You will likely need to reboot after. Please check [Microsoft's documentation](https://learn.microsoft.com/en-us/windows/wsl/install) if you run into issues.
2. Open the `Debian` app from your start menu.
3. Run `sudo apt update && sudo apt install -y wget parted gzip pigz xz-utils udev e2fsprogs`
4. Go to the Linux Instructions section above, do that and you're good to go! Your C:\ drive is mounted at /mnt/c/

### MacOS Instructions ###

These instructions were sourced from the community and should work on Intel and M1 Macs.

1. [Installer Docker](https://docs.docker.com/docker-for-mac/install/).
2. `cd` in the pishrink directory you downloaded/cloned.
3. Build the container by running `docker build -t pishrink .`
4. Create an alias to run PiShrink `echo "alias pishrink='docker run -it --rm --platform linux/amd64 --privileged=true -v $(pwd):/workdir pishrink'" >> ~/.bashrc && source ~/.bashrc`

You can now run the `pishrink` command as normal to shrink your images.

***Please Note:*** You MUST change directory into the images folder for this command to work. The command mounts your current working directory into the container so absolute file paths will not work. Relative paths should work just fine as long as they are below your current directory.

## Example ##

```bash
Expand Down

0 comments on commit 1fe1137

Please sign in to comment.