Compare commits
11 Commits
a65cc2b84a
...
9a15113955
Author | SHA1 | Date |
---|---|---|
![]() |
9a15113955 | |
![]() |
f7d2944ed4 | |
![]() |
ae2ec14d46 | |
![]() |
09f92289cf | |
![]() |
71542eef9a | |
![]() |
a4efa9b733 | |
![]() |
fa49032c93 | |
![]() |
23827f2d1d | |
![]() |
d2c18372f4 | |
![]() |
20555a91c9 | |
![]() |
58e921ac4c |
|
@ -2,9 +2,11 @@
|
||||||
# It collects information about the system in order to determine
|
# It collects information about the system in order to determine
|
||||||
# which of the _home.* dirs will be set as the .chezmoiroot
|
# which of the _home.* dirs will be set as the .chezmoiroot
|
||||||
#
|
#
|
||||||
|
{{- $githubToken := promptStringOnce . "githubToken" "GITHUB TOKEN (Public/Read-Only)" -}}
|
||||||
{{- $scriptTempDir := "~/.cache/chezmoi/tmp" }}
|
{{- $scriptTempDir := "~/.cache/chezmoi/tmp" }}
|
||||||
{{- $chassisType := "desktop" }}
|
{{- $chassisType := "desktop" }}
|
||||||
{{- $sysType := "posix" }}
|
{{- $sysType := "posix" }}
|
||||||
|
{{- $sysVendor := "unknown" }}
|
||||||
{{- if eq .chezmoi.os "darwin" }}
|
{{- if eq .chezmoi.os "darwin" }}
|
||||||
{{- $sysType = "macos" }}
|
{{- $sysType = "macos" }}
|
||||||
{{- if contains "BatteryData" (output "ioreg" "-c" "AppleSmartBattery") }}
|
{{- if contains "BatteryData" (output "ioreg" "-c" "AppleSmartBattery") }}
|
||||||
|
@ -17,7 +19,7 @@
|
||||||
{{- else if eq .chezmoi.os "windows" }}
|
{{- else if eq .chezmoi.os "windows" }}
|
||||||
{{- $sysType = "windows" }}
|
{{- $sysType = "windows" }}
|
||||||
{{- $chassisType = (output "powershell.exe" "-NoProfile" "-NonInteractive" "-Command" "if ((Get-CimInstance -Class Win32_Battery | Measure-Object).Count -gt 0) { Write-Output 'laptop' } else { Write-Output 'desktop' }") | trim }}
|
{{- $chassisType = (output "powershell.exe" "-NoProfile" "-NonInteractive" "-Command" "if ((Get-CimInstance -Class Win32_Battery | Measure-Object).Count -gt 0) { Write-Output 'laptop' } else { Write-Output 'desktop' }") | trim }}
|
||||||
{{- end }}
|
{{- end -}}
|
||||||
|
|
||||||
scriptTempDir={{- $scriptTempDir | quote }}
|
scriptTempDir={{- $scriptTempDir | quote }}
|
||||||
|
|
||||||
|
@ -26,3 +28,6 @@ scriptTempDir={{- $scriptTempDir | quote }}
|
||||||
CZ_CHASSIS={{- $chassisType | quote }}
|
CZ_CHASSIS={{- $chassisType | quote }}
|
||||||
CZ_SYS={{- $sysType | quote }}
|
CZ_SYS={{- $sysType | quote }}
|
||||||
CZ_OS={{- .chezmoi.os | quote }}
|
CZ_OS={{- .chezmoi.os | quote }}
|
||||||
|
CHEZMOI_GITHUB_ACCESS_TOKEN={{- $githubToken | quote }}
|
||||||
|
GITHUB_ACCESS_TOKEN={{- $githubToken | quote }}
|
||||||
|
GITHUB_TOKEN={{- $githubToken | quote }}
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
# executable bool false Add executable_ attribute to file
|
# executable bool false Add executable_ attribute to file
|
||||||
# path string none Path to file in archive
|
# path string none Path to file in archive
|
||||||
|
|
||||||
|
{{- if not (env "OFFLINE") -}}
|
||||||
|
|
||||||
{{ $defaultRefresh := "168h" -}}
|
{{ $defaultRefresh := "168h" -}}
|
||||||
{{- $externals := dict -}}
|
{{- $externals := dict -}}
|
||||||
|
|
||||||
|
@ -56,6 +58,18 @@
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- with $repo := "knqyf263/pet" -}}
|
||||||
|
{{- with $version := trimPrefix "v" (gitHubLatestRelease $repo).GetTagName -}}
|
||||||
|
{{- $_ := set $externals ".local/bin/pet" (dict
|
||||||
|
"type" "archive-file"
|
||||||
|
"url" (printf "https://github.com/%s/releases/download/v%s/pet_%s_%s.tar.gz" $repo $version $version $myArch)
|
||||||
|
"path" "pet"
|
||||||
|
"executable" true
|
||||||
|
"refreshPeriod" $defaultRefresh
|
||||||
|
) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
{{ $myArch = "mac" }}
|
{{ $myArch = "mac" }}
|
||||||
|
|
||||||
{{- with $repo := "extrawurst/gitui" -}}
|
{{- with $repo := "extrawurst/gitui" -}}
|
||||||
|
@ -103,3 +117,7 @@
|
||||||
type: "file"
|
type: "file"
|
||||||
url: "https://raw.githubusercontent.com/dandavison/delta/refs/heads/main/themes.gitconfig"
|
url: "https://raw.githubusercontent.com/dandavison/delta/refs/heads/main/themes.gitconfig"
|
||||||
refreshPeriod: "{{ $defaultRefresh }}"
|
refreshPeriod: "{{ $defaultRefresh }}"
|
||||||
|
|
||||||
|
{{- else -}}
|
||||||
|
# .chezmoiexternal is disabled because OFFLINE env is defined
|
||||||
|
{{- end -}}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
../../../_src.posix/private_dot_config/pet/config.toml
|
|
@ -0,0 +1 @@
|
||||||
|
../../../_src.posix/private_dot_config/pet/snippet.toml
|
|
@ -0,0 +1 @@
|
||||||
|
../../../_src.posix/private_dot_config/sz.env/zza_pet.env
|
|
@ -1 +0,0 @@
|
||||||
../../../_src.posix/private_dot_config/sz.env/zzz_chezmoi.env
|
|
|
@ -0,0 +1 @@
|
||||||
|
../../../_src.posix/private_dot_config/sz.env/zzz_chezmoi.env.tmpl
|
|
@ -1 +0,0 @@
|
||||||
../../../_src.posix/private_dot_local/bin/executable_auto-copy-ssh-id
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
#! /usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
printf '%s\n' \
|
||||||
|
"${0#/*} - | [Address [... Address]]" \
|
||||||
|
"" \
|
||||||
|
"Perform copy-ssh-id where key based ssh auth is failing" \
|
||||||
|
""
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
REMOTE_HOST=("${@:--}")
|
||||||
|
|
||||||
|
if [[ "${#REMOTE_HOST}" -eq 1 && "${REMOTE_HOST[0]}" == '-' ]]; then
|
||||||
|
read -a REMOTE_HOST
|
||||||
|
fi
|
||||||
|
|
||||||
|
ssh_do() {
|
||||||
|
local USER="${1}" HOST="${2:?}"
|
||||||
|
# BLINDLY Trust host keys ( https://stackoverflow.com/a/74410573/799379 )
|
||||||
|
[ 1 -eq "${NO_REFRESH:-0}" ] || (
|
||||||
|
ssh-keygen -F "$HOST" &>/dev/null \
|
||||||
|
&& ssh-keygen -R "$HOST" &>/dev/null \
|
||||||
|
|| true
|
||||||
|
)
|
||||||
|
ssh-keygen -F "$HOST" &>/dev/null || (
|
||||||
|
ssh-keyscan -Ht ed25519 "$HOST" \
|
||||||
|
|| ssh-keyscan -H "$HOST"
|
||||||
|
) | grep -v '^#' >> "$HOME/.ssh/known_hosts"
|
||||||
|
|
||||||
|
SSH_ASKPASS_REQUIRE=never \
|
||||||
|
ssh \
|
||||||
|
-o PasswordAuthentication=no \
|
||||||
|
-o LogLevel=ERROR \
|
||||||
|
-o BatchMode=yes \
|
||||||
|
-o ConnectTimeout=2 \
|
||||||
|
-ttn \
|
||||||
|
"${USER:+${USER}@}${HOST}" -- "${@:3}" \
|
||||||
|
|| (
|
||||||
|
local XC=$?
|
||||||
|
printf '\n'
|
||||||
|
printf 'Exit code: %s\n' "$XC" >&2
|
||||||
|
return $XC
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _host in "${REMOTE_HOST[@]}"; do
|
||||||
|
printf '%-40s: ' "$_host"
|
||||||
|
if ssh_do "" "$_host" hostname &>/dev/null; then
|
||||||
|
echo "ready"
|
||||||
|
else
|
||||||
|
printf 'Attempting to copy SSH key...\n\n'
|
||||||
|
ssh-copy-id "$_host"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
|
@ -26,4 +26,3 @@ ip -j a s | jq -r '
|
||||||
| "\(.local)/\(.prefixlen)"
|
| "\(.local)/\(.prefixlen)"
|
||||||
)"
|
)"
|
||||||
'
|
'
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
#! /usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
# Arguments 'TO', optional user (can be configured in ~/.ssh/config.d/...), command to run over ssh
|
||||||
|
|
||||||
|
# Figure out the IPAddress I need to operate from
|
||||||
|
# Figure out the interface name to use
|
||||||
|
# Set the interface to the IP Address if not already setup
|
||||||
|
# Test with ping
|
||||||
|
# Connect with SSH
|
||||||
|
|
||||||
|
VASTHOST="${1}"
|
||||||
|
if [ -z "$VASTHOST" ]; then
|
||||||
|
VASTHOST=192.168.2.2
|
||||||
|
printf '%s\n' "VAST host argument not supplied, using default $VASTHOST..." >&2
|
||||||
|
elif [ "$VASTHOST" == "0" ]; then
|
||||||
|
printf '%s\n' "Removing:" ~/.ssh/vast.id_rsa*
|
||||||
|
rm ~/.ssh/vast.id_rsa* || true
|
||||||
|
cp ~/.ssh/id_rsa ~/.ssh/vast.id_rsa
|
||||||
|
cp ~/.ssh/id_rsa.pub ~/.ssh/vast.id_rsa.pub
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
set -x
|
||||||
|
scp vastdata@${VASTHOST}:.ssh/id_rsa ~/.ssh/vast.id_rsa
|
||||||
|
scp vastdata@${VASTHOST}:.ssh/id_rsa.pub ~/.ssh/vast.id_rsa.pub
|
|
@ -0,0 +1,136 @@
|
||||||
|
#! /usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
# Arguments 'TO', optional user (can be configured in ~/.ssh/config.d/...), command to run over ssh
|
||||||
|
|
||||||
|
# Figure out the IPAddress I need to operate from
|
||||||
|
# Figure out the interface name to use
|
||||||
|
# Set the interface to the IP Address if not already setup
|
||||||
|
# Test with ping
|
||||||
|
# Connect with SSH
|
||||||
|
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
printf '%s\n' \
|
||||||
|
"${0#/*} <TO> [<FROM>] [<Interface>]" \
|
||||||
|
"" \
|
||||||
|
"Configure MacOS iface to connect to <TO> address from <FROM> address" \
|
||||||
|
"Default <Interface> is en9" \
|
||||||
|
"" \
|
||||||
|
"FROM and FROM_SN will be autofilled for the following subnets:" \
|
||||||
|
" 10.117.10.0/24" \
|
||||||
|
" 192.168.[1 or 2].0/24" \
|
||||||
|
"" \
|
||||||
|
"for other subnets, you'll need to specify a FROM argument and a FROM_SN env variable" \
|
||||||
|
""
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
TO="${1}"
|
||||||
|
IFACE="${IFACE:-en9}"
|
||||||
|
PINGOK=1
|
||||||
|
CMDs=("${@:2}")
|
||||||
|
|
||||||
|
[ "${#CMDs}" -gt 0 ] || CMDs=( hostname )
|
||||||
|
|
||||||
|
_myip() {
|
||||||
|
lsip | awk "/${IFACE}/"'{split($3, a, "/"); print a[1];}'
|
||||||
|
}
|
||||||
|
|
||||||
|
_ping() {
|
||||||
|
ping -c "${PING_C:-3}" -W 250 "${TO}"
|
||||||
|
}
|
||||||
|
|
||||||
|
_log() {
|
||||||
|
printf '%s\n' \
|
||||||
|
"${@:2}" \
|
||||||
|
>&2
|
||||||
|
exit ${1}
|
||||||
|
}
|
||||||
|
|
||||||
|
if _ping &>/dev/null; then
|
||||||
|
printf "Connection detected.\n"
|
||||||
|
else
|
||||||
|
PINGOK=0
|
||||||
|
if [ "${FROM:-${2:-}}" == "dhcp" ]; then
|
||||||
|
FROM=dhcp
|
||||||
|
FROM_SN=auto
|
||||||
|
SLEEP="${SLEEP:-15s}"
|
||||||
|
else
|
||||||
|
SLEEP="${SLEEP:-3s}"
|
||||||
|
case "${TO}" in
|
||||||
|
10.117.10.*)
|
||||||
|
FROM=10.117.10.254
|
||||||
|
FROM_SN=255.255.255.0
|
||||||
|
;;
|
||||||
|
192.168.1.*)
|
||||||
|
FROM=192.168.1.254
|
||||||
|
FROM_SN=255.255.255.0
|
||||||
|
;;
|
||||||
|
192.168.2.*)
|
||||||
|
FROM=192.168.2.254
|
||||||
|
FROM_SN=255.255.255.0
|
||||||
|
;;
|
||||||
|
169.254.1.*)
|
||||||
|
FROM=169.254.1.15
|
||||||
|
FROM_SN=255.255.255.224
|
||||||
|
;;
|
||||||
|
169.254.111.*)
|
||||||
|
FROM=169.254.111.15
|
||||||
|
FROM_SN=255.255.255.224
|
||||||
|
;;
|
||||||
|
169.254.3.*)
|
||||||
|
FROM=169.254.3.254
|
||||||
|
FROM_SN=255.255.255.0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
FROM=${FROM:-${2:?FROM and FROM_SN Must be supplied for unknown IPv4 destination $1}}
|
||||||
|
FROM_SN=${FROM_SN:?FROM and FROM_SN Must be supplied for unknown IPv4 destination $1}
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
MYIP=''
|
||||||
|
MYIP="$(_myip)"
|
||||||
|
|
||||||
|
if [ "$FROM" == "$MYIP" ]; then
|
||||||
|
_log 2 "Already setup with $MYIP, but ping to $TO is failing, you'll need to troubleshoot this."
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$MYIP detected on $IFACE, Setting up $FROM / $FROM_SN - \`sudo\` might be prompting you for your password"
|
||||||
|
|
||||||
|
if [ "${FROM}" == "dhcp" ]; then
|
||||||
|
sudo ipconfig set "${IFACE}" bootp || true
|
||||||
|
sudo ipconfig set "${IFACE}" dhcp
|
||||||
|
else
|
||||||
|
sudo ipconfig set "${IFACE}" manual "${FROM}" "${FROM_SN}"
|
||||||
|
fi \
|
||||||
|
&& printf 'Waiting %s...' "${SLEEP}" \
|
||||||
|
&& sleep "${SLEEP}" \
|
||||||
|
&& MYIP="$(_myip)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $PINGOK -eq 0 ] && _ping &>/dev/null; then
|
||||||
|
PINGOK=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $PINGOK -eq 1 ]; then
|
||||||
|
# auto-copy-ssh-id "${TO}"
|
||||||
|
|
||||||
|
ssh-keygen -R "${TO}" || true
|
||||||
|
|
||||||
|
ssh \
|
||||||
|
-o PasswordAuthentication=no \
|
||||||
|
-o BatchMode=yes \
|
||||||
|
-o ConnectTimeout=2 \
|
||||||
|
-ttn \
|
||||||
|
"${TO}" -- "${CMDs[*]}" \
|
||||||
|
|| 1>&2 printf '%s\n' \
|
||||||
|
"Could not SSH into ${TO}, you might want to run 'pull-vast.id_rsa ${TO}' or 'auto-copy-ssh-id ${TO}'"
|
||||||
|
else
|
||||||
|
_log 2 "Ping faild."
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit
|
||||||
|
|
||||||
|
|
|
@ -1,33 +1,81 @@
|
||||||
{{- $sysname := promptStringOnce . "sysname" "System name" -}}
|
{{- $githubToken := (env "CHEZMOI_GITHUB_ACCESS_TOKEN") }}
|
||||||
{{- $sysgroup := promptStringOnce . "sysgroup" "System group" -}}
|
{{- if not ($githubToken) }}
|
||||||
{{- $sysarea := promptStringOnce . "sysarea" "System area" -}}
|
{{- $githubToken = (env "GITHUB_ACCESS_TOKEN") }}
|
||||||
{{- $gitEmail := promptStringOnce . "gitEmail" "email address (for git commits)" -}}
|
{{- end }}
|
||||||
{{- $gitName := promptStringOnce . "gitName" "Full name (for git commits)" -}}
|
{{- if not ($githubToken) }}
|
||||||
|
{{- $githubToken = (env "GITHUB_TOKEN") }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if not ($githubToken) }}
|
||||||
|
{{- $githubToken = promptStringOnce . "githubToken" "Public GITHUB token (mostly for rate limits - !insecure!)" }}
|
||||||
|
{{- end }}
|
||||||
|
{{- $sysname := promptStringOnce . "sysname" "System name" }}
|
||||||
|
{{- $sysgroup := promptStringOnce . "sysgroup" "System group" }}
|
||||||
|
{{- $sysarea := promptStringOnce . "sysarea" "System area" }}
|
||||||
|
{{- $gitEmail := promptStringOnce . "gitEmail" "email address (for git commits)" }}
|
||||||
|
{{- $gitName := promptStringOnce . "gitName" "Full name (for git commits)" }}
|
||||||
|
{{- $chassisType := "desktop" }}
|
||||||
|
{{- $sysType := "posix" }}
|
||||||
|
{{- $altArch := "aarch64" }}
|
||||||
|
{{- $sysVendor := "unknown" }}
|
||||||
|
{{- if eq .chezmoi.os "darwin" }}
|
||||||
|
{{- $sysType = "macos" }}
|
||||||
|
{{- $sysVendor = "apple" }}
|
||||||
|
{{- if contains "BatteryData" (output "ioreg" "-c" "AppleSmartBattery") }}
|
||||||
|
{{- $chassisType = "laptop" }}
|
||||||
|
{{- else }}
|
||||||
|
{{- $chassisType = "desktop" }}
|
||||||
|
{{- end }}
|
||||||
|
{{- else if eq .chezmoi.os "linux" }}
|
||||||
|
{{- $chassisType = (output "hostnamectl" "--json=short" | mustFromJson).Chassis }}
|
||||||
|
{{- else if eq .chezmoi.os "windows" }}
|
||||||
|
{{- $sysType = "windows" }}
|
||||||
|
{{- $sysVendor = "pc" }}
|
||||||
|
{{- $chassisType = (output "powershell.exe" "-NoProfile" "-NonInteractive" "-Command" "if ((Get-CimInstance -Class Win32_Battery | Measure-Object).Count -gt 0) { Write-Output 'laptop' } else { Write-Output 'desktop' }") | trim }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
{{- $scriptTempDir := "~/.cache/chezmoi/tmp" }}
|
{{- $scriptTempDir := "~/.cache/chezmoi/tmp" }}
|
||||||
scriptTempDir={{- $scriptTempDir | quote }}
|
scriptTempDir={{- $scriptTempDir | quote }}
|
||||||
|
|
||||||
[data]
|
[data]
|
||||||
|
{{- if ($altArch) }}
|
||||||
|
altArch={{- $altArch | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if ($chassisType) }}
|
||||||
|
chassisType={{- $chassisType | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if ($sysType) }}
|
||||||
|
sysType={{- $sysType | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if ($githubToken) }}
|
||||||
|
githubToken={{- $githubToken | quote }}
|
||||||
|
{{- end }}
|
||||||
{{- if ($sysname) }}
|
{{- if ($sysname) }}
|
||||||
sysname = {{ $sysname | quote }}
|
sysname = {{ $sysname | quote }}
|
||||||
{{- end -}}
|
{{- end }}
|
||||||
{{- if ($sysgroup) }}
|
{{- if ($sysgroup) }}
|
||||||
sysgroup = {{ $sysgroup | quote }}
|
sysgroup = {{ $sysgroup | quote }}
|
||||||
{{- end -}}
|
{{- end }}
|
||||||
{{- if ($sysarea) }}
|
{{- if ($sysarea) }}
|
||||||
sysarea = {{ $sysarea | quote }}
|
sysarea = {{ $sysarea | quote }}
|
||||||
{{ end -}}
|
{{ end }}
|
||||||
|
|
||||||
{{ if ($gitEmail) }}
|
{{ if ($gitEmail) }}
|
||||||
gitEmail = {{ $gitEmail | quote }}
|
gitEmail = {{ $gitEmail | quote }}
|
||||||
{{- end -}}
|
{{- end }}
|
||||||
{{- if ($gitName) }}
|
{{- if ($gitName) }}
|
||||||
gitName = {{ $gitName | quote }}
|
gitName = {{ $gitName | quote }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- if not ($githubToken) }}
|
||||||
|
githubToken={{- $githubToken | quote }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
[scriptEnv]
|
||||||
|
GITHUB_ACCESS_TOKEN={{- $githubToken | quote }}
|
||||||
|
GITHUB_TOKEN={{- $githubToken | quote }}
|
||||||
|
|
||||||
[diff]
|
[diff]
|
||||||
# command = "nvim"
|
# command = "nvim"
|
||||||
# args = ["-d", "{{- "{{ .Destination }}" -}}", "{{- "{{ .Target }}" -}}"]
|
# args = ["-d", "{{ "{{ .Destination }}" }}", "{{ "{{ .Target }}" }}"]
|
||||||
|
|
||||||
command = "delta"
|
command = "delta"
|
||||||
args = ["--paging=never", "{{ "{{ .Destination }}" }}", "{{ "{{ .Target }}" }}"]
|
args = ["--paging=never", "{{ "{{ .Destination }}" }}", "{{ "{{ .Target }}" }}"]
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
# executable bool false Add executable_ attribute to file
|
# executable bool false Add executable_ attribute to file
|
||||||
# path string none Path to file in archive
|
# path string none Path to file in archive
|
||||||
|
|
||||||
|
{{- if not (env "OFFLINE") -}}
|
||||||
|
|
||||||
{{ $defaultRefresh := "168h" -}}
|
{{ $defaultRefresh := "168h" -}}
|
||||||
{{- $externals := dict -}}
|
{{- $externals := dict -}}
|
||||||
|
|
||||||
|
@ -118,3 +120,7 @@
|
||||||
url: "https://github.com/neovim/neovim/releases/download/stable/nvim-linux-x86_64.appimage"
|
url: "https://github.com/neovim/neovim/releases/download/stable/nvim-linux-x86_64.appimage"
|
||||||
executable: true
|
executable: true
|
||||||
refreshPeriod: "{{ $defaultRefresh }}"
|
refreshPeriod: "{{ $defaultRefresh }}"
|
||||||
|
|
||||||
|
{{- else -}}
|
||||||
|
# .chezmoiexternal is disabled because OFFLINE env is defined
|
||||||
|
{{- end -}}
|
|
@ -0,0 +1,37 @@
|
||||||
|
[General]
|
||||||
|
Backend = "gist" # specify backend service to sync snippets (gist, ghe or gitlab, default: gist)
|
||||||
|
cmd = ["sh", "-c"] # specify the command to execute the snippet with
|
||||||
|
Color = false # enables output coloring with fzf, same as '--color' flag
|
||||||
|
Column = 40 # column size for list command
|
||||||
|
Editor = "vim" # your favorite text editor
|
||||||
|
Format = "[$description]: $command $tags" # controls the format of the output when searching
|
||||||
|
SelectCmd = "fzf --ansi --layout=reverse --border --height=90% --pointer=* --cycle --prompt=Snippets:" # selector command for edit command (fzf or peco)
|
||||||
|
SnippetDirs = []
|
||||||
|
SnippetFile = "/Users/gal.szkolnik/.config/pet/snippet.toml" # specify snippet path
|
||||||
|
SortBy = "" # specify how snippets get sorted (recency (default), -recency, description, -description, command, -command, output, -output)
|
||||||
|
|
||||||
|
[Gist]
|
||||||
|
file_name = "pet-snippet.toml"
|
||||||
|
access_token = "" # your access token
|
||||||
|
gist_id = "" # Gist ID
|
||||||
|
Public = false # public or priate
|
||||||
|
auto_sync = false # sync automatically when editing snippets
|
||||||
|
|
||||||
|
[GitLab]
|
||||||
|
file_name = "pet-snippet.toml" # specify GitLab Snippets file name
|
||||||
|
access_token = "XXXXXXXXXXXXX" # your access token
|
||||||
|
ID = "" # GitLab Snippets ID
|
||||||
|
Visibility = "private" # public or internal or private
|
||||||
|
auto_sync = false # sync automatically when editing snippets
|
||||||
|
|
||||||
|
Url = ""
|
||||||
|
skip_ssl = false
|
||||||
|
|
||||||
|
[GHEGist]
|
||||||
|
Public = false
|
||||||
|
access_token = ""
|
||||||
|
auto_sync = false
|
||||||
|
base_url = ""
|
||||||
|
file_name = ""
|
||||||
|
gist_id = ""
|
||||||
|
upload_url = ""
|
|
@ -0,0 +1,18 @@
|
||||||
|
|
||||||
|
[[Snippets]]
|
||||||
|
Description = "shell's nil"
|
||||||
|
Output = ""
|
||||||
|
Tag = []
|
||||||
|
command = ": ;"
|
||||||
|
|
||||||
|
[[Snippets]]
|
||||||
|
Description = "echo"
|
||||||
|
Output = ""
|
||||||
|
Tag = []
|
||||||
|
command = "echo"
|
||||||
|
|
||||||
|
[[Snippets]]
|
||||||
|
Description = "Initialize MacBook Pro connection into TechPort"
|
||||||
|
Output = ""
|
||||||
|
Tag = []
|
||||||
|
command = "lsif\nlsip\npull-vast.id_rsa 0\nvastconnect 192.168.2.2\nauto-copy-ssh-id 192.168.2.2"
|
|
@ -14,7 +14,7 @@ BASE_0=${BASE_0:-$0}
|
||||||
BASE_SHELL=$(basename "$SHELL")
|
BASE_SHELL=$(basename "$SHELL")
|
||||||
|
|
||||||
is_cmd() {
|
is_cmd() {
|
||||||
type -p -- "${@}" 2> /dev/null 1> /dev/null
|
type -p -- "${@}" 2> /dev/null 1> /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
if is_sourced; then
|
if is_sourced; then
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"'
|
||||||
|
|
||||||
|
BASE_SHELL=${BASE_SHELL:-${SHELL##*/}}
|
||||||
|
|
||||||
|
if is_cmd pet; then
|
||||||
|
. <( pet completion ${BASE_SHELL} )
|
||||||
|
|
||||||
|
[[ -n "${DBG}" ]] && echo "pet loaded."
|
||||||
|
fi
|
|
@ -5,6 +5,8 @@ if is_cmd 'chezmoi'; then
|
||||||
alias cz="chezmoi "
|
alias cz="chezmoi "
|
||||||
eval "$( chezmoi completion "${SHELL##*/}" | sed -Ee 's/(complete -o default .* chezmoi)/\1 cz/' )"
|
eval "$( chezmoi completion "${SHELL##*/}" | sed -Ee 's/(complete -o default .* chezmoi)/\1 cz/' )"
|
||||||
|
|
||||||
|
export CHEZMOI_GITHUB_ACCESS_TOKEN={{- .githubToken | quote }}
|
||||||
|
|
||||||
czcd() {
|
czcd() {
|
||||||
cd "$(chezmoi source-path "${@}")"
|
cd "$(chezmoi source-path "${@}")"
|
||||||
}
|
}
|
|
@ -22,8 +22,8 @@ ssh_do() {
|
||||||
ssh \
|
ssh \
|
||||||
-o PasswordAuthentication=no \
|
-o PasswordAuthentication=no \
|
||||||
-o LogLevel=ERROR \
|
-o LogLevel=ERROR \
|
||||||
-o BatchMode \
|
-o BatchMode=yes \
|
||||||
-o ConnectionTimeout=2 \
|
-o ConnectTimeout=2 \
|
||||||
-ttn \
|
-ttn \
|
||||||
"${USER:+${USER}@}${HOST}" -- "${@:3}" \
|
"${USER:+${USER}@}${HOST}" -- "${@:3}" \
|
||||||
|| (printf '\n'; printf 'Exit code: %s\n' "$?" >&2)
|
|| (printf '\n'; printf 'Exit code: %s\n' "$?" >&2)
|
||||||
|
|
13
symclone.sh
13
symclone.sh
|
@ -6,7 +6,15 @@ set -e
|
||||||
SRC_DIR=_src.posix
|
SRC_DIR=_src.posix
|
||||||
|
|
||||||
# Target directory (new structure with symlinks)
|
# Target directory (new structure with symlinks)
|
||||||
DEST_DIR="${1:?}"
|
DEST_DIR="${1}"
|
||||||
|
|
||||||
|
is_cmd() {
|
||||||
|
type -p -- "${@}" 2> /dev/null 1> /dev/null
|
||||||
|
}
|
||||||
|
if is_cmd chezmoi && [ -z "$DEST_DIR" ]; then
|
||||||
|
DEST_DIR="$(chezmoi data | jq -r '.chezmoi.sourceDir | split("/") | last')"
|
||||||
|
fi
|
||||||
|
DEST_DIR="${DEST_DIR:?Must supply dest dir name}"
|
||||||
|
|
||||||
# Check if both arguments are provided
|
# Check if both arguments are provided
|
||||||
if [[ -z "$SRC_DIR" || -z "$DEST_DIR" ]]; then
|
if [[ -z "$SRC_DIR" || -z "$DEST_DIR" ]]; then
|
||||||
|
@ -52,7 +60,8 @@ find "$SRC_DIR" -type f | while read -r file; do
|
||||||
src_relative_path=$(relpath "$file" "$(dirname "$DEST_DIR/$target_file")")
|
src_relative_path=$(relpath "$file" "$(dirname "$DEST_DIR/$target_file")")
|
||||||
|
|
||||||
# Create the symlink with relative path
|
# Create the symlink with relative path
|
||||||
ln -vs "$src_relative_path" "$DEST_DIR/$target_file"
|
[ -L "$DEST_DIR/$target_file" ] || ! [ -e "$DEST_DIR/$target_file" ] \
|
||||||
|
&& ln ${FORCE} -vs "$src_relative_path" "$DEST_DIR/$target_file"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Symbolic links created successfully in '$DEST_DIR'."
|
echo "Symbolic links created successfully in '$DEST_DIR'."
|
||||||
|
|
Loading…
Reference in New Issue