From 1750a4cc5e03521fb85932a14d1cf271d27ec1ea Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Thu, 16 Aug 2018 18:00:42 -0400 Subject: Port all scripts to sh Not hard, but having to escape ( ) inside [ ] had me confused for a bit. --- link.sh | 18 ++++++++++++++++++ link.zsh | 18 ------------------ pdf.sh | 28 ++++++++++++++++++++++++++++ pdf.zsh | 28 ---------------------------- prune.sh | 7 +++++++ prune.zsh | 7 ------- 6 files changed, 53 insertions(+), 53 deletions(-) create mode 100755 link.sh delete mode 100755 link.zsh create mode 100755 pdf.sh delete mode 100755 pdf.zsh create mode 100755 prune.sh delete mode 100755 prune.zsh diff --git a/link.sh b/link.sh new file mode 100755 index 00000000..0f1f49aa --- /dev/null +++ b/link.sh @@ -0,0 +1,18 @@ +#!/bin/sh +set -e -u + +if [ $# -eq 1 ]; then + linkPath=$1 + filePath="$PWD/home/${linkPath#$HOME/}" + [ ! -f "$filePath" ] + mkdir -p "$(dirname "$filePath")" + mv "$linkPath" "$filePath" +fi + +find home -type f | while read -r findPath; do + filePath="$PWD/$findPath" + linkPath="$HOME/${findPath#home/}" + mkdir -p "$(dirname "$linkPath")" + [ \( -f "$linkPath" -a -L "$linkPath" \) -o ! -f "$linkPath" ] + ln -s -f "$filePath" "$linkPath" +done diff --git a/link.zsh b/link.zsh deleted file mode 100755 index a0a9e7aa..00000000 --- a/link.zsh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env zsh -set -o errexit -o nounset -o pipefail - -if [[ $# -eq 1 ]]; then - linkPath="$1" - filePath="$PWD/home/${linkPath#$HOME/}" - [[ ! -f "$filePath" ]] - mkdir -p "$(dirname "$filePath")" - mv "$linkPath" "$filePath" -fi - -find home -type f | while read -r findPath; do - filePath="$PWD/$findPath" - linkPath="$HOME/${findPath#home/}" - mkdir -p "$(dirname "$linkPath")" - [[ ( -f "$linkPath" && -L "$linkPath" ) || ! -f "$linkPath" ]] - ln -s -f "$filePath" "$linkPath" -done diff --git a/pdf.sh b/pdf.sh new file mode 100755 index 00000000..90c73de1 --- /dev/null +++ b/pdf.sh @@ -0,0 +1,28 @@ +#!/bin/sh +set -e -u + +mkdir -p pdf + +fetch() { + [ -f "pdf/$1" ] && return + curl --silent --show-error --output "pdf/$1" "$2" + echo "pdf/$1" +} + +elf() { + fetch "$1" "http://refspecs.linuxbase.org/elf/$2" +} +intel() { + fetch "$1" "https://software.intel.com/sites/default/files/managed/$2" +} + +elf abi.pdf x86_64-abi-0.99.pdf +elf elf.pdf elf.pdf +fetch multiboot.pdf 'https://www.gnu.org/software/grub/manual/multiboot/multiboot.pdf' +intel intel-64-opt.pdf 9e/bc/64-ia-32-architectures-optimization-manual.pdf +intel intel-64-sdm-vol-1.pdf a4/60/253665-sdm-vol-1.pdf +intel intel-64-sdm-vol-2.pdf a4/60/325383-sdm-vol-2abcd.pdf +intel intel-64-sdm-vol-3.pdf a4/60/325384-sdm-vol-3abcd.pdf +intel intel-64-sdm-vol-4.pdf 22/0d/335592-sdm-vol-4.pdf + +chmod 444 pdf/*.pdf diff --git a/pdf.zsh b/pdf.zsh deleted file mode 100755 index 25458dfa..00000000 --- a/pdf.zsh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env zsh -set -o errexit -o nounset -o pipefail - -mkdir -p pdf - -fetch() { - [[ -f "pdf/$1" ]] && return - curl --silent --show-error --output "pdf/$1" "$2" - echo "pdf/$1" -} - -elf() { - fetch "$1" "http://refspecs.linuxbase.org/elf/$2" -} -intel() { - fetch "$1" "https://software.intel.com/sites/default/files/managed/$2" -} - -elf abi.pdf x86_64-abi-0.99.pdf -elf elf.pdf elf.pdf -fetch multiboot.pdf 'https://www.gnu.org/software/grub/manual/multiboot/multiboot.pdf' -intel intel-64-opt.pdf 9e/bc/64-ia-32-architectures-optimization-manual.pdf -intel intel-64-sdm-vol-1.pdf a4/60/253665-sdm-vol-1.pdf -intel intel-64-sdm-vol-2.pdf a4/60/325383-sdm-vol-2abcd.pdf -intel intel-64-sdm-vol-3.pdf a4/60/325384-sdm-vol-3abcd.pdf -intel intel-64-sdm-vol-4.pdf 22/0d/335592-sdm-vol-4.pdf - -chmod 444 pdf/*.pdf diff --git a/prune.sh b/prune.sh new file mode 100755 index 00000000..31ab30cf --- /dev/null +++ b/prune.sh @@ -0,0 +1,7 @@ +#!/bin/sh +set -e -u + +find -L ~ -type l -lname "$PWD/*" | while read -r linkPath; do + rm "$linkPath" + echo "$linkPath" +done diff --git a/prune.zsh b/prune.zsh deleted file mode 100755 index db85a9d1..00000000 --- a/prune.zsh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env zsh -set -o errexit -o nounset -o pipefail - -find -L ~ -type l -lname "$PWD/*" | while read -r linkPath; do - rm "$linkPath" - echo "$linkPath" -done -- cgit 1.4.1