Skip to main content

Basics

  • Prolog
#!/bin/bash

set -e

SCRIPT_DIR="$(cd $(dirname $0); pwd -P)"

Tar

  • Unpack tar archive
tar xf archive.tar.gz --directory output-dir
  • Pack tar archive
tar cvfz output.tar.gz input-dir

Zip

  • Unzip archive
unzip archive.zip -d output-dir
  • Zip archive
zip -r archive.zip input-dir

Git

  • Clone into folder
git clone https://github.com/user/repository output-dir

Wget

  • Download into directory
wget https://github.com/user/repository/archive/refs/tags/my-lib.tar.gz --directory-prefix=output-dir
  • Only download if file doesn't exist
if ! test -f "my-lib.tar.gz"; then
wget https://github.com/user/repository/archive/refs/tags/my-lib.tar.gz
fi
ln -s input-file output-link

Patch

  • Create patch
git add file-to-patch.txt
git commit -m"Patched file"
git show > my-change.patch
  • Apply patch
patch file-to-patch.txt < my-change.patch

Verify sha256sum

sha256sum -c --ignore-missing "third-party-software-SHA-256.txt"