mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-04 22:48:49 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5e06a735cc | |||
|
|
9471a63475 | ||
|
|
01328498b6 | ||
|
|
bab6f7daab | ||
| 4baabbdd5d | |||
| d5757d231f |
@@ -17,10 +17,13 @@ indent_size = 2
|
|||||||
indent_size = 2
|
indent_size = 2
|
||||||
tab_width = 2
|
tab_width = 2
|
||||||
|
|
||||||
shell_variant = posix # like -ln=posix
|
shell_variant = posix # like -ln=posix
|
||||||
binary_next_line = true # like -bn
|
binary_next_line = true # like -bn
|
||||||
switch_case_indent = true # like -ci
|
switch_case_indent = true # like -ci
|
||||||
space_redirects = true # like -sr
|
space_redirects = true # like -sr
|
||||||
keep_padding = false # like -kp
|
keep_padding = false # like -kp
|
||||||
function_next_line = true # like -fn
|
function_next_line = true # like -fn
|
||||||
never_split = true # like -ns
|
never_split = true # like -ns
|
||||||
|
|
||||||
|
[local/bin/antigen.zsh]
|
||||||
|
ignore = true
|
||||||
|
|||||||
43
.github/workflows/linters.yml
vendored
Normal file
43
.github/workflows/linters.yml
vendored
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
name: reviewdog
|
||||||
|
on: [ push ]
|
||||||
|
jobs:
|
||||||
|
linters:
|
||||||
|
name: Linters
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: GitHub Actions
|
||||||
|
uses: reviewdog/action-actionlint@v1
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
reporter: github-pr-review
|
||||||
|
|
||||||
|
- name: detect-secrets
|
||||||
|
uses: reviewdog/action-detect-secrets@master
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
reporter: github-pr-review
|
||||||
|
|
||||||
|
- name: markdownlint
|
||||||
|
uses: reviewdog/action-markdownlint@v0
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
reporter: github-pr-review
|
||||||
|
|
||||||
|
- name: shfmt
|
||||||
|
uses: reviewdog/action-shfmt@v1
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
shfmt_flags: |
|
||||||
|
--find
|
||||||
|
--list
|
||||||
|
--write
|
||||||
|
--diff
|
||||||
|
--simplify
|
||||||
|
--language-dialect bash
|
||||||
|
--indent 2
|
||||||
|
--binary-next-line
|
||||||
|
--case-indent
|
||||||
|
--space-redirects
|
||||||
|
--func-next-line
|
||||||
@@ -13,15 +13,6 @@ _theme
|
|||||||
*.sql.gz
|
*.sql.gz
|
||||||
*.WordPress.*.xml
|
*.WordPress.*.xml
|
||||||
cachegrind.out.*
|
cachegrind.out.*
|
||||||
client-*.json
|
|
||||||
composer.phar
|
composer.phar
|
||||||
devops/.infra_ip_cache
|
|
||||||
wp_*.sh
|
wp_*.sh
|
||||||
|
|
||||||
redirectRules.csv
|
|
||||||
results_redirectRules.csv
|
|
||||||
testRedirect.sh
|
|
||||||
|
|
||||||
uploads-webpc
|
|
||||||
webpc-passthru.php
|
|
||||||
auth.json
|
auth.json
|
||||||
|
|||||||
88
install.sh
88
install.sh
@@ -1,88 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# Usage:
|
|
||||||
#
|
|
||||||
# sh install.sh
|
|
||||||
#
|
|
||||||
# Environment variables: VERBOSE, CP, LN, MKDIR, RM, DIRNAME.
|
|
||||||
#
|
|
||||||
# env VERBOSE=1 sh install.sh
|
|
||||||
#
|
|
||||||
# DO NOT EDIT THIS FILE
|
|
||||||
#
|
|
||||||
# This file is generated by rcm(7) as:
|
|
||||||
#
|
|
||||||
# rcup -B 0 -g
|
|
||||||
#
|
|
||||||
# To update it, re-run the above command.
|
|
||||||
#
|
|
||||||
: ${VERBOSE:=0}
|
|
||||||
: ${CP:=/bin/cp}
|
|
||||||
: ${LN:=/bin/ln}
|
|
||||||
: ${MKDIR:=/bin/mkdir}
|
|
||||||
: ${RM:=/bin/rm}
|
|
||||||
: ${DIRNAME:=/usr/bin/dirname}
|
|
||||||
verbose()
|
|
||||||
{
|
|
||||||
if [ "$VERBOSE" -gt 0 ]; then
|
|
||||||
echo "$@"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
handle_file_cp()
|
|
||||||
{
|
|
||||||
if [ -e "$2" ]; then
|
|
||||||
printf "%s " "overwrite $2? [yN]"
|
|
||||||
read overwrite
|
|
||||||
case "$overwrite" in
|
|
||||||
y)
|
|
||||||
$RM -rf "$2"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "skipping $2"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
verbose "'$1' -> '$2'"
|
|
||||||
$MKDIR -p "$($DIRNAME "$2")"
|
|
||||||
$CP -R "$1" "$2"
|
|
||||||
}
|
|
||||||
handle_file_ln()
|
|
||||||
{
|
|
||||||
if [ -e "$2" ]; then
|
|
||||||
printf "%s " "overwrite $2? [yN]"
|
|
||||||
read overwrite
|
|
||||||
case "$overwrite" in
|
|
||||||
y)
|
|
||||||
$RM -rf "$2"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "skipping $2"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
verbose "'$1' -> '$2'"
|
|
||||||
$MKDIR -p "$($DIRNAME "$2")"
|
|
||||||
$LN -sf "$1" "$2"
|
|
||||||
}
|
|
||||||
handle_file_ln "~/.dotfiles/bash_profile" "~/.bash_profile"
|
|
||||||
handle_file_ln "~/.dotfiles/bashrc" "~/.bashrc"
|
|
||||||
handle_file_ln "~/.dotfiles/config/alias" "~/.config/alias"
|
|
||||||
handle_file_ln "~/.dotfiles/config/antigen.zsh" "~/.config/antigen.zsh"
|
|
||||||
handle_file_ln "~/.dotfiles/config/exports" "~/.config/exports"
|
|
||||||
handle_file_ln "~/.dotfiles/config/functions" "~/.config/functions"
|
|
||||||
handle_file_ln "~/.dotfiles/config/gh/config.yml" "~/.config/gh/config.yml"
|
|
||||||
handle_file_ln "~/.dotfiles/config/git/config" "~/.config/git/config"
|
|
||||||
handle_file_ln "~/.dotfiles/config/git/gitignore" "~/.config/git/gitignore"
|
|
||||||
handle_file_ln "~/.dotfiles/config/wtf/config.yml" "~/.config/wtf/config.yml"
|
|
||||||
handle_file_ln "~/.dotfiles/git_profiles" "~/.git_profiles"
|
|
||||||
handle_file_ln "~/.dotfiles/huskyrc" "~/.huskyrc"
|
|
||||||
handle_file_ln "~/.dotfiles/local/bin/dotfiles" "~/.local/bin/dotfiles"
|
|
||||||
handle_file_ln "~/.dotfiles/local/bin/x-check-git-attributes" "~/.local/bin/x-check-git-attributes"
|
|
||||||
handle_file_ln "~/.dotfiles/local/bin/x-open-ports" "~/.local/bin/x-open-ports"
|
|
||||||
handle_file_ln "~/.dotfiles/rcrc" "~/.rcrc"
|
|
||||||
handle_file_ln "~/.dotfiles/ssh/allowed_signers" "~/.ssh/allowed_signers"
|
|
||||||
handle_file_ln "~/.dotfiles/ssh/config" "~/.ssh/config"
|
|
||||||
handle_file_ln "~/.dotfiles/vuerc" "~/.vuerc"
|
|
||||||
handle_file_ln "~/.dotfiles/zshrc" "~/.zshrc"
|
|
||||||
@@ -1,31 +1,29 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#
|
#
|
||||||
# Dotfiles and install helper
|
# Dotfiles manager and install helper
|
||||||
# (c) Ismo Vuorinen <https://github.com/ivuorinen> 2022
|
# (c) Ismo Vuorinen <https://github.com/ivuorinen> 2022
|
||||||
# Licensed under MIT, see LICENSE
|
# Licensed under MIT, see LICENSE
|
||||||
#
|
#
|
||||||
# shellcheck source-path=SCRIPTDIR
|
# shellcheck source-path=$HOME/.dotfiles/local/bin
|
||||||
#
|
#
|
||||||
# Helper variables, override with ENVs like `VERBOSE=1 helpers.sh help`
|
# Helper variables, override with ENVs like `VERBOSE=1 dfm help`
|
||||||
: "${VERBOSE:=0}"
|
: "${VERBOSE:=0}"
|
||||||
: "${DOTFILES:=$HOME/.dotfiles}"
|
: "${DOTFILES:=$HOME/.dotfiles}"
|
||||||
: "${INSTALL_SCRIPT:=$DOTFILES/install.sh}"
|
: "${INSTALL_SCRIPT:=$DOTFILES/scripts/install.sh}"
|
||||||
: "${BREWFILE:=$DOTFILES/Brewfile}"
|
: "${BREWFILE:=$DOTFILES/Brewfile}"
|
||||||
|
|
||||||
function usage
|
SCRIPT=$(basename "$0")
|
||||||
{
|
|
||||||
echo $"Usage: $0 [install | brew | dotfiles]"
|
|
||||||
echo $" All commands have their own subcommands."
|
|
||||||
echo $" When in doubt run the subcommand to show list."
|
|
||||||
}
|
|
||||||
|
|
||||||
function section_install
|
function section_install
|
||||||
{
|
{
|
||||||
USAGE_PREFIX="Usage: $0 install"
|
USAGE_PREFIX="-> $SCRIPT install"
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
all)
|
||||||
|
bash "$DOTFILES/scripts/settler.sh" && echo "🎉 Done!"
|
||||||
|
;;
|
||||||
antigen)
|
antigen)
|
||||||
curl -L git.io/antigen > "$DOTFILES/config/antigen.zsh" && echo "🎉 Done!"
|
curl -L git.io/antigen > "$DOTFILES/local/bin/antigen.zsh" && echo "🎉 Done!"
|
||||||
;;
|
;;
|
||||||
defaults)
|
defaults)
|
||||||
bash "$DOTFILES/scripts/set-defaults.sh" && echo "🎉 Done!"
|
bash "$DOTFILES/scripts/set-defaults.sh" && echo "🎉 Done!"
|
||||||
@@ -44,7 +42,7 @@ function section_install
|
|||||||
|
|
||||||
function section_brew
|
function section_brew
|
||||||
{
|
{
|
||||||
USAGE_PREFIX="Usage: $0 brew"
|
USAGE_PREFIX="-> $SCRIPT brew"
|
||||||
|
|
||||||
if ! command -v brew &> /dev/null; then
|
if ! command -v brew &> /dev/null; then
|
||||||
echo "brew could not be found, please install it first"
|
echo "brew could not be found, please install it first"
|
||||||
@@ -79,23 +77,24 @@ function section_brew
|
|||||||
|
|
||||||
function section_dotfiles
|
function section_dotfiles
|
||||||
{
|
{
|
||||||
USAGE_PREFIX="Usage: $0 dotfiles"
|
USAGE_PREFIX="-> $SCRIPT dotfiles"
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
link)
|
link)
|
||||||
rcup -B "$HOSTNAME" -v && echo "🎉 Done!"
|
rcup -B "$HOSTNAME" -v && echo "🎉 Done!"
|
||||||
;;
|
;;
|
||||||
update)
|
update)
|
||||||
# Updates .dotfiles/install.sh and formats it
|
# Updates .dotfiles/scripts/install.sh and formats it
|
||||||
rcup -B 0 -g \
|
rcup -B 0 -g \
|
||||||
| tee "$INSTALL_SCRIPT" 1> /dev/null \
|
| tee "$INSTALL_SCRIPT" 1> /dev/null \
|
||||||
&& shfmt -w -l "$INSTALL_SCRIPT" \
|
&& shfmt -w -l "$INSTALL_SCRIPT" \
|
||||||
&& sed -i '' "s|$HOME|\~|g" "$INSTALL_SCRIPT" \
|
&& sed -i '' "s|$HOME|\$HOME|g" "$INSTALL_SCRIPT" \
|
||||||
&& echo "🎉 Done!"
|
&& echo "🎉 Done!"
|
||||||
;;
|
;;
|
||||||
shfmt)
|
shfmt)
|
||||||
# Format shell scripts according to following rules.
|
# Format shell scripts according to following rules.
|
||||||
shfmt \
|
shfmt \
|
||||||
|
--find \
|
||||||
--list \
|
--list \
|
||||||
--write \
|
--write \
|
||||||
--diff \
|
--diff \
|
||||||
@@ -106,13 +105,7 @@ function section_dotfiles
|
|||||||
--case-indent \
|
--case-indent \
|
||||||
--space-redirects \
|
--space-redirects \
|
||||||
--func-next-line \
|
--func-next-line \
|
||||||
"$DOTFILES" \
|
"$DOTFILES"
|
||||||
"$DOTFILES/local/bin/dotfiles" \
|
|
||||||
"$DOTFILES/local/bin/x-check-git-attributes" \
|
|
||||||
"$DOTFILES/local/bin/x-open-ports" \
|
|
||||||
"$DOTFILES/config/alias" \
|
|
||||||
"$DOTFILES/config/exports" \
|
|
||||||
"$DOTFILES/config/functions"
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "$USAGE_PREFIX [link | update | shfmt]"
|
echo "$USAGE_PREFIX [link | update | shfmt]"
|
||||||
@@ -123,6 +116,18 @@ function section_dotfiles
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function usage
|
||||||
|
{
|
||||||
|
echo $"Usage: $SCRIPT [install | brew | dotfiles]"
|
||||||
|
echo $" All commands have their own subcommands."
|
||||||
|
echo ""
|
||||||
|
section_install
|
||||||
|
echo ""
|
||||||
|
section_brew
|
||||||
|
echo ""
|
||||||
|
section_dotfiles
|
||||||
|
}
|
||||||
|
|
||||||
# The main loop. first keyword after $0 triggers section, or help.
|
# The main loop. first keyword after $0 triggers section, or help.
|
||||||
case "$1" in
|
case "$1" in
|
||||||
install) section_install "$2" ;;
|
install) section_install "$2" ;;
|
||||||
43
local/bin/x-backup-mysql-with-prefix.sh
Executable file
43
local/bin/x-backup-mysql-with-prefix.sh
Executable file
@@ -0,0 +1,43 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Backup local MySQL Database tables with certain prefix.
|
||||||
|
# Ismo Vuorinen <https://github.com/ivuorinen> 2018
|
||||||
|
#
|
||||||
|
|
||||||
|
SCRIPT=$(basename "$0")
|
||||||
|
PREFIX=$1
|
||||||
|
FILENAME=$2
|
||||||
|
DATABASE=$3
|
||||||
|
|
||||||
|
: "${VERBOSE:=0}"
|
||||||
|
: "${DEFAULT_DATABASE:="wordpress"}"
|
||||||
|
|
||||||
|
if [ -z "${PREFIX}" ]; then
|
||||||
|
echo "(!) TABLE_PREFIX (first argument) is missing"
|
||||||
|
echo "(>) Usage: $SCRIPT <TABLE_PREFIX> <FILENAME_PREFIX> [<DATABASE>]"
|
||||||
|
echo " * <TABLE_PREFIX> = database table prefix, e.g. 'wp_'"
|
||||||
|
echo " * <FILENAME_PREFIX> = FILENAME prefix, defaults to table prefix. Use something descriptive e.g. 'wordpress'"
|
||||||
|
echo " * <DATABASE> = [optional] Third argument DATABASE, defaults to '$DEFAULT_DATABASE'."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "${FILENAME}" ]; then
|
||||||
|
# echo "FILENAME (second argument) is missing, using PREFIX ($PREFIX)"
|
||||||
|
FILENAME=$PREFIX
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "${DATABASE}" ]; then
|
||||||
|
# echo "DATABASE (third argument) is missing, using default ($DEFAULT_DATABASE)"
|
||||||
|
DATABASE=$DEFAULT_DATABASE
|
||||||
|
fi
|
||||||
|
|
||||||
|
TIMESTAMP=$(date "+%Y%m%d_%H%M%S")
|
||||||
|
FILENAME_TIMESTAMP="${DATABASE}_${FILENAME}_${TIMESTAMP}.sql"
|
||||||
|
|
||||||
|
mysqldump \
|
||||||
|
${DATABASE} \
|
||||||
|
"$(
|
||||||
|
echo "show tables like '${PREFIX}%';" \
|
||||||
|
| mysql ${DATABASE} \
|
||||||
|
| sed '/Tables_in/d'
|
||||||
|
)" > "${FILENAME_TIMESTAMP}"
|
||||||
@@ -1,6 +1,16 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Check git repo's files .gitattributes and are all of them mapped.
|
||||||
|
# Ismo Vuorinen <https://github.com/ivuorinen> 2022
|
||||||
|
#
|
||||||
|
|
||||||
|
if ! command -v git &> /dev/null; then
|
||||||
|
echo "git could not be found, please install it first"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
missing_attributes=$(git ls-files | git check-attr -a --stdin | grep "text: auto")
|
missing_attributes=$(git ls-files | git check-attr -a --stdin | grep "text: auto")
|
||||||
|
|
||||||
if [[ "$missing_attributes" ]]; then
|
if [[ "$missing_attributes" ]]; then
|
||||||
echo ".gitattributes rule missing for the following files:"
|
echo ".gitattributes rule missing for the following files:"
|
||||||
echo "$missing_attributes"
|
echo "$missing_attributes"
|
||||||
|
|||||||
52
local/bin/x-validate-sha256sum.sh
Normal file
52
local/bin/x-validate-sha256sum.sh
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
##
|
||||||
|
# This script contains helper for sha256 validating your downloads
|
||||||
|
#
|
||||||
|
# Source: https://gist.github.com/onnimonni/b49779ebc96216771a6be3de46449fa1
|
||||||
|
# Author: Onni Hakala
|
||||||
|
# License: MIT
|
||||||
|
#
|
||||||
|
# Updated by Ismo Vuorinen <https://github.com/ivuorinen> 2022
|
||||||
|
##
|
||||||
|
|
||||||
|
if ! command -v sha256 &> /dev/null; then
|
||||||
|
echo "git could not be found, please install it first"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Stop program and give error message
|
||||||
|
# $1 - error message (string)
|
||||||
|
function error
|
||||||
|
{
|
||||||
|
echo "(!) ERROR: $1"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# return sha256sum for file
|
||||||
|
# $1 - filename (string)
|
||||||
|
function get_sha256sum
|
||||||
|
{
|
||||||
|
sha256sum "$1" | head -c 64
|
||||||
|
}
|
||||||
|
|
||||||
|
# Good variable names pls
|
||||||
|
filename=$1
|
||||||
|
file_hash=$2
|
||||||
|
|
||||||
|
# Check input
|
||||||
|
if [ -z "$filename" ]; then
|
||||||
|
error "You need to provide filename in first parameter"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$file_hash" ]; then
|
||||||
|
error "You need to provide sha256sum in second parameter"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if the file is valid
|
||||||
|
if [ ! -f "$filename" ]; then
|
||||||
|
error "File $filename doesn't exist"
|
||||||
|
elif [ "$(get_sha256sum "$filename")" = "$file_hash" ]; then
|
||||||
|
echo "(*) Success: $filename matches provided sha256sum"
|
||||||
|
else
|
||||||
|
error "$filename doesn't match provided sha256sum"
|
||||||
|
fi
|
||||||
@@ -1,6 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Install GitHub CLI extensions
|
# Install GitHub CLI extensions
|
||||||
|
|
||||||
|
if ! command -v gh &> /dev/null; then
|
||||||
|
echo "gh (GitHub Client) could not be found, please install it first"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
extensions=(
|
extensions=(
|
||||||
# GitHub CLI extension for reviewing Dependabot PRs.
|
# GitHub CLI extension for reviewing Dependabot PRs.
|
||||||
einride/gh-dependabot
|
einride/gh-dependabot
|
||||||
|
|||||||
88
scripts/install.sh
Normal file
88
scripts/install.sh
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
#
|
||||||
|
# sh install.sh
|
||||||
|
#
|
||||||
|
# Environment variables: VERBOSE, CP, LN, MKDIR, RM, DIRNAME.
|
||||||
|
#
|
||||||
|
# env VERBOSE=1 sh install.sh
|
||||||
|
#
|
||||||
|
# DO NOT EDIT THIS FILE
|
||||||
|
#
|
||||||
|
# This file is generated by rcm(7) as:
|
||||||
|
#
|
||||||
|
# rcup -B 0 -g
|
||||||
|
#
|
||||||
|
# To update it, re-run the above command.
|
||||||
|
#
|
||||||
|
: ${VERBOSE:=0}
|
||||||
|
: ${CP:=/bin/cp}
|
||||||
|
: ${LN:=/bin/ln}
|
||||||
|
: ${MKDIR:=/bin/mkdir}
|
||||||
|
: ${RM:=/bin/rm}
|
||||||
|
: ${DIRNAME:=/usr/bin/dirname}
|
||||||
|
verbose()
|
||||||
|
{
|
||||||
|
if [ "$VERBOSE" -gt 0 ]; then
|
||||||
|
echo "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
handle_file_cp()
|
||||||
|
{
|
||||||
|
if [ -e "$2" ]; then
|
||||||
|
printf "%s " "overwrite $2? [yN]"
|
||||||
|
read overwrite
|
||||||
|
case "$overwrite" in
|
||||||
|
y)
|
||||||
|
$RM -rf "$2"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "skipping $2"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
verbose "'$1' -> '$2'"
|
||||||
|
$MKDIR -p "$($DIRNAME "$2")"
|
||||||
|
$CP -R "$1" "$2"
|
||||||
|
}
|
||||||
|
handle_file_ln()
|
||||||
|
{
|
||||||
|
if [ -e "$2" ]; then
|
||||||
|
printf "%s " "overwrite $2? [yN]"
|
||||||
|
read overwrite
|
||||||
|
case "$overwrite" in
|
||||||
|
y)
|
||||||
|
$RM -rf "$2"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "skipping $2"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
verbose "'$1' -> '$2'"
|
||||||
|
$MKDIR -p "$($DIRNAME "$2")"
|
||||||
|
$LN -sf "$1" "$2"
|
||||||
|
}
|
||||||
|
handle_file_ln "$HOME/.dotfiles/bash_profile" "$HOME/.bash_profile"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/bashrc" "$HOME/.bashrc"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/config/alias" "$HOME/.config/alias"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/config/exports" "$HOME/.config/exports"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/config/functions" "$HOME/.config/functions"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/config/gh/config.yml" "$HOME/.config/gh/config.yml"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/config/git/config" "$HOME/.config/git/config"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/config/git/gitignore" "$HOME/.config/git/gitignore"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/config/wtf/config.yml" "$HOME/.config/wtf/config.yml"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/git_profiles" "$HOME/.git_profiles"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/huskyrc" "$HOME/.huskyrc"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/local/bin/antigen.zsh" "$HOME/.local/bin/antigen.zsh"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/local/bin/dfm" "$HOME/.local/bin/dfm"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/local/bin/x-check-git-attributes" "$HOME/.local/bin/x-check-git-attributes"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/local/bin/x-open-ports" "$HOME/.local/bin/x-open-ports"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/rcrc" "$HOME/.rcrc"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/ssh/allowed_signers" "$HOME/.ssh/allowed_signers"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/ssh/config" "$HOME/.ssh/config"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/vuerc" "$HOME/.vuerc"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/zshrc" "$HOME/.zshrc"
|
||||||
@@ -125,9 +125,9 @@ defaults write com.apple.screensaver askForPasswordDelay -int 0
|
|||||||
defaults write com.apple.finder NewWindowTarget -string "PfDe"
|
defaults write com.apple.finder NewWindowTarget -string "PfDe"
|
||||||
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/Desktop/"
|
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/Desktop/"
|
||||||
|
|
||||||
# Show icons for hard drives, servers, and removable media on the desktop
|
# Show icons for external hard drives, servers, and removable media on the desktop
|
||||||
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
|
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
|
||||||
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true
|
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool false
|
||||||
defaults write com.apple.finder ShowMountedServersOnDesktop -bool true
|
defaults write com.apple.finder ShowMountedServersOnDesktop -bool true
|
||||||
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true
|
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true
|
||||||
|
|
||||||
@@ -194,8 +194,8 @@ defaults write com.apple.screencapture "name" -string "screenshot"
|
|||||||
# Prevent applications from bouncing in Dock
|
# Prevent applications from bouncing in Dock
|
||||||
defaults write com.apple.dock no-bouncing -bool true
|
defaults write com.apple.dock no-bouncing -bool true
|
||||||
|
|
||||||
# Set the icon size of Dock items to 72 pixels
|
# Set the icon size of Dock items to 30 pixels
|
||||||
defaults write com.apple.dock tilesize -int 72
|
defaults write com.apple.dock tilesize -int 30
|
||||||
|
|
||||||
# Hide indicator lights for open applications in the Dock
|
# Hide indicator lights for open applications in the Dock
|
||||||
defaults write com.apple.dock show-process-indicators -bool false
|
defaults write com.apple.dock show-process-indicators -bool false
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#
|
#
|
||||||
# Settler - my macOS setup automator
|
# Settler - my macOS setup automator
|
||||||
|
# Ismo Vuorinen <https://github.com/ivuorinen> 2018
|
||||||
|
|
||||||
# Ask for the administrator password upfront
|
# Ask for the administrator password upfront
|
||||||
sudo -v
|
sudo -v
|
||||||
@@ -42,8 +43,8 @@ else
|
|||||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
bash ../local/bin/dotfiles brew install && "Installed Brewfile contents"
|
bash ../local/bin/dfm brew install && "Installed Brewfile contents"
|
||||||
bash ../local/bin/dotfiles dotfiles link && "Linked all dotfiles"
|
bash ../local/bin/dfm dotfiles link && "Linked all dotfiles"
|
||||||
|
|
||||||
read -r -p "Do you want to set macOS defaults? (y/N) " yn
|
read -r -p "Do you want to set macOS defaults? (y/N) " yn
|
||||||
|
|
||||||
|
|||||||
3
zshrc
3
zshrc
@@ -42,7 +42,7 @@ x-load-configs
|
|||||||
ssh-add -A 2>/dev/null;
|
ssh-add -A 2>/dev/null;
|
||||||
|
|
||||||
# Try to load antigen, if present
|
# Try to load antigen, if present
|
||||||
[[ -f "$HOME/.config/antigen.zsh" ]] && source "$HOME/.config/antigen.zsh"
|
[[ -f "$HOME/.local/bin/antigen.zsh" ]] && source "$HOME/.local/bin/antigen.zsh"
|
||||||
|
|
||||||
# antigen is present
|
# antigen is present
|
||||||
if command -v antigen &> /dev/null; then
|
if command -v antigen &> /dev/null; then
|
||||||
@@ -64,6 +64,7 @@ if command -v antigen &> /dev/null; then
|
|||||||
hash docker 2>/dev/null && antigen bundle docker
|
hash docker 2>/dev/null && antigen bundle docker
|
||||||
|
|
||||||
hash nvm 2>/dev/null && antigen bundle Sparragus/zsh-auto-nvm-use
|
hash nvm 2>/dev/null && antigen bundle Sparragus/zsh-auto-nvm-use
|
||||||
|
hash python 2>/dev/null && antigen bundle MichaelAquilina/zsh-autoswitch-virtualenv
|
||||||
hash jq 2>/dev/null && antigen bundle reegnz/jq-zsh-plugin
|
hash jq 2>/dev/null && antigen bundle reegnz/jq-zsh-plugin
|
||||||
hash docker-compose 2>/dev/null && antigen bundle sroze/docker-compose-zsh-plugin
|
hash docker-compose 2>/dev/null && antigen bundle sroze/docker-compose-zsh-plugin
|
||||||
# antigen bundle voronkovich/phpcs.plugin.zsh
|
# antigen bundle voronkovich/phpcs.plugin.zsh
|
||||||
|
|||||||
Reference in New Issue
Block a user