mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-03-12 18:03:51 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e7578e4905 | |||
| 3fce0ac4dc |
@@ -13,11 +13,13 @@ if [ -z "${FILENAME}" ]; then
|
||||
FILENAME=$DIRECTORY
|
||||
fi
|
||||
|
||||
FILENAME=${FILENAME} \
|
||||
FILENAME=$(
|
||||
${FILENAME} \
|
||||
| tr '/' _ \
|
||||
| iconv -t ascii//TRANSLIT \
|
||||
| sed -r s/[^a-zA-Z0-9]+/_/g \
|
||||
| sed -r s/^_+\|-+$//g
|
||||
)
|
||||
|
||||
TIMESTAMP=$(date "+%Y%m%d_%H%M%S")
|
||||
FILENAME_TIMESTAMP="${FILENAME}_${TIMESTAMP}"
|
||||
|
||||
@@ -10,6 +10,14 @@ $fsCharLenght = 0;
|
||||
|
||||
$quota = shell_exec("quota -w");
|
||||
|
||||
/**
|
||||
* Pad string
|
||||
*
|
||||
* @param string $i Input string
|
||||
* @param int $n Length
|
||||
* @param string $p Padding string
|
||||
* @return string
|
||||
*/
|
||||
function pad($i, $n = 3, $p = ' ')
|
||||
{
|
||||
return str_pad($i, $n, $p, STR_PAD_LEFT);
|
||||
|
||||
@@ -4,20 +4,21 @@
|
||||
# shellcheck source="shared.sh"
|
||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
||||
|
||||
have php && {
|
||||
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
|
||||
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
|
||||
! have php && msg_err "PHP Not Available, cannot install composer" && exit 0;
|
||||
|
||||
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]; then
|
||||
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
|
||||
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
|
||||
|
||||
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]; then
|
||||
echo >&2 'ERROR: Invalid installer checksum'
|
||||
rm composer-setup.php
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
php composer-setup.php --quiet
|
||||
RESULT=$?
|
||||
rm composer-setup.php
|
||||
mv composer.phar ~/.local/bin/composer
|
||||
exit $RESULT
|
||||
|
||||
php composer-setup.php --quiet
|
||||
RESULT=$?
|
||||
rm composer-setup.php
|
||||
mv composer.phar ~/.local/bin/composer
|
||||
exit $RESULT
|
||||
} || msg_err "PHP Not Available, cannot install composer"
|
||||
|
||||
@@ -4,8 +4,11 @@
|
||||
# shellcheck source="shared.sh"
|
||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
||||
|
||||
have gh && {
|
||||
extensions=(
|
||||
! have gh \
|
||||
&& msg_err "gh (GitHub Client) could not be found, please install it first" \
|
||||
&& exit 0;
|
||||
|
||||
extensions=(
|
||||
# GitHub CLI extension for generating a report on repository dependencies.
|
||||
andyfeller/gh-dependency-report
|
||||
# GitHub CLI extension to generate montage from GitHub user avatars
|
||||
@@ -23,11 +26,11 @@ have gh && {
|
||||
# being an extension to view the overall health of
|
||||
# an organization's use of actions
|
||||
rsese/gh-actions-status
|
||||
)
|
||||
)
|
||||
|
||||
msg "Starting to install GitHub CLI extensions..."
|
||||
msg "Starting to install GitHub CLI extensions..."
|
||||
|
||||
for ext in "${extensions[@]}"; do
|
||||
for ext in "${extensions[@]}"; do
|
||||
# Trim spaces
|
||||
ext=${ext// /}
|
||||
# Skip comments
|
||||
@@ -36,10 +39,7 @@ have gh && {
|
||||
msg_run "Installing $ext"
|
||||
gh extensions install "$ext"
|
||||
echo ""
|
||||
done
|
||||
done
|
||||
|
||||
msg_ok "Done"
|
||||
}
|
||||
msg_ok "Done"
|
||||
|
||||
! have gh \
|
||||
&& msg_err "gh (GitHub Client) could not be found, please install it first"
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
# shellcheck source=shared.sh
|
||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
||||
|
||||
have go && {
|
||||
packages=(
|
||||
! have go && msg "go hasn't been installed yet." && exit 0;
|
||||
|
||||
packages=(
|
||||
# sysadmin/scripting utilities, distributed as a single binary
|
||||
github.com/skx/sysbox@latest
|
||||
# Git Profile allows you to switch between user profiles in git repos
|
||||
@@ -22,9 +23,9 @@ have go && {
|
||||
github.com/charmbracelet/glow@latest
|
||||
# Static checker for GitHub Actions workflow files
|
||||
github.com/rhysd/actionlint/cmd/actionlint@latest
|
||||
)
|
||||
)
|
||||
|
||||
for pkg in "${packages[@]}"; do
|
||||
for pkg in "${packages[@]}"; do
|
||||
# Trim spaces
|
||||
pkg=${pkg// /}
|
||||
# Skip comments
|
||||
@@ -33,9 +34,7 @@ have go && {
|
||||
msg_run "Installing go package:" "$pkg"
|
||||
go install "$pkg"
|
||||
echo ""
|
||||
done
|
||||
done
|
||||
|
||||
msg_ok "Done"
|
||||
}
|
||||
msg_ok "Done"
|
||||
|
||||
! have go && msg "go hasn't been installed yet."
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
# shellcheck source=shared.sh
|
||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
||||
|
||||
have npm && {
|
||||
packages=(
|
||||
! have npm && msg_err "npm could not be found." && exit 0;
|
||||
|
||||
packages=(
|
||||
# This is a tool to check if your files consider your .editorconfig rules.
|
||||
"editorconfig-checker"
|
||||
# Node module to create a release or a changelog from
|
||||
@@ -19,9 +20,9 @@ have npm && {
|
||||
# with linking, tagging, filtering, search, Git versioning & syncing,
|
||||
# Pandoc conversion, + more, in a single portable script.
|
||||
"nb.sh"
|
||||
)
|
||||
)
|
||||
|
||||
for pkg in "${packages[@]}"; do
|
||||
for pkg in "${packages[@]}"; do
|
||||
# Trim spaces
|
||||
pkg=${pkg// /}
|
||||
# Skip comments
|
||||
@@ -35,11 +36,9 @@ have npm && {
|
||||
fi
|
||||
|
||||
echo ""
|
||||
done
|
||||
done
|
||||
|
||||
msg_run "Upgrading all global packages"
|
||||
npm -g --no-progress --no-timing --no-fund outdated
|
||||
npm -g --no-timing --no-fund upgrade
|
||||
}
|
||||
msg_run "Upgrading all global packages"
|
||||
npm -g --no-progress --no-timing --no-fund outdated
|
||||
npm -g --no-timing --no-fund upgrade
|
||||
|
||||
! have npm && msg_err "npm could not be found."
|
||||
|
||||
@@ -6,32 +6,31 @@
|
||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
||||
set -e
|
||||
|
||||
have ntfy && msg "ntfy already installed"
|
||||
have ntfy && msg "ntfy already installed" && exit 0;
|
||||
|
||||
! have ntfy && {
|
||||
case $(dfm check arch) in
|
||||
case $(dfm check arch) in
|
||||
Linux)
|
||||
NTFY_ARCH="linux_$(arch)"
|
||||
;;
|
||||
Darwin)
|
||||
NTFY_ARCH="macOS_all"
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
|
||||
NTFY_VERSION=2.2.0
|
||||
NTFY_URL="https://github.com/binwiederhier/ntfy"
|
||||
NTFY_DEST="ntfy_${NTFY_VERSION}_${NTFY_ARCH}"
|
||||
NTFY_VERSION=2.2.0
|
||||
NTFY_URL="https://github.com/binwiederhier/ntfy"
|
||||
NTFY_DEST="ntfy_${NTFY_VERSION}_${NTFY_ARCH}"
|
||||
|
||||
curl -L "$NTFY_URL/releases/download/v${NTFY_VERSION}/${NTFY_DEST}.tar.gz" \
|
||||
curl -L "$NTFY_URL/releases/download/v${NTFY_VERSION}/${NTFY_DEST}.tar.gz" \
|
||||
> "${NTFY_DEST}.tar.gz"
|
||||
tar zxvf "${NTFY_DEST}.tar.gz"
|
||||
cp -a "${NTFY_DEST}/ntfy" ~/.local/bin/ntfy
|
||||
mkdir -p ~/.config/ntfy
|
||||
tar zxvf "${NTFY_DEST}.tar.gz"
|
||||
cp -a "${NTFY_DEST}/ntfy" ~/.local/bin/ntfy
|
||||
mkdir -p ~/.config/ntfy
|
||||
|
||||
# copy config only if it does not exist
|
||||
if [ ! -f "$HOME/.config/ntfy/client.yml" ]; then
|
||||
# copy config only if it does not exist
|
||||
if [ ! -f "$HOME/.config/ntfy/client.yml" ]; then
|
||||
cp "${NTFY_DEST}/client/client.yml" ~/.config/ntfy/client.yml
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -rf "${NTFY_DEST}" "${NTFY_DEST}.tar.gz"
|
||||
|
||||
rm -rf "${NTFY_DEST}" "${NTFY_DEST}.tar.gz"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user