Skip to content

Commit 432ac9e

Browse files
committed
8/14/2025
1 parent 82c4a08 commit 432ac9e

File tree

4 files changed

+79
-41
lines changed

4 files changed

+79
-41
lines changed

.10_macos.bash

Lines changed: 63 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,37 @@ if [[ -x "$(command -v brew)" ]]; then
2020
}
2121
fi
2222

23+
__homebrew_funcs() {
24+
# Install a specific version of a Homebrew formula
25+
# @param {string} $1 Formula name
26+
# @param {string} $2 Formula version
27+
vintage() {
28+
# Ensure homebrew/core is tapped and up to date
29+
brew tap | grep -xq homebrew/core \
30+
&& brew update \
31+
|| brew tap --force homebrew/core
32+
33+
# Ensure homebrew/local is created
34+
brew tap | grep -xq homebrew/local \
35+
|| brew tap homebrew/local
36+
37+
# Extract the formula
38+
brew extract --force "--version=${2:?}" "${1:?}" homebrew/local
39+
40+
# If the formula is already installed, re-link it
41+
if brew list -1 | grep -xq "${1:?}@${2:?}"; then
42+
brew unlink "${1:?}@${2:?}"
43+
brew link --overwrite "${1:?}@${2:?}"
44+
return 0
45+
fi
46+
47+
# Install the formula and ensure it's linked
48+
brew install "homebrew/local/${1:?}@${2:?}" \
49+
|| brew link --overwrite "${1:?}@${2:?}"
50+
}
51+
}
52+
__homebrew_funcs
53+
2354

2455
##### App installs #####
2556

@@ -49,36 +80,39 @@ if command -v brew &> /dev/null; then
4980
fi
5081

5182
# App store applications
52-
if command -v brew &> /dev/null && ! command -v mas &> /dev/null; then
53-
brew install mas
54-
# Installed applications aren't enumerated immediately, `mas list` may return nothing
83+
if command -v brew &> /dev/null; then
84+
if ! command -v mas &> /dev/null; then
85+
brew install mas
86+
# Installed applications aren't enumerated immediately, `mas list` may return nothing
87+
else
88+
# If there are no installed applications, it could be because a newer OS version needs a newer version of 'mas'
89+
mas list | grep -Eq '^[0-9]+ ' || brew upgrade mas
90+
fi
91+
fi
92+
if command -v mas &> /dev/null; then
93+
mas_list=$(mas list)
94+
for app_id in $(
95+
# ----- Applications -----
96+
# TODO: Keka (paid)
97+
# Kindle
98+
echo "302584613"
99+
# TODO: LibreOffice (paid)
100+
# TODO: Maccy (paid)
101+
# Menu World Time
102+
# echo "1446377255"
103+
# NordVPN
104+
echo "905953485"
105+
# Telegram
106+
# echo "747648890"
107+
# ----- Safari Extensions -----
108+
# 1Password for Safari
109+
echo "1569813296"
110+
# Grammarly for Safari
111+
echo "1462114288"
112+
); do
113+
echo "${mas_list}" | grep "^${app_id} " &> /dev/null || mas install "${app_id}"
114+
done
55115
fi
56-
# if command -v mas &> /dev/null; then
57-
# mas_list=$(mas list)
58-
# for app_id in $(
59-
# # ----- Applications -----
60-
# # TODO: Keka (paid)
61-
# # Kindle
62-
# echo "302584613"
63-
# # TODO: LibreOffice (paid)
64-
# # TODO: Maccy (paid)
65-
# # Menu World Time
66-
# # echo "1446377255"
67-
# # NordVPN
68-
# # echo "905953485"
69-
# # Telegram
70-
# # echo "747648890"
71-
# # WhatsApp
72-
# # echo "310633997"
73-
# # ----- Safari Extensions -----
74-
# # 1Password for Safari
75-
# echo "1569813296"
76-
# # Grammarly for Safari
77-
# echo "1462114288"
78-
# ); do
79-
# echo "${mas_list}" | grep "^${app_id} " &> /dev/null || mas install "${app_id}"
80-
# done
81-
# fi
82116

83117
# macOS DNS flush
84118
flush() {

.20_docker.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ __docker_funcs() {
88
docker() {
99
if [[ "${OSTYPE:-}" == "darwin"* ]]; then
1010
# macOS
11-
ps axo pid,command | grep -v grep | grep --quiet /Applications/Docker.app/Contents/MacOS/Docker || (
11+
ps axo pid,command | grep -v grep | grep -q /Applications/Docker.app/Contents/MacOS/Docker || (
1212
open --background -a Docker
1313
while true; do
1414
command docker ps &> /dev/null && break

.20_nodejs.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ __nodejs_funcs() {
3131
ndeprecated() {
3232
npm list "--depth=${1:-0}" | awk '{ print $NF }' | tail -n +2 | grep -v 'deduped' | while read -r line; do \
3333
printf "%s: " "${line}"
34-
[ "$(npm view "${line}" | grep --count --extended-regexp '^DEPRECATED')" != "0" ] && \
34+
[ "$(npm view "${line}" | grep -Ec '^DEPRECATED')" != "0" ] && \
3535
printf "\e[1;31m""DEPRECATED\n""\e[0m" || \
3636
printf "\e[1;32m""not deprecated\n""\e[0m"
3737
done

install.sh

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,31 +19,35 @@ function backup() {
1919
# Given a path and expression, safely link all files to the home directory
2020
function link() {
2121
# Create symlinks
22-
while read -r FILE; do
23-
LINK="${HOME}/$(basename "${FILE}")"
22+
while read -r file; do
23+
local link="${HOME}/$(basename "${file}")"
2424

2525
# Ensure symlink is actually a dotfile
26-
if [[ "$(basename "${LINK}")" != .* ]]; then
27-
LINK="$(dirname "${LINK}")/.$(basename "${LINK}")"
26+
if [[ "$(basename "${link}")" != .* ]]; then
27+
link="$(dirname "${link}")/.$(basename "${link}")"
2828
fi
2929

3030
# Assume symlinks are ok
31-
if [[ -h "${LINK}" ]]; then
31+
if [[ -h "${link}" ]]; then
32+
echo "Ignoring: ${link}"
3233
continue
3334
fi
3435

3536
# Back up the existing file
36-
if [[ -e "${LINK}" ]]; then
37-
mv "${LINK}" "$(backup "${LINK}")"
37+
if [[ -e "${link}" ]]; then
38+
local backup="$(backup "${link}")"
39+
echo "Moving: ${link} -> ${backup}"
40+
mv "${link}" "${backup}"
3841
fi
3942

4043
# Symlink the file
41-
ln -s "${FILE}" "${LINK}"
44+
echo "Linking: ${link} -> ${file}"
45+
ln -s "${file}" "${link}"
4246
done <<< "$(find "$1" -maxdepth 1 -name "$2" ! -name ".git" ! -name ".github" ! -name ".gitignore")"
4347

4448
# Delete broken symlinks
45-
while read -r FILE; do
46-
rm -f "${FILE}"
49+
while read -r file; do
50+
rm -f "${file}"
4751
done <<< "$(find "${HOME}" -maxdepth 1 -type l ! -exec test -e {} \; -print)"
4852
}
4953

0 commit comments

Comments
 (0)