mirror of
https://github.com/webinstall/webi-installers.git
synced 2026-06-04 15:02:52 +00:00
Compare commits
1 Commits
add-dashco
...
beyond-she
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1750b92932 |
@@ -100,27 +100,27 @@ __webi_main() {
|
||||
|
||||
my_package="\${1:-}"
|
||||
if [ -z "\$my_package" ]; then
|
||||
echo >&2 "Usage: webi <package>@<version> ..."
|
||||
echo >&2 "Example: webi node@lts rg"
|
||||
>&2 echo "Usage: webi <package>@<version> ..."
|
||||
>&2 echo "Example: webi node@lts rg"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export WEBI_BOOT="\$(mktemp -d -t "\$my_package-bootstrap.\$WEBI_TIMESTAMP.XXXXXXXX")"
|
||||
|
||||
my_installer_url="\$WEBI_HOST/api/installers/\$my_package.sh?formats=\$my_ext"
|
||||
set +e
|
||||
if [ -n "\$WEBI_CURL" ]; then
|
||||
if ! curl -fsSL "\$my_installer_url" -H "User-Agent: curl \$WEBI_UA" \\
|
||||
-o "\$WEBI_BOOT/\$my_package-bootstrap.sh"; then
|
||||
echo >&2 "error fetching '\$my_installer_url'"
|
||||
exit 1
|
||||
fi
|
||||
curl -fsSL "\$my_installer_url" -H "User-Agent: curl \$WEBI_UA" \\
|
||||
-o "\$WEBI_BOOT/\$my_package-bootstrap.sh"
|
||||
else
|
||||
if ! wget -q "\$my_installer_url" --user-agent="wget \$WEBI_UA" \\
|
||||
-O "\$WEBI_BOOT/\$my_package-bootstrap.sh"; then
|
||||
echo >&2 "error fetching '\$my_installer_url'"
|
||||
exit 1
|
||||
fi
|
||||
wget -q "\$my_installer_url" --user-agent="wget \$WEBI_UA" \\
|
||||
-O "\$WEBI_BOOT/\$my_package-bootstrap.sh"
|
||||
fi
|
||||
if ! [ \$? -eq 0 ]; then
|
||||
>&2 echo "error fetching '\$my_installer_url'"
|
||||
exit 1
|
||||
fi
|
||||
set -e
|
||||
|
||||
(
|
||||
cd "\$WEBI_BOOT"
|
||||
@@ -133,10 +133,10 @@ __webi_main() {
|
||||
|
||||
show_path_updates() {
|
||||
|
||||
if test -z "\${_WEBI_CHILD}"; then
|
||||
if test -f "\$_webi_tmp/.PATH.env"; then
|
||||
my_paths=\$(sort -u < "\$_webi_tmp/.PATH.env")
|
||||
if test -n "\$my_paths"; then
|
||||
if ! [ -n "\${_WEBI_CHILD}" ]; then
|
||||
if [ -f "\$_webi_tmp/.PATH.env" ]; then
|
||||
my_paths=\$(cat "\$_webi_tmp/.PATH.env" | sort -u)
|
||||
if [ -n "\$my_paths" ]; then
|
||||
printf 'PATH.env updated with:\\n'
|
||||
printf "%s\\n" "\$my_paths"
|
||||
printf '\\n'
|
||||
@@ -199,7 +199,8 @@ __webi_main() {
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for pkgname in "\$@"; do
|
||||
for pkgname in "\$@"
|
||||
do
|
||||
webinstall "\$pkgname"
|
||||
done
|
||||
|
||||
|
||||
@@ -42,87 +42,24 @@ New-Item -Path .local\opt -ItemType Directory -Force | out-null
|
||||
# {{ baseurl }}
|
||||
# {{ version }}
|
||||
|
||||
function webi_path_add($pathname)
|
||||
function webi_add_path
|
||||
{
|
||||
# C:\Users\me => C:/Users/me
|
||||
$my_home = $Env:UserProfile
|
||||
$my_home = $my_home.replace('\\', '/')
|
||||
$my_home_re = [regex]::escape($my_home)
|
||||
|
||||
# ~/bin => %USERPROFILE%/bin
|
||||
$pathname = $pathname.replace('~/', "$Env:UserProfile/")
|
||||
|
||||
# C:\Users\me\bin => %USERPROFILE%/bin
|
||||
$my_pathname = $pathname.replace('\\', '/')
|
||||
$my_pathname = $my_pathname -ireplace $my_home_re, "%USERPROFILE%"
|
||||
|
||||
$all_user_paths = [Environment]::GetEnvironmentVariable("Path", "User")
|
||||
$user_paths = $all_user_paths -Split(';')
|
||||
$exists_in_path = $false
|
||||
foreach ($user_path in $user_paths)
|
||||
{
|
||||
# C:\Users\me\bin => %USERPROFILE%/bin
|
||||
$my_user_path = $user_path.replace('\\', '/')
|
||||
$my_user_path = $my_user_path -ireplace $my_home_re, "%USERPROFILE%"
|
||||
|
||||
if ($my_user_path -ieq $my_pathname)
|
||||
{
|
||||
$exists_in_path = $true
|
||||
}
|
||||
}
|
||||
if (-Not $exists_in_path)
|
||||
{
|
||||
$all_user_paths = $pathname + ";" + $all_user_paths
|
||||
[Environment]::SetEnvironmentVariable("Path", $all_user_paths, "User")
|
||||
}
|
||||
|
||||
$session_paths = $Env:Path -Split(';')
|
||||
$in_session_path = $false
|
||||
foreach ($session_path in $session_paths)
|
||||
{
|
||||
# C:\Users\me\bin => %USERPROFILE%/bin
|
||||
$my_session_path = $session_path.replace('\\', '/')
|
||||
$my_session_path = $my_session_path -ireplace $my_home_re, "%USERPROFILE%"
|
||||
|
||||
if ($my_session_path -ieq $my_pathname)
|
||||
{
|
||||
$in_session_path = $true
|
||||
}
|
||||
}
|
||||
|
||||
if (-Not $in_session_path)
|
||||
{
|
||||
$my_cmd = 'PATH ' + "$pathname" + ';%PATH%'
|
||||
$my_pwsh = '$Env:Path = "' + "$pathname" + ';$Env:Path"'
|
||||
|
||||
Write-Host ''
|
||||
Write-Host '**********************************' -ForegroundColor red -BackgroundColor white
|
||||
Write-Host '* IMPORTANT -- READ ME *' -ForegroundColor red -BackgroundColor white
|
||||
Write-Host '* (run the PATH command below) *' -ForegroundColor red -BackgroundColor white
|
||||
Write-Host '**********************************' -ForegroundColor red -BackgroundColor white
|
||||
Write-Host ''
|
||||
echo ""
|
||||
echo "Copy, paste, and run the appropriate command to update your PATH:"
|
||||
echo "(or close and reopen the terminal, or reboot)"
|
||||
echo ""
|
||||
echo "cmd.exe:"
|
||||
echo " $my_cmd"
|
||||
echo ""
|
||||
echo "PowerShell:"
|
||||
echo " $my_pwsh"
|
||||
echo ""
|
||||
}
|
||||
Write-Host ''
|
||||
Write-Host '*****************************' -ForegroundColor red -BackgroundColor white
|
||||
Write-Host '* IMPORTANT - READ ME *' -ForegroundColor red -BackgroundColor white
|
||||
Write-Host '*****************************' -ForegroundColor red -BackgroundColor white
|
||||
Write-Host ''
|
||||
& "$Env:USERPROFILE\.local\bin\pathman.exe" add "$args[0]"
|
||||
# Note: not all of these work as expected, so we use the unix-style, which is most consistent
|
||||
#& "$Env:USERPROFILE\.local\bin\pathman.exe" add ~/.local/bin
|
||||
#& "$Env:USERPROFILE\.local\bin\pathman.exe" add "$Env:USERPROFILE\.local\bin"
|
||||
#& "$Env:USERPROFILE\.local\bin\pathman.exe" add %USERPROFILE%\.local\bin
|
||||
}
|
||||
|
||||
#$has_local_bin = echo "$Env:PATH" | Select-String -Pattern '\.local.bin'
|
||||
#if (!$has_local_bin)
|
||||
#{
|
||||
webi_path_add ~/.local/bin
|
||||
#}
|
||||
# Run pathman to set up the folder
|
||||
& "$Env:USERPROFILE\.local\bin\pathman.exe" add ~/.local/bin
|
||||
|
||||
{{ installer }}
|
||||
|
||||
webi_path_add ~/.local/bin
|
||||
|
||||
# Done
|
||||
popd
|
||||
|
||||
@@ -251,179 +251,25 @@ __bootstrap_webi() {
|
||||
|
||||
# use 'pathman' to update $HOME/.config/envman/PATH.env
|
||||
webi_path_add() {
|
||||
my_path="${1}"
|
||||
# make sure that we don't recursively install pathman with webi
|
||||
my_path="$PATH"
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
|
||||
fn_envman_init
|
||||
|
||||
# \v was chosen as it is extremely unlikely for a filename
|
||||
# \1 could be an even better choice, but needs more testing.
|
||||
# (currently tested working on: linux & mac)
|
||||
# "\0001" should also work
|
||||
my_delim="$(
|
||||
printf '\v'
|
||||
)"
|
||||
|
||||
my_path_expanded="$(
|
||||
echo "${my_path}" |
|
||||
sed -e "s${my_delim}\$HOME${my_delim}$HOME${my_delim}g" \
|
||||
-e "s${my_delim}\${HOME}${my_delim}$HOME${my_delim}g" \
|
||||
-e "s${my_delim}^~/${my_delim}$HOME/${my_delim}g"
|
||||
)"
|
||||
|
||||
# A gift for @adamcstephens.
|
||||
# See https://github.com/webinstall/webi-installers/issues/322
|
||||
case "${PATH}" in
|
||||
# matches whether the first, a middle, the last, or the only PATH entry
|
||||
"${my_path_expanded}":* | \
|
||||
*:"${my_path_expanded}":* | \
|
||||
*:"${my_path_expanded}" | \
|
||||
"${my_path_expanded}")
|
||||
|
||||
if fn_is_defined_in_all_shells "${my_path}"; then
|
||||
return 0
|
||||
fi
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
my_path_export="$(
|
||||
echo "${my_path}" |
|
||||
sed -e "s${my_delim}${HOME}${my_delim}\$HOME${my_delim}g" \
|
||||
-e "s${my_delim}\${HOME}${my_delim}\$HOME${my_delim}g" \
|
||||
-e "s${my_delim}^~/${my_delim}\$HOME/${my_delim}g"
|
||||
)"
|
||||
|
||||
my_export="export PATH=\"$my_path_export:\$PATH\""
|
||||
if grep -q -F "${my_export}" ~/.config/envman/PATH.env; then
|
||||
return 0
|
||||
# install pathman if not already installed
|
||||
if [ -z "$(command -v pathman)" ]; then
|
||||
"$HOME/.local/bin/webi" pathman > /dev/null
|
||||
fi
|
||||
|
||||
echo "${my_export}" >> ~/.config/envman/PATH.env
|
||||
export PATH="$my_path"
|
||||
|
||||
# in case pathman was recently installed and the PATH not updated
|
||||
mkdir -p "$_webi_tmp"
|
||||
my_path_tilde="$(
|
||||
echo "${my_path}" |
|
||||
sed -e "s${my_delim}${HOME}${my_delim}~${my_delim}g"
|
||||
)"
|
||||
|
||||
if ! test -f "$_webi_tmp/.PATH.env" ||
|
||||
! grep -q -F "${my_path_tilde}" "$_webi_tmp/.PATH.env"; then
|
||||
echo "${my_path_tilde}" >> "$_webi_tmp/.PATH.env"
|
||||
fi
|
||||
}
|
||||
|
||||
fn_envman_init() {
|
||||
mkdir -p ~/.config/envman/
|
||||
if ! test -e ~/.config/envman/PATH.env; then
|
||||
touch ~/.config/envman/PATH.env
|
||||
fi
|
||||
|
||||
if ! test -e ~/.config/envman/load.sh; then
|
||||
# shellcheck disable=SC2016
|
||||
{
|
||||
echo '# Generated for envman. Do not edit.'
|
||||
echo 'for x in ~/.config/envman/*.env; do'
|
||||
echo ' my_basename="$(basename "${x}")"'
|
||||
echo ' if [ "*.env" = "${my_basename}" ]; then'
|
||||
echo ' continue'
|
||||
echo ' fi'
|
||||
echo ''
|
||||
echo ' # shellcheck source=/dev/null'
|
||||
echo ' . "${x}"'
|
||||
echo 'done'
|
||||
} > ~/.config/envman/load.sh
|
||||
fi
|
||||
|
||||
if command -v sh > /dev/null; then
|
||||
if test -e ~/.profile; then
|
||||
if ! grep -q -F '/.config/envman/load.sh' ~/.profile; then
|
||||
fn_echo_load_sh >> ~/.profile
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if command -v bash > /dev/null; then
|
||||
if test -e ~/.bashrc; then
|
||||
if ! grep -q -F '/.config/envman/load.sh' ~/.bashrc; then
|
||||
fn_echo_load_sh >> ~/.bashrc
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if command -v zsh > /dev/null; then
|
||||
if test -e ~/.zshrc; then
|
||||
if ! grep -q -F '/.config/envman/load.sh' ~/.zshrc; then
|
||||
fn_echo_load_sh >> ~/.zshrc
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if command -v fish > /dev/null; then
|
||||
if test ! -e ~/.config/envman/load.fish; then
|
||||
# shellcheck disable=SC2016
|
||||
{
|
||||
echo '# Generated for envman. Do not edit.'
|
||||
echo 'for x in ~/.config/envman/*.env'
|
||||
echo ' source "$x"'
|
||||
echo 'end'
|
||||
} > ~/.config/envman/load.fish
|
||||
fi
|
||||
|
||||
mkdir -p ~/.config/fish
|
||||
if test -e ~/.config/fish/config.fish; then
|
||||
touch ~/.config/fish/config.fish
|
||||
fi
|
||||
if ! grep -q -F '/.config/envman/load.fish' ~/.config/fish/config.fish; then
|
||||
fn_echo_load_fish >> ~/.config/fish/config.fish
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
fn_echo_load_fish() {
|
||||
echo ''
|
||||
echo '# Generated for envman. Do not edit.'
|
||||
# shellcheck disable=SC2016
|
||||
echo 'test -s "$HOME/.config/envman/load.fish"; and source "$HOME/.config/envman/load.fish"'
|
||||
}
|
||||
|
||||
fn_echo_load_sh() {
|
||||
echo ''
|
||||
echo '# Generated for envman. Do not edit.'
|
||||
# shellcheck disable=SC2016
|
||||
echo '[ -s "$HOME/.config/envman/load.sh" ] && source "$HOME/.config/envman/load.sh"'
|
||||
}
|
||||
|
||||
fn_is_defined_in_all_shells() {
|
||||
my_path="${1}"
|
||||
|
||||
my_path_expanded="$(
|
||||
echo "${my_path}" |
|
||||
sed -e "s${my_delim}\$HOME|${my_delim}$HOME${my_delim}g" \
|
||||
-e "s${my_delim}\${HOME}${my_delim}$HOME${my_delim}g" \
|
||||
-e "s${my_delim}^~/${my_delim}$HOME/${my_delim}g"
|
||||
)"
|
||||
my_paths="$(
|
||||
echo "${my_path_expanded}"
|
||||
# $HOME/foo
|
||||
echo "${my_path_expanded}" |
|
||||
sed "s${my_delim}${HOME}${my_delim}\$HOME${my_delim}g"
|
||||
# ${HOME}/foo
|
||||
echo "${my_path_expanded}" |
|
||||
sed "s${my_delim}${HOME}${my_delim}\${HOME}${my_delim}g"
|
||||
echo "${my_path}"
|
||||
)"
|
||||
|
||||
my_confs="$(
|
||||
echo "${HOME}/.profile"
|
||||
echo "${HOME}/.bashrc"
|
||||
echo "${HOME}/.zshrc"
|
||||
echo "${HOME}/.config/fish/config.fish"
|
||||
)"
|
||||
for my_conf in $my_confs; do
|
||||
if test -e "${my_conf}"; then
|
||||
if ! grep -q -F "${my_paths}" "${my_conf}"; then
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
# 'true' to prevent "too few arguments" output
|
||||
# when there are 0 lines of stdout
|
||||
"$HOME/.local/bin/pathman" add "$1" |
|
||||
grep "export" 2> /dev/null \
|
||||
>> "$_webi_tmp/.PATH.env" ||
|
||||
true
|
||||
}
|
||||
|
||||
# group common pre-install tasks as default
|
||||
@@ -586,9 +432,7 @@ __bootstrap_webi() {
|
||||
if [ -z "${_WEBI_CHILD-}" ] && [ -f "$_webi_tmp/.PATH.env" ]; then
|
||||
if [ -n "$(cat "$_webi_tmp/.PATH.env")" ]; then
|
||||
printf 'PATH.env updated with:\n'
|
||||
sort -u "$_webi_tmp/.PATH.env" | while read -r my_new_path; do
|
||||
echo " ${my_new_path}"
|
||||
done
|
||||
sort -u "$_webi_tmp/.PATH.env"
|
||||
printf "\n"
|
||||
|
||||
rm -f "$_webi_tmp/.PATH.env"
|
||||
|
||||
@@ -229,7 +229,7 @@ module.exports = function getReleases({
|
||||
})
|
||||
.then(function (releases) {
|
||||
if (!releases.length) {
|
||||
// Apple Silicon M1 hacky-do workaround fix
|
||||
// Apple Silicon M1 hack-y do workaround fix
|
||||
if ('macos' === os && 'arm64' === arch) {
|
||||
return getReleases({
|
||||
pkg,
|
||||
@@ -242,19 +242,6 @@ module.exports = function getReleases({
|
||||
limit,
|
||||
});
|
||||
}
|
||||
// Windows ARM hacky-do workaround fix
|
||||
if ('windows' === os && 'arm64' === arch) {
|
||||
return getReleases({
|
||||
pkg,
|
||||
ver,
|
||||
os,
|
||||
arch: 'amd64',
|
||||
lts,
|
||||
channel,
|
||||
formats,
|
||||
limit,
|
||||
});
|
||||
}
|
||||
// Raspberry Pi 3+ on Raspbian x86 (not Ubuntu arm64)
|
||||
if (!_count && 'linux' === os && 'armv7l' === arch) {
|
||||
return getReleases({
|
||||
|
||||
@@ -17,17 +17,7 @@ IF ($my_arch -eq $null -or $my_arch -eq "") {
|
||||
# This is the canonical CPU arch when the process is native
|
||||
$my_arch = "$Env:PROCESSOR_ARCHITECTURE"
|
||||
}
|
||||
IF ($my_arch -eq "AMD64") {
|
||||
# Because PowerShell isn't ARM yet.
|
||||
# See https://oofhours.com/2020/02/04/powershell-on-windows-10-arm64/
|
||||
$my_os_arch = wmic os get osarchitecture
|
||||
|
||||
# Using -clike because of the trailing newline
|
||||
IF ($my_os_arch -clike "ARM 64*") {
|
||||
$my_arch = "ARM64"
|
||||
}
|
||||
}
|
||||
|
||||
# TODO API should know to prefer x86 for windows when arm binary is not available
|
||||
$Env:WEBI_UA = "Windows/10 $my_arch"
|
||||
$exename = $args[0]
|
||||
|
||||
@@ -60,6 +50,27 @@ IF($Env:WEBI_HOST -eq $null -or $Env:WEBI_HOST -eq "")
|
||||
$Env:WEBI_HOST = "https://webinstall.dev"
|
||||
}
|
||||
|
||||
if (!(Test-Path -Path .local\bin\pathman.exe))
|
||||
{
|
||||
& curl.exe -fsSL -A "$Env:WEBI_UA" "$Env:WEBI_HOST/packages/pathman/install.ps1" -o .\.local\tmp\pathman-setup.ps1
|
||||
powershell .\.local\tmp\pathman-setup.ps1
|
||||
# TODO del .\.local\tmp\pathman-setup.bat
|
||||
}
|
||||
|
||||
# Run pathman to set up the folder
|
||||
# (using unix style path because... cmd vs powershell vs whatever)
|
||||
$has_local_bin = echo "$Env:PATH" | Select-String -Pattern '\.local.bin'
|
||||
if (!$has_local_bin)
|
||||
{
|
||||
Write-Host ''
|
||||
Write-Host '**********************************' -ForegroundColor red -BackgroundColor white
|
||||
Write-Host '* IMPORTANT -- READ ME *' -ForegroundColor red -BackgroundColor white
|
||||
Write-Host '* (run the PATH command below) *' -ForegroundColor red -BackgroundColor white
|
||||
Write-Host '**********************************' -ForegroundColor red -BackgroundColor white
|
||||
Write-Host ''
|
||||
& "$Env:USERPROFILE\.local\bin\pathman.exe" add ~/.local/bin
|
||||
}
|
||||
|
||||
# {{ baseurl }}
|
||||
# {{ version }}
|
||||
|
||||
|
||||
@@ -10,7 +10,18 @@ pushd "%userprofile%" || goto :error
|
||||
mkdir .local\opt || goto :error
|
||||
)
|
||||
|
||||
echo Downloading and installing %1
|
||||
pushd .local\bin || goto :error
|
||||
if NOT EXIST pathman.exe (
|
||||
echo updating PATH management
|
||||
powershell $ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest https://webinstall.dev/packages/pathman/install.bat -OutFile pathman-setup.bat || goto :error
|
||||
call .\pathman-setup.bat || goto :error
|
||||
del pathman-setup.bat || goto :error
|
||||
rem TODO there's rumor of a windows tool called 'pathman' that does the same thing?
|
||||
)
|
||||
popd || goto :error
|
||||
.\.local\bin\pathman add ".local\bin" || goto :error
|
||||
|
||||
echo downloading and installing %1
|
||||
powershell $ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest https://webinstall.dev/packages/%1/install.ps1 -OutFile %1-webinstall.bat || goto :error
|
||||
|
||||
rem TODO only add if it's not in there already
|
||||
|
||||
@@ -78,6 +78,3 @@ recommended.
|
||||
- [iterm2](/iterm2)
|
||||
- [fish](/fish)
|
||||
- [NerdFont](/nerdfont)
|
||||
- git
|
||||
- vim
|
||||
- zip
|
||||
|
||||
@@ -90,85 +90,22 @@ fn_node_install() { (
|
||||
fi
|
||||
); }
|
||||
|
||||
fn_git_install() { (
|
||||
if [ "Darwin" = "$(uname -s)" ]; then
|
||||
needs_xcode="$(
|
||||
/usr/bin/xcode-select -p > /dev/null 2> /dev/null || echo "true"
|
||||
)"
|
||||
if [ -n "${needs_xcode}" ]; then
|
||||
echo ""
|
||||
echo ""
|
||||
printf "\e[31m[Error]\e[0m: Run this command to install XCode Command Line Tools first:\n"
|
||||
echo ""
|
||||
echo " xcode-select --install"
|
||||
echo ""
|
||||
echo "After the install, close this terminal, open a new one, and try again."
|
||||
echo ""
|
||||
exit 1
|
||||
else
|
||||
my_git="$(command -v git)"
|
||||
echo "[Info] Found ${my_git}"
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
|
||||
if ! command -v git > /dev/null; then
|
||||
fn_apt_get git git
|
||||
return 0
|
||||
fi
|
||||
|
||||
my_git="$(command -v git)"
|
||||
echo "[Info] Found ${my_git}"
|
||||
); }
|
||||
|
||||
fn_apt_get() { (
|
||||
my_cmd="${1:-}"
|
||||
my_pkg="${2:-}"
|
||||
|
||||
printf "\e[31m[Warning]\e[0m \e[32m%s\e[0m not found\n" "${my_cmd}"
|
||||
|
||||
printf "\e[32m[Fixup]\e[0m install \e[34m%s\e[0m (may require password)\n" "${my_pkg}"
|
||||
sleep 1
|
||||
|
||||
echo "sudo apt-get install ${my_pkg}"
|
||||
|
||||
# shellcheck disable=SC2030
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
if ! sudo apt-get install -qq -y -o=Dpkg::Use-Pty=0 "${my_pkg}"; then
|
||||
echo "failed to install ${my_cmd} on"
|
||||
cat /etc/issue
|
||||
fi
|
||||
); }
|
||||
|
||||
fn_vim_install() { (
|
||||
if command -v vim > /dev/null; then
|
||||
my_vim="$(command -v vim)"
|
||||
echo "[Info] Found ${my_vim}"
|
||||
return 0
|
||||
fi
|
||||
fn_apt_get vim vim
|
||||
); }
|
||||
|
||||
fn_zip_install() { (
|
||||
if command -v zip > /dev/null; then
|
||||
my_zip="$(command -v zip)"
|
||||
echo "[Info] Found ${my_zip}"
|
||||
return 0
|
||||
fi
|
||||
fn_apt_get zip zip
|
||||
); }
|
||||
|
||||
fn_fish_install() { (
|
||||
if ! command -v fish > /dev/null; then
|
||||
printf "\e[31m[Warning]\e[0m \e[32mfish\e[0m not found\n"
|
||||
|
||||
printf "\e[32m[Fixup]\e[0m install \e[34mfish\e[0m (may require password)\n"
|
||||
sleep 1
|
||||
|
||||
if [ "Darwin" = "$(uname -s)" ]; then
|
||||
printf "\e[31m[Warning]\e[0m \e[32mfish\e[0m not found\n"
|
||||
|
||||
printf "\e[32m[Fixup]\e[0m install \e[34mfish\e[0m\n"
|
||||
sleep 1
|
||||
|
||||
"${webi_cmd}" fish > /dev/null
|
||||
"${webi_cmd}" fish
|
||||
else
|
||||
fn_apt_get fish fish
|
||||
echo sudo apt-get install fish
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
if ! sudo apt-get install -qq -y -o=Dpkg::Use-Pty=0 fish; then
|
||||
echo "failed to install fish on"
|
||||
cat /etc/issue
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -339,19 +276,12 @@ __install() {
|
||||
{
|
||||
printf "\e[32mwebi\e[0m at \e[32m%s\e[0m\n" '~'/.local/bin/webi
|
||||
echo ""
|
||||
echo "[Info] PATH updates in ~/.config/envman/PATH.env"
|
||||
|
||||
if [ "Darwin" = "$(uname -s)" ]; then
|
||||
if test -e /Applications/iTerm.app; then
|
||||
echo "[Info] Found iTerm.app in /Applications/"
|
||||
else
|
||||
printf "\e[32m[Fixup]\e[0m Installing \e[32m%s\e[0m into \e[34m%s\e[0m\n" "iTerm.app" "/Applications/"
|
||||
"${webi_cmd}" iterm2 > /dev/null
|
||||
fi
|
||||
"${webi_cmd}" iterm2
|
||||
fi
|
||||
|
||||
fn_git_install
|
||||
fn_fish_install
|
||||
fn_zip_install
|
||||
|
||||
if test -e ~/.local/share/fonts/'Droid Sans Mono for Powerline Nerd Font Complete.otf'; then
|
||||
echo "[Info] Found NerdFont in ~/.local/share/fonts"
|
||||
@@ -369,14 +299,13 @@ __install() {
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "[Info] PATH updates in ~/.config/envman/PATH.env"
|
||||
fn_path_bin
|
||||
fn_touch ~/.vimrc '~'/.vimrc
|
||||
fn_touch ~/.config/envman/alias.env '~'/.config/envman/alias.env
|
||||
fn_touch ~/.config/envman/PATH.env '~'/.config/envman/PATH.env
|
||||
|
||||
echo ""
|
||||
fn_node_install
|
||||
for my_cmd in aliasman bat curlie jq pathman ssh-pubkey; do
|
||||
for my_cmd in aliasman bat curlie jq pathman shfmt@3.5 shellcheck ssh-pubkey; do
|
||||
fn_webi_bin "${my_cmd}"
|
||||
done
|
||||
|
||||
@@ -388,8 +317,6 @@ __install() {
|
||||
|
||||
# vim config and plugins
|
||||
echo ""
|
||||
fn_vim_install
|
||||
fn_touch ~/.vimrc '~'/.vimrc
|
||||
for my_plugin in leader shell; do
|
||||
fn_webi_vimrc "${my_plugin}"
|
||||
done
|
||||
@@ -401,9 +328,6 @@ __install() {
|
||||
for my_plugin in commentary lastplace shfmt prettier; do
|
||||
fn_webi_vim_plugin "${my_plugin}"
|
||||
done
|
||||
for my_cmd in shfmt@3.5 shellcheck; do
|
||||
fn_webi_bin "${my_cmd}"
|
||||
done
|
||||
|
||||
} | tee -a "${my_log}"
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
---
|
||||
title: dash-cli (alias)
|
||||
homepage: https://webinstall.dev/dashcore
|
||||
tagline: |
|
||||
`dash-cli` (dash daemon) is an alias for `dashcore` (the dash suite)
|
||||
alias: dashcore
|
||||
---
|
||||
|
||||
See [Dash Core](/dashcore).
|
||||
@@ -1,3 +0,0 @@
|
||||
echo "'dash-cli@$Env:WEBI_TAG' is an alias for 'dashcore@$Env:WEBI_VERSION'"
|
||||
IF ($Env:WEBI_HOST -eq $null -or $Env:WEBI_HOST -eq "") { $Env:WEBI_HOST = "https://webinstall.dev" }
|
||||
curl.exe -fsSL "$Env:WEBI_HOST/dashcore@$Env:WEBI_VERSION" | powershell
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -u
|
||||
|
||||
function __redirect_alias_dashcore() {
|
||||
echo "'dash-cli@${WEBI_TAG:-}' (project) is an alias for 'dashcore@${WEBI_VERSION:-}' (command)"
|
||||
WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"}
|
||||
curl -fsSL "$WEBI_HOST/dashcore@${WEBI_VERSION:-}" | bash
|
||||
}
|
||||
|
||||
__redirect_alias_dashcore
|
||||
@@ -1,3 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('../dashcore/releases.js');
|
||||
@@ -1,9 +0,0 @@
|
||||
---
|
||||
title: dash-qt (alias)
|
||||
homepage: https://webinstall.dev/dashcore
|
||||
tagline: |
|
||||
`dash-qt` (dash daemon) is an alias for `dashcore` (the dash suite)
|
||||
alias: dashcore
|
||||
---
|
||||
|
||||
See [Dash Core](/dashcore).
|
||||
@@ -1,3 +0,0 @@
|
||||
echo "'dash-qt@$Env:WEBI_TAG' is an alias for 'dashcore@$Env:WEBI_VERSION'"
|
||||
IF ($Env:WEBI_HOST -eq $null -or $Env:WEBI_HOST -eq "") { $Env:WEBI_HOST = "https://webinstall.dev" }
|
||||
curl.exe -fsSL "$Env:WEBI_HOST/dashcore@$Env:WEBI_VERSION" | powershell
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -u
|
||||
|
||||
function __redirect_alias_dashcore() {
|
||||
echo "'dash-qt@${WEBI_TAG:-}' (project) is an alias for 'dashcore@${WEBI_VERSION:-}' (command)"
|
||||
WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"}
|
||||
curl -fsSL "$WEBI_HOST/dashcore@${WEBI_VERSION:-}" | bash
|
||||
}
|
||||
|
||||
__redirect_alias_dashcore
|
||||
@@ -1,3 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('../dashcore/releases.js');
|
||||
@@ -1,9 +0,0 @@
|
||||
---
|
||||
title: dash-wallet (alias)
|
||||
homepage: https://webinstall.dev/dashcore
|
||||
tagline: |
|
||||
`dash-wallet` (dash daemon) is an alias for `dashcore` (the dash suite)
|
||||
alias: dashcore
|
||||
---
|
||||
|
||||
See [Dash Core](/dashcore).
|
||||
@@ -1,3 +0,0 @@
|
||||
echo "'dash-wallet@$Env:WEBI_TAG' is an alias for 'dashcore@$Env:WEBI_VERSION'"
|
||||
IF ($Env:WEBI_HOST -eq $null -or $Env:WEBI_HOST -eq "") { $Env:WEBI_HOST = "https://webinstall.dev" }
|
||||
curl.exe -fsSL "$Env:WEBI_HOST/dashcore@$Env:WEBI_VERSION" | powershell
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -u
|
||||
|
||||
function __redirect_alias_dashcore() {
|
||||
echo "'dash-wallet@${WEBI_TAG:-}' (project) is an alias for 'dashcore@${WEBI_VERSION:-}' (command)"
|
||||
WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"}
|
||||
curl -fsSL "$WEBI_HOST/dashcore@${WEBI_VERSION:-}" | bash
|
||||
}
|
||||
|
||||
__redirect_alias_dashcore
|
||||
@@ -1,3 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('../dashcore/releases.js');
|
||||
@@ -1,9 +0,0 @@
|
||||
---
|
||||
title: Dash (alias)
|
||||
homepage: https://webinstall.dev/dashcore
|
||||
tagline: |
|
||||
`dash` (digital cash) is an alias for `dashcore` (the dash suite)
|
||||
alias: dashcore
|
||||
---
|
||||
|
||||
See [Dash Core](/dashcore).
|
||||
@@ -1,3 +0,0 @@
|
||||
echo "'dash@$Env:WEBI_TAG' is an alias for 'dashcore@$Env:WEBI_VERSION'"
|
||||
IF ($Env:WEBI_HOST -eq $null -or $Env:WEBI_HOST -eq "") { $Env:WEBI_HOST = "https://webinstall.dev" }
|
||||
curl.exe -fsSL "$Env:WEBI_HOST/dashcore@$Env:WEBI_VERSION" | powershell
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -u
|
||||
|
||||
function __redirect_alias_dashcore() {
|
||||
echo "'dash@${WEBI_TAG:-}' (project) is an alias for 'dashcore@${WEBI_VERSION:-}' (command)"
|
||||
WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"}
|
||||
curl -fsSL "$WEBI_HOST/dashcore@${WEBI_VERSION:-}" | bash
|
||||
}
|
||||
|
||||
__redirect_alias_dashcore
|
||||
@@ -1,3 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('../dashcore/releases.js');
|
||||
@@ -1,40 +0,0 @@
|
||||
---
|
||||
title: Dash Core
|
||||
homepage: https://github.com/dashpay/dash
|
||||
tagline: |
|
||||
foobar: An example that doesn't exist.
|
||||
---
|
||||
|
||||
To update or switch versions, run `webi dashcore@stable` (or `@v0.17`, `@beta`,
|
||||
etc).
|
||||
|
||||
### Files
|
||||
|
||||
These are the files / directories that are created and/or modified with this
|
||||
install:
|
||||
|
||||
```txt
|
||||
~/.config/envman/PATH.env
|
||||
~/.local/bin/
|
||||
~/.local/opt/dashcore/
|
||||
~/Library/Saved Application State/org.dash.Dash-Qt.savedState
|
||||
~/Library//Preferences/org.dash.Dash-Qt.plist
|
||||
```
|
||||
|
||||
## Cheat Sheet
|
||||
|
||||
> _Dash Core_ is a suite of tools for _Dash_, the international digital
|
||||
> currency.
|
||||
|
||||
The tools include:
|
||||
|
||||
- `dash-qt` the _Desktop Wallet_ for sending and receiving payments
|
||||
- `dash-cli` the _Command Line Wallet_
|
||||
- [`dashd`](/dashd) the ledger and transaction service
|
||||
- `dash-tx` the transaction debugger
|
||||
|
||||
To open the Dash Desktop Wallet:
|
||||
|
||||
```bash
|
||||
dash-qt
|
||||
```
|
||||
@@ -1,56 +0,0 @@
|
||||
#!/usr/bin/env pwsh
|
||||
|
||||
##################
|
||||
# Install dashcore #
|
||||
##################
|
||||
|
||||
# Every package should define these variables
|
||||
$pkg_cmd_name = "dashd"
|
||||
|
||||
$pkg_dst_cmd = "$Env:USERPROFILE\.local\opt\dashcore\bin\dashd.exe"
|
||||
$pkg_dst_dir = "$Env:USERPROFILE\.local\opt\dashcore"
|
||||
$pkg_dst = "$pkg_dst_cmd"
|
||||
|
||||
$pkg_src_cmd = "$Env:USERPROFILE\.local\opt\dashcore-v$Env:WEBI_VERSION\bin\dashd.exe"
|
||||
$pkg_src_bin = "$Env:USERPROFILE\.local\opt\dashcore-v$Env:WEBI_VERSION\bin"
|
||||
$pkg_src_dir = "$Env:USERPROFILE\.local\opt\dashcore-v$Env:WEBI_VERSION"
|
||||
$pkg_src = "$pkg_src_cmd"
|
||||
|
||||
New-Item "$Env:USERPROFILE\Downloads\webi" -ItemType Directory -Force | out-null
|
||||
$pkg_download = "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
|
||||
|
||||
# Fetch archive
|
||||
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"))
|
||||
{
|
||||
echo "Downloading dashcore from $Env:WEBI_PKG_URL to $pkg_download"
|
||||
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part"
|
||||
& move "$pkg_download.part" "$pkg_download"
|
||||
}
|
||||
|
||||
IF (!(Test-Path -Path "$pkg_src_dir"))
|
||||
{
|
||||
echo "Installing dashcore"
|
||||
|
||||
# TODO: create package-specific temp directory
|
||||
# Enter tmp
|
||||
pushd .local\tmp
|
||||
|
||||
# Remove any leftover tmp cruft
|
||||
Remove-Item -Path ".\dashcore*" -Recurse -ErrorAction Ignore
|
||||
|
||||
# Unpack archive file into this temporary directory
|
||||
# Windows BSD-tar handles zip. Imagine that.
|
||||
echo "Unpacking $pkg_download"
|
||||
& tar xf "$pkg_download"
|
||||
|
||||
# Settle unpacked archive into place
|
||||
echo "Install Location: $pkg_src_cmd"
|
||||
Move-Item -Path ".\dashcore*" -Destination "$pkg_src_dir"
|
||||
|
||||
# Exit tmp
|
||||
popd
|
||||
}
|
||||
|
||||
echo "Copying into '$pkg_dst_cmd' from '$pkg_src_cmd'"
|
||||
Remove-Item -Path "$pkg_dst_cmd" -Recurse -ErrorAction Ignore | out-null
|
||||
Copy-Item -Path "$pkg_src" -Destination "$pkg_dst" -Recurse
|
||||
@@ -1,45 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
# "'pkg_cmd_name' appears unused. Verify it or export it."
|
||||
|
||||
function __init_dashcore() {
|
||||
set -e
|
||||
set -u
|
||||
|
||||
##################
|
||||
# Install dashcore #
|
||||
##################
|
||||
|
||||
# Every package should define these 6 variables
|
||||
pkg_cmd_name="dashd"
|
||||
|
||||
pkg_dst_cmd="$HOME/.local/opt/dashcore/bin/dashd"
|
||||
pkg_dst_dir="$HOME/.local/opt/dashcore"
|
||||
pkg_dst="$pkg_dst_dir"
|
||||
|
||||
pkg_src_cmd="$HOME/.local/opt/dashcore-v$WEBI_VERSION/bin/dashd"
|
||||
pkg_src_dir="$HOME/.local/opt/dashcore-v$WEBI_VERSION"
|
||||
pkg_src="$pkg_src_dir"
|
||||
|
||||
# pkg_install must be defined by every package
|
||||
pkg_install() {
|
||||
# mv ./dashcore-* ~/.local/opt/dashcore-v0.17.0
|
||||
mv ./dashcore-* "${pkg_src_dir}"
|
||||
}
|
||||
|
||||
# pkg_get_current_version is recommended, but not required
|
||||
pkg_get_current_version() {
|
||||
# 'dashd --version' has output in this format:
|
||||
# Dash Core Daemon version v0.17.0.3
|
||||
# This trims it down to just the version number:
|
||||
# 0.17.0
|
||||
dashd --version 2> /dev/null |
|
||||
head -n 1 |
|
||||
cut -d ' ' -f 5 |
|
||||
sed 's:^v::'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
__init_dashcore
|
||||
@@ -1,28 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var github = require('../_common/github.js');
|
||||
var owner = 'dashpay';
|
||||
var repo = 'dash';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
all.releases = all.releases.filter(function (rel) {
|
||||
return !rel.name.endsWith('.asc');
|
||||
});
|
||||
all.releases.forEach(function (rel) {
|
||||
if (rel.name.includes('osx64')) {
|
||||
rel.os = 'macos';
|
||||
}
|
||||
});
|
||||
return all;
|
||||
});
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
// just select the first 5 for demonstration
|
||||
all.releases = all.releases.slice(0, 5);
|
||||
console.info(JSON.stringify(all, null, 2));
|
||||
});
|
||||
}
|
||||
116
dashd/README.md
116
dashd/README.md
@@ -1,116 +0,0 @@
|
||||
---
|
||||
title: dashd (alias)
|
||||
homepage: https://webinstall.dev/dashcore
|
||||
tagline: |
|
||||
`dashd` (dash daemon) is an alias for `dashcore` (the dash suite)
|
||||
alias: dashcore
|
||||
---
|
||||
|
||||
To update or switch versions, run `webi dashd@stable` (or `@v0.17`, `@beta`,
|
||||
etc).
|
||||
|
||||
### Files
|
||||
|
||||
These are the files / directories that are created and/or modified with this
|
||||
install:
|
||||
|
||||
```txt
|
||||
~/.config/envman/PATH.env
|
||||
~/.local/bin/
|
||||
~/.local/opt/dashcore/
|
||||
~/.dashcore/
|
||||
```
|
||||
|
||||
## Cheat Sheet
|
||||
|
||||
> The _Dash Daemon_ joins and listens on the Dash network for payment
|
||||
> transactions.
|
||||
|
||||
You will at least 2GB+ RAM + Swap (or 4GB+ without swap) and 50GB storage (20GB
|
||||
for the ledger + another 20gb for indices) for `dashd` to be able to provide
|
||||
transaction info and RPC services.
|
||||
|
||||
A first run will typically take _several_ hours to sync.
|
||||
|
||||
```bash
|
||||
dashd -- -conf=/home/app/.dashcore/dash.conf -datadir=/mnt/volume_100gb/dashcore/
|
||||
```
|
||||
|
||||
### How to configure dashd
|
||||
|
||||
`~/.dashcore/dash.conf`:
|
||||
|
||||
```txt
|
||||
rpcuser=dash
|
||||
rpcpassword=local321
|
||||
rpcallowip=127.0.0.1/0
|
||||
|
||||
#listen=1
|
||||
server=1
|
||||
#daemon=1
|
||||
|
||||
whitelist=127.0.0.1/0
|
||||
|
||||
# light mode
|
||||
#prune=945
|
||||
txindex=1
|
||||
addressindex=0
|
||||
timestampindex=0
|
||||
spentindex=0
|
||||
|
||||
zmqpubrawtx=tcp://127.0.0.1:28332
|
||||
zmqpubrawtxlock=tcp://127.0.0.1:28332
|
||||
zmqpubhashblock=tcp://127.0.0.1:28332
|
||||
#ip=
|
||||
rpcport=9998
|
||||
uacomment=bitcore
|
||||
#debug=1
|
||||
#testnet=1
|
||||
```
|
||||
|
||||
### How to run dashd as a system service
|
||||
|
||||
```bash
|
||||
sudo env PATH="${PATH}" \
|
||||
serviceman add --system --username "$(whoami)" --path "${PATH}" --name dashd -- \
|
||||
dashd -- -conf=/home/app/.dashcore/dash.conf -datadir=/mnt/volume_100gb/dashcore/
|
||||
```
|
||||
|
||||
### How to enable Swap Space
|
||||
|
||||
`dashd` takes a _lot_ of RAM during the initial sync phase. Once that is
|
||||
completed, it uses _significantly_ less for daily use.
|
||||
|
||||
If you want to save money you can give yourself 4GB+ Swap and although the sync
|
||||
process will run a little slower (but probably not that much), you'll be able to
|
||||
complete it using disk storage.
|
||||
|
||||
To create a swap file:
|
||||
|
||||
```bash
|
||||
sudo fallocate -l 8G /var/swapfile
|
||||
sudo chmod 0600 /var/swapfile
|
||||
sudo mkswap /var/swapfile
|
||||
```
|
||||
|
||||
To temporarily enable swap:
|
||||
|
||||
```bash
|
||||
sudo swapon /var/swapfile
|
||||
```
|
||||
|
||||
To permanently enable swap:
|
||||
|
||||
```bash
|
||||
sudo bash -c 'echo "/var/swapfile none swap sw 0 0" > /etc/fstab'
|
||||
```
|
||||
|
||||
To disable and delete swap:
|
||||
|
||||
```bash
|
||||
sudo swapoff /var/swapfile
|
||||
```
|
||||
|
||||
(don't forget to remove it from `/etc/fstab` as well)
|
||||
|
||||
See [vps-addswap](/vps-addswap) for details.
|
||||
@@ -1,3 +0,0 @@
|
||||
echo "'dashd@$Env:WEBI_TAG' is an alias for 'dashcore@$Env:WEBI_VERSION'"
|
||||
IF ($Env:WEBI_HOST -eq $null -or $Env:WEBI_HOST -eq "") { $Env:WEBI_HOST = "https://webinstall.dev" }
|
||||
curl.exe -fsSL "$Env:WEBI_HOST/dashcore@$Env:WEBI_VERSION" | powershell
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -u
|
||||
|
||||
function __redirect_alias_dashcore() {
|
||||
echo "'dashd@${WEBI_TAG:-}' (project) is an alias for 'dashcore@${WEBI_VERSION:-}' (command)"
|
||||
WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"}
|
||||
curl -fsSL "$WEBI_HOST/dashcore@${WEBI_VERSION:-}" | bash
|
||||
}
|
||||
|
||||
__redirect_alias_dashcore
|
||||
@@ -1,3 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('../dashcore/releases.js');
|
||||
@@ -38,3 +38,6 @@ IF (!(Test-Path -Path "$Env:USERPROFILE\.local\opt\$Env:PKG_NAME-v$Env:WEBI_VERS
|
||||
echo "Copying into '$Env:USERPROFILE\.local\bin\$Env:PKG_NAME.exe' from '$Env:USERPROFILE\.local\opt\$Env:PKG_NAME-v$Env:WEBI_VERSION.exe'"
|
||||
Remove-Item -Path "$Env:USERPROFILE\.local\bin\$Env:PKG_NAME.exe" -Recurse -ErrorAction Ignore
|
||||
Copy-Item -Path "$Env:USERPROFILE\.local\opt\$Env:PKG_NAME-v$Env:WEBI_VERSION.exe" -Destination "$Env:USERPROFILE\.local\bin\$Env:PKG_NAME.exe" -Recurse
|
||||
|
||||
# Add to path
|
||||
& "$Env:USERPROFILE\.local\bin\pathman.exe" add ~/.local/bin
|
||||
|
||||
@@ -49,5 +49,5 @@ fd -e md -e mkdn -e js -e mjs
|
||||
For options see:
|
||||
|
||||
```sh
|
||||
fd --help
|
||||
hexyl --help
|
||||
```
|
||||
|
||||
@@ -53,4 +53,6 @@ Remove-Item -Path "$pkg_dst" -Recurse -ErrorAction Ignore
|
||||
Copy-Item -Path "$pkg_src" -Destination "$pkg_dst" -Recurse
|
||||
|
||||
# Add to path
|
||||
webi_path_add ~/.local/opt/git/cmd
|
||||
& "$Env:USERPROFILE\.local\bin\pathman.exe" add ~/.local/opt/git/cmd
|
||||
#& "$Env:USERPROFILE\.local\bin\pathman.exe" add "$Env:USERPROFILE\.local\opt\git\cmd"
|
||||
#& "$Env:USERPROFILE\.local\bin\pathman.exe" add %USERPROFILE%\.local\opt\git\cmd
|
||||
|
||||
@@ -85,7 +85,11 @@ echo stringer
|
||||
& "$pkg_dst_cmd" install golang.org/x/tools/cmd/stringer
|
||||
|
||||
# Add to path
|
||||
webi_path_add ~/.local/opt/go/bin
|
||||
& "$Env:USERPROFILE\.local\bin\pathman.exe" add ~/.local/opt/go/bin
|
||||
#& "$Env:USERPROFILE\.local\bin\pathman.exe" add "$Env:USERPROFILE\.local\opt\go\bin"
|
||||
#& "$Env:USERPROFILE\.local\bin\pathman.exe" add %USERPROFILE%\.local\opt\go\bin
|
||||
|
||||
# Special to go: add default GOBIN to PATH
|
||||
webi_path_add ~/go/bin
|
||||
& "$Env:USERPROFILE\.local\bin\pathman.exe" add ~/go/bin
|
||||
#& "$Env:USERPROFILE\.local\bin\pathman.exe" add "$Env:USERPROFILE\go\bin"
|
||||
#& "$Env:USERPROFILE\.local\bin\pathman.exe" add %USERPROFILE%\go\bin
|
||||
|
||||
@@ -10,7 +10,7 @@ tagline: |
|
||||
> A font with a high number of extra glyphs from popular 'iconic fonts' such as
|
||||
> Font Awesome ➶, Devicons ➶, Octicons ➶, and others.
|
||||
|
||||

|
||||

|
||||
|
||||
This installs just "Droid Sans Mono for Powerline Nerd Font Complete.otf".
|
||||
|
||||
@@ -21,57 +21,57 @@ See [All Nerd Fonts](https://www.nerdfonts.com/font-downloads)
|
||||
view list
|
||||
</summary>
|
||||
|
||||
- [3270 Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/3270)
|
||||
- [Agave](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/Agave)
|
||||
- [Anonymice Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/AnonymousPro)
|
||||
- [Arimo](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/Arimo)
|
||||
- [Aurulent Sans Mono Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/AurulentSansMono)
|
||||
- [BigBlueTerminal](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/BigBlueTerminal)
|
||||
- [Bitstream Vera Sans Mono Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/BitstreamVeraSansMono)
|
||||
- [Blex\*](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/IBMPlexMono)
|
||||
- [Caskaydia Cove Nerd Font\*](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/CascadiaCode)
|
||||
- [Code New Roman Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/CodeNewRoman)
|
||||
- [Cousine Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/Cousine)
|
||||
- [DaddyTimeMono](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/DaddyTimeMono)
|
||||
- [DejaVu Sans Mono Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/DejaVuSansMono)
|
||||
- [Droid Sans Mono Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/DroidSansMono)
|
||||
- [Fantasque Sans Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/FantasqueSansMono)
|
||||
- [Fira Code Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/FiraCode)
|
||||
- [Fira Mono Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/FiraMono)
|
||||
- [Go Mono Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/Go-Mono)
|
||||
- [Gohu Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/Gohu)
|
||||
- [Hack Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/Hack)
|
||||
- [Hasklug Nerd Font\*](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/Hasklig)
|
||||
- [Heavy Data Mono Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/HeavyData)
|
||||
- [Hermut Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/Hermit)
|
||||
- [iM-Writing\*](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/iA-Writer)
|
||||
- [Inconsolata Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/Inconsolata)
|
||||
- [Inconsolata Go Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/InconsolataGo)
|
||||
- [Inconsolata LGC Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/InconsolataLGC)
|
||||
- [Iosevka Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/Iosevka)
|
||||
- [JetBrains Mono](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/JetBrainsMono)
|
||||
- [Lekton Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/Lekton)
|
||||
- [Literation Mono Nerd Font\*](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/LiberationMono)
|
||||
- [Meslo Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/Meslo)
|
||||
- [Monofur Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/Monofur)
|
||||
- [Monoid Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/Monoid)
|
||||
- [Mononoki Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/Mononoki)
|
||||
- [M+ (MPlus) Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/MPlus)
|
||||
- [Noto](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/Noto)
|
||||
- [OpenDyslexic](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/OpenDyslexic)
|
||||
- [Overpass](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/Overpass)
|
||||
- [ProFont (Windows tweaked) Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/ProFont)
|
||||
- [ProFont (x11) Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/ProFont)
|
||||
- [ProggyClean Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/ProggyClean)
|
||||
- [Roboto Mono](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/RobotoMono)
|
||||
- [Sauce Code Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/SourceCodePro)
|
||||
- [Shure Tech Mono Nerd Font\*](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/ShareTechMono)
|
||||
- [Space Mono Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/SpaceMono)
|
||||
- [Terminess Nerd Font\*](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/Terminus)
|
||||
- [Tinos](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/Tinos)
|
||||
- [Ubuntu Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/Ubuntu)
|
||||
- [Ubuntu Mono Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/UbuntuMono)
|
||||
- [Victor Mono](https://github.com/ryanoasis/nerd-fonts/blob/v2.3.3/patched-fonts/VictorMono)
|
||||
- [3270 Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/3270)
|
||||
- [Agave](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/Agave)
|
||||
- [Anonymice Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/AnonymousPro)
|
||||
- [Arimo](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/Arimo)
|
||||
- [Aurulent Sans Mono Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/AurulentSansMono)
|
||||
- [BigBlueTerminal](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/BigBlueTerminal)
|
||||
- [Bitstream Vera Sans Mono Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/BitstreamVeraSansMono)
|
||||
- [Blex\*](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/IBMPlexMono)
|
||||
- [Caskaydia Cove Nerd Font\*](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/CascadiaCode)
|
||||
- [Code New Roman Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/CodeNewRoman)
|
||||
- [Cousine Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/Cousine)
|
||||
- [DaddyTimeMono](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/DaddyTimeMono)
|
||||
- [DejaVu Sans Mono Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/DejaVuSansMono)
|
||||
- [Droid Sans Mono Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/DroidSansMono)
|
||||
- [Fantasque Sans Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/FantasqueSansMono)
|
||||
- [Fira Code Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/FiraCode)
|
||||
- [Fira Mono Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/FiraMono)
|
||||
- [Go Mono Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/Go-Mono)
|
||||
- [Gohu Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/Gohu)
|
||||
- [Hack Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/Hack)
|
||||
- [Hasklug Nerd Font\*](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/Hasklig)
|
||||
- [Heavy Data Mono Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/HeavyData)
|
||||
- [Hermut Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/Hermit)
|
||||
- [iM-Writing\*](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/iA-Writer)
|
||||
- [Inconsolata Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/Inconsolata)
|
||||
- [Inconsolata Go Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/InconsolataGo)
|
||||
- [Inconsolata LGC Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/InconsolataLGC)
|
||||
- [Iosevka Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/Iosevka)
|
||||
- [JetBrains Mono](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/JetBrainsMono)
|
||||
- [Lekton Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/Lekton)
|
||||
- [Literation Mono Nerd Font\*](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/LiberationMono)
|
||||
- [Meslo Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/Meslo)
|
||||
- [Monofur Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/Monofur)
|
||||
- [Monoid Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/Monoid)
|
||||
- [Mononoki Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/Mononoki)
|
||||
- [M+ (MPlus) Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/MPlus)
|
||||
- [Noto](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/Noto)
|
||||
- [OpenDyslexic](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/OpenDyslexic)
|
||||
- [Overpass](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/Overpass)
|
||||
- [ProFont (Windows tweaked) Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/ProFont)
|
||||
- [ProFont (x11) Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/ProFont)
|
||||
- [ProggyClean Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/ProggyClean)
|
||||
- [Roboto Mono](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/RobotoMono)
|
||||
- [Sauce Code Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/SourceCodePro)
|
||||
- [Shure Tech Mono Nerd Font\*](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/ShareTechMono)
|
||||
- [Space Mono Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/SpaceMono)
|
||||
- [Terminess Nerd Font\*](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/Terminus)
|
||||
- [Tinos](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/Tinos)
|
||||
- [Ubuntu Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/Ubuntu)
|
||||
- [Ubuntu Mono Nerd Font](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/UbuntuMono)
|
||||
- [Victor Mono](https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/VictorMono)
|
||||
|
||||
<!--
|
||||
// https://github.com/ryanoasis/nerd-fonts
|
||||
@@ -91,29 +91,20 @@ console.log(list.join('\n -'));
|
||||
Note: This will _NOT_ work in Command.exe. You must get _Windows Terminal_ from
|
||||
the Microsoft Store.
|
||||
|
||||
You can update the font in the Windows Terminal settings either for the "Defaults" profile (which applies to all profiles unless overwritten) or individually for different profiles under `Settings -> <profile_name> -> Appearance -> Font face`:
|
||||
|
||||

|
||||

|
||||
(Screenshots taken with Windows Terminal version 1.16.10262.0)
|
||||
|
||||
Additionally, you can update `profiles.defaults.font.face` in the Windows Terminal settings.json directly:
|
||||
Select `Settings` from the drop down and update `profiles.defaults.fontFace`:
|
||||
|
||||
```json
|
||||
{
|
||||
"profiles":
|
||||
{
|
||||
"defaults":
|
||||
{
|
||||
"font":
|
||||
{
|
||||
"face": "DroidSansMono NF"
|
||||
}
|
||||
"profiles": {
|
||||
"defaults": {
|
||||
"fontFace": "DroidSansMono NF"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||

|
||||
|
||||
### Nerd Fonts for iTerm2
|
||||
|
||||
Find `iTerm2` in the top Mac menu, then...
|
||||
|
||||
@@ -6,7 +6,7 @@ $my_fontdir = "$Env:UserProfile\AppData\Local\Microsoft\Windows\Fonts"
|
||||
New-Item -Path "$my_fontdir" -ItemType Directory -Force | out-null
|
||||
IF (!(Test-Path -Path "$my_fontdir\$my_nerdfont_otf"))
|
||||
{
|
||||
& curl.exe -fsSLo "$my_nerdfont_otf" 'https://github.com/ryanoasis/nerd-fonts/raw/v2.3.3/patched-fonts/DroidSansMono/complete/Droid%20Sans%20Mono%20Nerd%20Font%20Complete%20Windows%20Compatible.otf'
|
||||
& curl.exe -fsSLo "$my_nerdfont_otf" 'https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/DroidSansMono/complete/Droid%20Sans%20Mono%20Nerd%20Font%20Complete%20Windows%20Compatible.otf'
|
||||
& move "$my_nerdfont_otf" "$my_fontdir"
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ __init_nerdfont() {
|
||||
|
||||
my_nerdfont="Droid Sans Mono for Powerline Nerd Font Complete.otf"
|
||||
curl -fsSLo "$my_nerdfont" \
|
||||
'https://github.com/ryanoasis/nerd-fonts/raw/v2.3.3/patched-fonts/DroidSansMono/complete/Droid%20Sans%20Mono%20Nerd%20Font%20Complete.otf'
|
||||
'https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/DroidSansMono/complete/Droid%20Sans%20Mono%20Nerd%20Font%20Complete.otf'
|
||||
|
||||
my_fontdir=""
|
||||
if [ -e "$HOME/Library/Fonts" ]; then
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 252 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 144 KiB |
BIN
nerdfont/windows-terminal-settings.png
Normal file
BIN
nerdfont/windows-terminal-settings.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 117 KiB |
@@ -41,4 +41,4 @@ Remove-Item -Path "$Env:USERPROFILE\.local\opt\$Env:PKG_NAME" -Recurse -ErrorAct
|
||||
Copy-Item -Path "$Env:USERPROFILE\.local\opt\$Env:PKG_NAME-v$Env:WEBI_VERSION" -Destination "$Env:USERPROFILE\.local\opt\$Env:PKG_NAME" -Recurse
|
||||
|
||||
# Add to path
|
||||
webi_path_add ~/.local/opt/node
|
||||
& "$Env:USERPROFILE\.local\bin\pathman.exe" add ~/.local/opt/node
|
||||
|
||||
19
pathman/install.bat
Normal file
19
pathman/install.bat
Normal file
@@ -0,0 +1,19 @@
|
||||
pushd "%userprofile%" || goto :error
|
||||
IF NOT EXIST .local (
|
||||
mkdir .local || goto :error
|
||||
)
|
||||
IF NOT EXIST .local\bin (
|
||||
mkdir .local\bin || goto :error
|
||||
)
|
||||
|
||||
pushd .local\bin || goto :error
|
||||
rem TODO %PROCESSOR_ARCH%
|
||||
powershell $ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest "https://rootprojects.org/pathman/dist/windows/amd64/pathman.exe" -OutFile pathman.exe || goto :error
|
||||
popd || goto :error
|
||||
popd
|
||||
|
||||
goto :EOF
|
||||
|
||||
:error
|
||||
echo Failed with error #%errorlevel%.
|
||||
exit /b %errorlevel%
|
||||
@@ -1,57 +1,3 @@
|
||||
#!/usr/bin/env pwsh
|
||||
|
||||
###################
|
||||
# Install pathman #
|
||||
###################
|
||||
|
||||
# Every package should define these variables
|
||||
$pkg_cmd_name = "pathman"
|
||||
|
||||
$pkg_dst_cmd = "$Env:USERPROFILE\.local\bin\pathman.exe"
|
||||
$pkg_dst = "$pkg_dst_cmd"
|
||||
|
||||
$pkg_src_cmd = "$Env:USERPROFILE\.local\opt\pathman-v$Env:WEBI_VERSION\bin\pathman.exe"
|
||||
$pkg_src_bin = "$Env:USERPROFILE\.local\opt\pathman-v$Env:WEBI_VERSION\bin"
|
||||
$pkg_src_dir = "$Env:USERPROFILE\.local\opt\pathman-v$Env:WEBI_VERSION"
|
||||
$pkg_src = "$pkg_src_cmd"
|
||||
|
||||
New-Item "$Env:USERPROFILE\Downloads\webi" -ItemType Directory -Force | out-null
|
||||
$pkg_download = "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
|
||||
|
||||
# Fetch archive
|
||||
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"))
|
||||
{
|
||||
echo "Downloading pathman from $Env:WEBI_PKG_URL to $pkg_download"
|
||||
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part"
|
||||
& move "$pkg_download.part" "$pkg_download"
|
||||
}
|
||||
|
||||
IF (!(Test-Path -Path "$pkg_src_cmd"))
|
||||
{
|
||||
echo "Installing pathman"
|
||||
|
||||
# TODO: create package-specific temp directory
|
||||
# Enter tmp
|
||||
pushd .local\tmp
|
||||
|
||||
# Remove any leftover tmp cruft
|
||||
Remove-Item -Path ".\pathman-v*" -Recurse -ErrorAction Ignore
|
||||
Remove-Item -Path ".\pathman.exe" -Recurse -ErrorAction Ignore
|
||||
|
||||
# Unpack archive file into this temporary directory
|
||||
# Windows BSD-tar handles zip. Imagine that.
|
||||
echo "Unpacking $pkg_download"
|
||||
& tar xf "$pkg_download"
|
||||
|
||||
# Settle unpacked archive into place
|
||||
echo "Install Location: $pkg_src_cmd"
|
||||
New-Item "$pkg_src_bin" -ItemType Directory -Force | out-null
|
||||
Move-Item -Path ".\pathman-v*"-Destination "$pkg_src_cmd"
|
||||
|
||||
# Exit tmp
|
||||
popd
|
||||
}
|
||||
|
||||
echo "Copying into '$pkg_dst_cmd' from '$pkg_src_cmd'"
|
||||
Remove-Item -Path "$pkg_dst_cmd" -Recurse -ErrorAction Ignore | out-null
|
||||
Copy-Item -Path "$pkg_src" -Destination "$pkg_dst" -Recurse
|
||||
curl.exe -fsSL -A "$Env:WEBI_UA" "https://rootprojects.org/pathman/dist/windows/amd64/pathman.exe" -o "$Env:USERPROFILE\.local\bin\pathman.exe"
|
||||
|
||||
@@ -7,9 +7,6 @@ var baseurl = 'https://git.rootprojects.org';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo, baseurl).then(function (all) {
|
||||
all.releases = all.releases.filter(function (release) {
|
||||
return !/debug/.test(release.name);
|
||||
});
|
||||
return all;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -52,4 +52,4 @@ echo "Linking '$pkg_dst_dir' from '$pkg_src_dir'"
|
||||
New-Item -ItemType Junction -Path "$pkg_dst_dir" -Target "$pkg_src_dir" > $null
|
||||
|
||||
# Add to path
|
||||
webi_path_add ~/.local/opt/dart-sass
|
||||
& "$Env:USERPROFILE\.local\bin\pathman.exe" add ~/.local/opt/dart-sass
|
||||
|
||||
@@ -3,26 +3,18 @@ set -e
|
||||
set -u
|
||||
|
||||
__install_ssh_adduser() {
|
||||
# ssh-adduser
|
||||
rm -f "$HOME/.local/bin/ssh-adduser"
|
||||
my_cmd="ssh-adduser"
|
||||
|
||||
rm -f "$HOME/.local/bin/${my_cmd}"
|
||||
|
||||
webi_download \
|
||||
"$WEBI_HOST/packages/ssh-adduser/ssh-adduser.sh" \
|
||||
"$HOME/.local/bin/ssh-adduser"
|
||||
chmod a+x "$HOME/.local/bin/ssh-adduser"
|
||||
"$WEBI_HOST/packages/${my_cmd}/${my_cmd}.sh" \
|
||||
"$HOME/.local/bin/${my_cmd}"
|
||||
|
||||
# sshd-prohibit-password
|
||||
rm -f "$HOME/.local/bin/sshd-prohibit-password"
|
||||
webi_download \
|
||||
"$WEBI_HOST/packages/sshd-prohibit-password/sshd-prohibit-password" \
|
||||
"$HOME/.local/bin/sshd-prohibit-password"
|
||||
chmod a+x "$HOME/.local/bin/sshd-prohibit-password"
|
||||
chmod a+x "$HOME/.local/bin/${my_cmd}"
|
||||
|
||||
# run the commands
|
||||
export SSH_ADDUSER_AUTO=true
|
||||
"$HOME/.local/bin/ssh-adduser"
|
||||
|
||||
# TODO create vps-init or the like to do both
|
||||
"$HOME/.local/bin/sshd-prohibit-password"
|
||||
# run the command
|
||||
"$HOME/.local/bin/${my_cmd}"
|
||||
}
|
||||
|
||||
__install_ssh_adduser
|
||||
|
||||
@@ -10,6 +10,7 @@ main() {
|
||||
my_key_url="${2:-}"
|
||||
my_keys=""
|
||||
|
||||
# TODO would $EUID be better?
|
||||
if [ "root" != "$(whoami)" ]; then
|
||||
echo "webi adduser: running user is already a non-root user"
|
||||
exit 0
|
||||
@@ -52,29 +53,60 @@ main() {
|
||||
chmod 0644 "/home/$my_new_user/.ssh/config"
|
||||
chown -R "$my_new_user":"$my_new_user" "/home/$my_new_user/.ssh/"
|
||||
|
||||
# ensure that 'app' has an SSH Keypair
|
||||
sudo -i -u "$my_new_user" sh -c "ssh-keygen -b 2048 -t rsa -f '/home/$my_new_user/.ssh/id_rsa' -q -N ''"
|
||||
chown -R "$my_new_user":"$my_new_user" "/home/$my_new_user/.ssh/"
|
||||
|
||||
# ensure that 'app' has an SSH Keypair
|
||||
# sudo -i -u "$my_new_user" sh -c \
|
||||
# "ssh-keygen -b 2048 -t rsa -f '/home/$my_new_user/.ssh/id_rsa' -q -N ''"
|
||||
# Install webi for the new 'app' user
|
||||
WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"}
|
||||
sudo -i -u "$my_new_user" sh -c "curl -fsSL '$WEBI_HOST/ssh-pubkey' | sh > /dev/null" ||
|
||||
sudo -i -u "$my_new_user" sh -c "wget -q -O - '$WEBI_HOST/ssh-pubkey' | sh > /dev/null"
|
||||
sudo -i -u "$my_new_user" sh -c "curl -fsSL '$WEBI_HOST/webi' | sh" ||
|
||||
sudo -i -u "$my_new_user" sh -c "wget -q -O - '$WEBI_HOST/webi' | sh"
|
||||
|
||||
if test -z "${SSH_ADDUSER_AUTO}"; then
|
||||
echo ""
|
||||
echo "!! BREAKING CHANGE !!"
|
||||
echo ""
|
||||
echo " 'ssh-adduser' no longer checks or hardens /etc/ssh/sshd_config"
|
||||
echo ""
|
||||
echo " Run 'sshd-probihit-password' to secure /etc/ssh/sshd_config"
|
||||
echo ""
|
||||
# TODO ensure that ssh-password login is off
|
||||
my_pass="$(grep 'PasswordAuthentication yes' /etc/ssh/sshd_config)"
|
||||
my_pam=""
|
||||
if [ "Darwin" = "$(uname -s)" ]; then
|
||||
# Turn off PAM for macOS or it will allow password login
|
||||
my_pam="$(grep 'UsePAM yes' /etc/ssh/sshd_config)"
|
||||
fi
|
||||
if [ -n "${my_pass}" ] || [ -n "${my_pam}" ]; then
|
||||
echo "######################################################################"
|
||||
echo "# #"
|
||||
echo "# WARNING #"
|
||||
echo "# #"
|
||||
echo "# Found /etc/ssh/sshd_config: #"
|
||||
if [ -n "${my_pass}" ]; then
|
||||
echo "# PasswordAuthentication yes #"
|
||||
fi
|
||||
if [ -n "${my_pam}" ]; then
|
||||
echo "# UsePAM yes #"
|
||||
fi
|
||||
echo "# #"
|
||||
echo "# This is EXTREMELY DANGEROUS and insecure. #"
|
||||
echo "# We'll attempt to fix this now... #"
|
||||
echo "# #"
|
||||
|
||||
sed -i 's/#\?PasswordAuthentication \(yes\|no\)/PasswordAuthentication no/' \
|
||||
/etc/ssh/sshd_config
|
||||
|
||||
sed -i 's/#\?UsePAM \(yes\|no\)/UsePAM no/' \
|
||||
/etc/ssh/sshd_config
|
||||
|
||||
if grep "PasswordAuthentication yes" /etc/ssh/sshd_config; then
|
||||
echo "# FAILED. Please check /etc/ssh/sshd_config manually. #"
|
||||
else
|
||||
echo "# Fixed... HOWEVER, you'll need to manually restart ssh: #"
|
||||
echo "# #"
|
||||
echo "# sudo systemctl restart ssh #"
|
||||
echo "# #"
|
||||
echo "# (you may want to make sure you can login as the new user first) #"
|
||||
fi
|
||||
echo "# #"
|
||||
echo "######################################################################"
|
||||
fi
|
||||
|
||||
echo "Created user '${my_new_user}' as sudoer with a random password."
|
||||
echo "(set a new password with 'password ${my_new_user}')"
|
||||
echo ""
|
||||
echo "note: you can add an ssh key passphrase with 'webi ssh-setpass'"
|
||||
}
|
||||
|
||||
main "${1:-app}" "${2:-}"
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
---
|
||||
title: SSH Authorize
|
||||
homepage: https://webinstall.dev/ssh-authorize
|
||||
tagline: |
|
||||
Add to your SSH Authorized Keys from a string, file, or url.
|
||||
---
|
||||
|
||||
## Cheat Sheet
|
||||
|
||||
> Does the tedious work of making sure your `.ssh/authorized_keys` exists with
|
||||
> the proper permissions, and that only valid keys from a given string, file, or
|
||||
> URL go into it!
|
||||
|
||||
Use `ssh-authorize` to add trusted public keys to allow others to login to your
|
||||
servers / systems / local computers;
|
||||
|
||||
```sh
|
||||
# ssh-authorize <ssh-pubkey-or-file-or-url> [comment]
|
||||
ssh-authorize https://github.com/jonny.keys 'My GitHub Keys'
|
||||
```
|
||||
|
||||
```text
|
||||
USAGE
|
||||
|
||||
ssh-authorize <ssh-pubkey-or-file-or-url> [comment]
|
||||
|
||||
EXAMPLES
|
||||
|
||||
ssh-authorize https://github.com/you.keys 'My GH Keys'
|
||||
|
||||
ssh-authorize ./id_rsa.you@example.co.pub
|
||||
|
||||
ssh-authorize 'ssh-rsa AAAA...example.co'
|
||||
|
||||
LOCAL IDENTIFY FILES
|
||||
|
||||
/home/app/.ssh/id_rsa.pub
|
||||
```
|
||||
|
||||
### How to Add Manually
|
||||
|
||||
For the simplest case it seems almost silly to even have a utility for this:
|
||||
|
||||
```sh
|
||||
mkdir -p ~/.ssh/
|
||||
chmod 0700 ~/.ssh/
|
||||
|
||||
touch ~/.ssh/authorized_keys
|
||||
chmod 0600 ~/.ssh/
|
||||
|
||||
curl https://github.com/me.keys >> ~/.ssh/authorized_keys
|
||||
```
|
||||
|
||||
but... tedium, error checking... things are never as simple as they seem.
|
||||
|
||||
### But really, why?
|
||||
|
||||
- handles arbitrary files and URLs, failing bad key lines
|
||||
- sets permissions correctly, even if they were incorrect
|
||||
- works `curl` (macOS, Ubuntu) or `wget` (Docker, Alpine)
|
||||
- enforces `https`
|
||||
@@ -1,17 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
set -u
|
||||
|
||||
__install_ssh_authorize() {
|
||||
my_cmd="ssh-authorize"
|
||||
|
||||
rm -f "$HOME/.local/bin/${my_cmd}"
|
||||
|
||||
webi_download \
|
||||
"$WEBI_HOST/packages/${my_cmd}/${my_cmd}" \
|
||||
"$HOME/.local/bin/${my_cmd}"
|
||||
|
||||
chmod a+x "$HOME/.local/bin/${my_cmd}"
|
||||
}
|
||||
|
||||
__install_ssh_authorize
|
||||
@@ -1,164 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
set -u
|
||||
|
||||
cmd_http_get="curl ${CURL_OPTS:-} --max-time 15 --proto =https --tlsv1.2 -fsS"
|
||||
if ! command -v curl > /dev/null; then
|
||||
cmd_http_get="wget ${WGET_OPTS:-} --secure-protocol=TLSv1_2 --secure-protocol=TLSv1_3 --timeout=15 -o /dev/null -O -"
|
||||
fi
|
||||
|
||||
fn_init_authorized_keys() { (
|
||||
if ! test -e ~/.ssh/; then
|
||||
mkdir -p ~/.ssh/
|
||||
fi
|
||||
chmod 0700 ~/.ssh/
|
||||
|
||||
if ! test -e ~/.ssh/authorized_keys; then
|
||||
touch ~/.ssh/authorized_keys
|
||||
fi
|
||||
chmod 0600 ~/.ssh/authorized_keys
|
||||
|
||||
); }
|
||||
|
||||
fn_ssh_keys() { (
|
||||
my_key_uri="${1:-}"
|
||||
|
||||
# Handle keys as a URL, a file, or string
|
||||
my_keys="${my_key_uri}"
|
||||
case "${my_key_uri}" in
|
||||
http:*)
|
||||
echo "please use 'https://' for ssh public key urls"
|
||||
return 1
|
||||
;;
|
||||
https:*)
|
||||
my_keys="$(
|
||||
${cmd_http_get} "${my_key_uri}"
|
||||
)"
|
||||
;;
|
||||
*)
|
||||
if test -e "${my_key_uri}"; then
|
||||
my_keys="$(
|
||||
cat "${my_key_uri}"
|
||||
)"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# printf for proper whitespace handling
|
||||
printf '%s' "${my_keys}"
|
||||
); }
|
||||
|
||||
main() { (
|
||||
my_keything="${1:-}"
|
||||
my_comment="${2:-}"
|
||||
|
||||
fn_init_authorized_keys
|
||||
|
||||
if test -z "${my_keything:-}"; then
|
||||
echo ""
|
||||
echo "USAGE"
|
||||
echo ""
|
||||
echo " ssh-authorize <ssh-pubkey-or-file-or-url> [comment]"
|
||||
echo ""
|
||||
echo "EXAMPLES"
|
||||
echo ""
|
||||
echo " ssh-authorize https://github.com/you.keys 'My GH Keys'"
|
||||
echo ""
|
||||
echo " ssh-authorize ./id_rsa.you@example.co.pub"
|
||||
echo ""
|
||||
echo " ssh-authorize 'ssh-rsa AAAA...example.co'"
|
||||
echo ""
|
||||
echo "LOCAL IDENTIFY FILES"
|
||||
echo ""
|
||||
for my_file in ~/.ssh/*.pub; do
|
||||
if test "${my_file}" = "$HOME/.ssh/*.pub"; then
|
||||
echo " (no files match ~/.ssh/*.pub)"
|
||||
break
|
||||
fi
|
||||
printf ' %s\n' "${my_file}"
|
||||
done
|
||||
echo ""
|
||||
|
||||
return 1
|
||||
fi
|
||||
|
||||
my_pubkeys=""
|
||||
if test -n "${my_keything}"; then
|
||||
my_pubkeys="$(
|
||||
fn_ssh_keys "${my_keything}"
|
||||
)"
|
||||
else
|
||||
# if ! command -v ssh-pubkey > /dev/null; then
|
||||
# {
|
||||
# echo ""
|
||||
# echo "ERROR"
|
||||
# echo " no key string, file, or url was given,"
|
||||
# echo " and 'ssh-pubkey' is not installed."
|
||||
# echo ""
|
||||
# echo "SOLUTION"
|
||||
# echo " provide a valid key string, file or url,"
|
||||
# echo " or 'curl https://webi.sh/ssh-pubkey | sh'"
|
||||
# echo " to install 'ssh-pubkey'"
|
||||
# echo ""
|
||||
# } >&2
|
||||
#
|
||||
# return 1
|
||||
# fi
|
||||
|
||||
# Get the default key (for authorizing self)
|
||||
my_pubkeys="$(
|
||||
ssh-pubkey 2> /dev/null
|
||||
)"
|
||||
fi
|
||||
|
||||
# Clean up non-key lines, preserving comments and newlines
|
||||
my_pubkeys_safe="$(
|
||||
printf '%s' "${my_pubkeys}" | grep -E '^(#|\s*$|(ssh|ecdsa)-[a-zA-Z0-9-]+ AAA)'
|
||||
)"
|
||||
my_pubkeys_trimmed="$(
|
||||
printf '%s' "${my_pubkeys}" | grep -E '^(ssh|ecdsa)-[a-zA-Z0-9-]+ AAA'
|
||||
)"
|
||||
my_pubkeys_excluded="$(
|
||||
printf '%s' "${my_pubkeys}" | grep -v -E '^(#|\s*$|(ssh|ecdsa)-[a-zA-Z0-9-]+ AAA)' || true
|
||||
)"
|
||||
|
||||
if test -z "${my_pubkeys_trimmed}"; then
|
||||
{
|
||||
echo ""
|
||||
echo "ERROR"
|
||||
echo " not a valid key string, file, or url:"
|
||||
echo " '${my_keything}'"
|
||||
echo ""
|
||||
echo "SOLUTION"
|
||||
echo " inspect the file / url / string, double"
|
||||
echo " check that you copied correctly, etc"
|
||||
echo ""
|
||||
} >&2
|
||||
|
||||
return 1
|
||||
fi
|
||||
|
||||
{
|
||||
if test -n "${my_comment}"; then
|
||||
printf '# %s\n' "${my_comment}"
|
||||
fi
|
||||
printf '%s\n' "${my_pubkeys_safe}"
|
||||
} | tee -a ~/.ssh/authorized_keys
|
||||
|
||||
echo ""
|
||||
echo "Successfully copied the above ssh keys to ~/.ssh/authorized_keys"
|
||||
|
||||
if test -n "${my_pubkeys_excluded}"; then
|
||||
{
|
||||
echo ""
|
||||
echo "WARNING: the following (invalid) lines were excluded:"
|
||||
echo ""
|
||||
echo "${my_pubkeys_excluded}"
|
||||
echo ""
|
||||
} >&2
|
||||
fi
|
||||
); }
|
||||
|
||||
if test -z "${SSH_AUTHORIZE_UNIT_TEST:-}"; then
|
||||
main "${@:-}"
|
||||
fi
|
||||
@@ -1,97 +0,0 @@
|
||||
---
|
||||
title: SSH Prohibit Password
|
||||
homepage: https://webinstall.dev/ssh-prohibit-password
|
||||
tagline: |
|
||||
SSH Prohibit Password: Because friends don't let friends ssh with passwords
|
||||
linux: true
|
||||
---
|
||||
|
||||
## Cheat Sheet
|
||||
|
||||
> Will check if your system This will check if your Modern SSH deployments are
|
||||
> key-only and don't allow root login. However, there's a lot of legacy systems
|
||||
> out there.
|
||||
|
||||
`ssh-harden` will
|
||||
|
||||
1. Check that some `/home/*/.ssh/authorized_keys` is non-empty
|
||||
2. Check that `/etc/sudoers.d` is not empty
|
||||
3. Optionally create a `sudoer` for a given user and group
|
||||
4. Disable `root` login
|
||||
5. Disable Password and Challenge login
|
||||
|
||||
```sh
|
||||
USAGE
|
||||
ssh-harden [username] [sudo-group]
|
||||
|
||||
EXAMPLES
|
||||
|
||||
sudo ssh-harden
|
||||
sudo ssh-harden app
|
||||
sudo ssh-harden "$(id -n -u)" wheel
|
||||
```
|
||||
|
||||
### How to check for sudoers
|
||||
|
||||
```sh
|
||||
sudo sh -c 'grep "^\w\+ ALL=" /etc/sudoers.d/*'
|
||||
```
|
||||
|
||||
### How to check for authorized ssh users
|
||||
|
||||
**Quick 'n' Easy**
|
||||
|
||||
```sh
|
||||
sudo sh -c "grep -E '^(ssh|ec)' /home/*/.ssh/authorized_keys" |
|
||||
cut -d' ' -f3 |
|
||||
sort -u
|
||||
```
|
||||
|
||||
**Detailed**
|
||||
|
||||
```sh
|
||||
my_authorized=''
|
||||
for my_file in /home/*/.ssh/authorized_keys; do
|
||||
# if no files match the glob becomes a literal string
|
||||
if test "${my_file}" = '/home/*/.ssh/authorized_keys'; then
|
||||
break
|
||||
fi
|
||||
|
||||
echo "${my_file} authorizes:"
|
||||
if ! grep -q -E '^(ssh|ec)' "${my_file}"; then
|
||||
echo " (none, empty file)"
|
||||
continue
|
||||
fi
|
||||
|
||||
grep '^(ssh|ec)' "${my_file}" | cut -d' ' -f3 | while read -r my_comment; do
|
||||
echo " ${my_comment}"
|
||||
done
|
||||
my_authorized='true'
|
||||
done
|
||||
|
||||
if test -z "${my_authorized}"; then
|
||||
echo >&2 ""
|
||||
echo >&2 "ERROR"
|
||||
echo >&2 " No authorized remote users found."
|
||||
echo >&2 ""
|
||||
exit 1
|
||||
fi
|
||||
```
|
||||
|
||||
### How to add passwordless sudoer
|
||||
|
||||
```sh
|
||||
echo "app ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/app
|
||||
```
|
||||
|
||||
How to copy allowed keys from root to the new user:
|
||||
|
||||
```sh
|
||||
mkdir -p /home/app/.ssh/
|
||||
chmod 0700 /home/app/.ssh/
|
||||
|
||||
cat "$HOME/.ssh/authorized_keys" >> /home/app/.ssh/authorized_keys
|
||||
chmod 0600 /home/app/.ssh/authorized_keys
|
||||
|
||||
chown -R app:app /home/app/.ssh/
|
||||
```
|
||||
@@ -1,182 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
set -u
|
||||
|
||||
# There are two important use cases:
|
||||
# 1. Run as 'root', for the 'app' (or specified) user
|
||||
# 2. Run as a sudoer, for self
|
||||
|
||||
fn_check_as_root() { (
|
||||
my_admin="${1:-}"
|
||||
|
||||
if ! command -v sudo > /dev/null; then
|
||||
echo ""
|
||||
echo "WARNING"
|
||||
echo " 'sudo' is not installed."
|
||||
echo " '${my_admin}' MUST be able to login via the 'root' password."
|
||||
echo ""
|
||||
else
|
||||
my_admin_is_sudoer=''
|
||||
if grep -q "^${my_admin} ALL=" /etc/sudoers; then
|
||||
my_admin_is_sudoer='true'
|
||||
elif test -e /etc/sudoers.d; then
|
||||
if grep -q "^${my_admin} ALL=" /etc/sudoers.d/*; then
|
||||
my_admin_is_sudoer='true'
|
||||
fi
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "ERROR"
|
||||
echo " '${my_admin}' is NOT a sudoer"
|
||||
echo ""
|
||||
echo "SOLUTION"
|
||||
echo " mkdir -p /etc/sudoers.d"
|
||||
echo " chmod 0700 /etc/sudoers.d"
|
||||
echo " echo '${my_admin} ALL=(ALL:ALL) NOPASSWD: ALL' | "
|
||||
echo " tee '/etc/sudoers.d/${my_admin}'"
|
||||
echo ""
|
||||
fi
|
||||
); }
|
||||
|
||||
fn_check_as_sudoer() { (
|
||||
echo
|
||||
); }
|
||||
|
||||
main() {
|
||||
echo ""
|
||||
echo "IMPORTANT"
|
||||
echo ""
|
||||
echo "READ CAREFULLY (or get LOCKED OUT)"
|
||||
echo ""
|
||||
|
||||
my_user_id="$(id -u)"
|
||||
if test "0" = "${my_user_id}"; then
|
||||
fn_check_as_root ${1:-app}
|
||||
else
|
||||
fn_check_as_sudoer
|
||||
fi
|
||||
|
||||
my_username="$(id -u -n)"
|
||||
my_sudo_user="${1:-${my_username}}"
|
||||
|
||||
my_sudo_exists=''
|
||||
my_sudo=''
|
||||
if command -v sudo > /dev/null; then
|
||||
my_sudo_exists='true'
|
||||
my_sudo="sudo"
|
||||
fi
|
||||
|
||||
my_root=''
|
||||
if test "$(id -u)" = "0"; then
|
||||
my_root='true'
|
||||
my_sudo=''
|
||||
fi
|
||||
|
||||
my_authorized_exists=''
|
||||
echo ''
|
||||
echo "All authorized users:"
|
||||
if ! $my_sudo sh -c 'ls /home/*/.ssh/authorized_keys' > /devl/null 2>&1; then
|
||||
echo " (none)"
|
||||
else
|
||||
$my_sudo sh -c "grep -E '^(ssh|ec)' /home/*/.ssh/authorized_keys" |
|
||||
cut -d' ' -f3 |
|
||||
sort -u |
|
||||
while read -r my_comment; do
|
||||
echo " ${my_comment}"
|
||||
my_authorized_exists='true'
|
||||
done
|
||||
fi
|
||||
|
||||
my_sudoer_exists=''
|
||||
echo ''
|
||||
echo "All sudoers:"
|
||||
if test -z "${my_sudo_exists}"; then
|
||||
echo ' (sudo not installed)'
|
||||
else
|
||||
{
|
||||
$my_sudo sh -c "grep -E '(sudo|wheel):' /etc/gshadow" |
|
||||
cut -d':' -f4 |
|
||||
tr ',' '\n'
|
||||
|
||||
#$my_sudo sh -c "grep '^%\?\w\+ ALL=' /etc/sudoers /etc/sudoers.d/*" |
|
||||
$my_sudo sh -c "grep '^\w\+ ALL=' /etc/sudoers /etc/sudoers.d/*" |
|
||||
cut -d':' -f2 |
|
||||
cut -d' ' -f1
|
||||
} |
|
||||
grep -v root |
|
||||
sort -u |
|
||||
while read -r my_sudoer; do
|
||||
my_sudoer_exists='true'
|
||||
echo " ${my_sudoer}"
|
||||
done
|
||||
fi
|
||||
|
||||
#adduser "$my_new_user" sudo || adduser "$my_new_user" wheel
|
||||
echo "$my_new_user ALL=(ALL:ALL) NOPASSWD: ALL" | tee "/etc/sudoers.d/$my_new_user"
|
||||
|
||||
# allow users who can already login as 'root' to login as 'app'
|
||||
mkdir -p "/home/$my_new_user/.ssh/"
|
||||
chmod 0700 "/home/$my_new_user/.ssh/"
|
||||
echo "${my_keys}" >> "/home/$my_new_user/.ssh/authorized_keys"
|
||||
chmod 0600 "/home/$my_new_user/.ssh/authorized_keys"
|
||||
touch "/home/$my_new_user/.ssh/config"
|
||||
chmod 0644 "/home/$my_new_user/.ssh/config"
|
||||
chown -R "$my_new_user":"$my_new_user" "/home/$my_new_user/.ssh/"
|
||||
|
||||
# ensure that 'app' has an SSH Keypair
|
||||
sudo -i -u "$my_new_user" sh -c "ssh-keygen -b 2048 -t rsa -f '/home/$my_new_user/.ssh/id_rsa' -q -N ''"
|
||||
chown -R "$my_new_user":"$my_new_user" "/home/$my_new_user/.ssh/"
|
||||
|
||||
# Install webi for the new 'app' user
|
||||
WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"}
|
||||
sudo -i -u "$my_new_user" sh -c "curl -fsSL '$WEBI_HOST/webi' | sh" ||
|
||||
sudo -i -u "$my_new_user" sh -c "wget -q -O - '$WEBI_HOST/webi' | sh"
|
||||
|
||||
# TODO ensure that ssh-password login is off
|
||||
my_pass="$(grep 'PasswordAuthentication yes' /etc/ssh/sshd_config)"
|
||||
my_pam=""
|
||||
if [ "Darwin" = "$(uname -s)" ]; then
|
||||
# Turn off PAM for macOS or it will allow password login
|
||||
my_pam="$(grep 'UsePAM yes' /etc/ssh/sshd_config)"
|
||||
fi
|
||||
if [ -n "${my_pass}" ] || [ -n "${my_pam}" ]; then
|
||||
echo "######################################################################"
|
||||
echo "# #"
|
||||
echo "# WARNING #"
|
||||
echo "# #"
|
||||
echo "# Found /etc/ssh/sshd_config: #"
|
||||
if [ -n "${my_pass}" ]; then
|
||||
echo "# PasswordAuthentication yes #"
|
||||
fi
|
||||
if [ -n "${my_pam}" ]; then
|
||||
echo "# UsePAM yes #"
|
||||
fi
|
||||
echo "# #"
|
||||
echo "# This is EXTREMELY DANGEROUS and insecure. #"
|
||||
echo "# We'll attempt to fix this now... #"
|
||||
echo "# #"
|
||||
|
||||
sed -i 's/#\?PasswordAuthentication \(yes\|no\)/PasswordAuthentication no/' \
|
||||
/etc/ssh/sshd_config
|
||||
|
||||
sed -i 's/#\?UsePAM \(yes\|no\)/UsePAM no/' \
|
||||
/etc/ssh/sshd_config
|
||||
|
||||
if grep "PasswordAuthentication yes" /etc/ssh/sshd_config; then
|
||||
echo "# FAILED. Please check /etc/ssh/sshd_config manually. #"
|
||||
else
|
||||
echo "# Fixed... HOWEVER, you'll need to manually restart ssh: #"
|
||||
echo "# #"
|
||||
echo "# sudo systemctl restart ssh #"
|
||||
echo "# #"
|
||||
echo "# (you may want to make sure you can login as the new user first) #"
|
||||
fi
|
||||
echo "# #"
|
||||
echo "######################################################################"
|
||||
fi
|
||||
|
||||
echo "Created user '${my_new_user}' as sudoer with a random password."
|
||||
echo "(set a new password with 'password ${my_new_user}')"
|
||||
}
|
||||
|
||||
main "${1:-app}" "${2:-}"
|
||||
@@ -1,11 +0,0 @@
|
||||
---
|
||||
title: SSH Prohibit Password
|
||||
homepage: https://webinstall.dev/sshd-prohibit-password
|
||||
tagline: |
|
||||
Alias for https://webinstall.dev/sshd-prohibit-password
|
||||
alias: sshd-prohibit-password
|
||||
description: |
|
||||
See https://webinstall.dev/sshd-prohibit-password
|
||||
---
|
||||
|
||||
Alias for https://webinstall.dev/sshd-prohibit-password
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
set -u
|
||||
|
||||
# shellcheck disable=SC2016
|
||||
|
||||
__alias_sshd_prohibit_password() {
|
||||
echo "'ssh-prohibit-password@${WEBI_TAG:-stable}' is an alias for 'sshd-prohibit-password@${WEBI_VERSION-}'"
|
||||
WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"}
|
||||
curl -fsSL "$WEBI_HOST/sshd-prohibit-password@${WEBI_VERSION-}" | sh
|
||||
}
|
||||
|
||||
__alias_sshd_prohibit_password
|
||||
@@ -2,18 +2,13 @@
|
||||
title: SSH Utils
|
||||
homepage: https://webinstall.dev/ssh-utils
|
||||
tagline: |
|
||||
SSH Utils: Because --help takes too long.
|
||||
SSH Utils: Because --help takes to long.
|
||||
---
|
||||
|
||||
## Cheat Sheet
|
||||
|
||||
> SSH Utils includes shortcut commands for common tasks.
|
||||
|
||||
- [ssh-adduser](../ssh-adduser/)
|
||||
- [ssh-authorize](../ssh-authorize/)
|
||||
- [ssh-pubkey](../ssh-pubkey/)
|
||||
- [ssh-setpass](../ssh-setpass/)
|
||||
- [sshd-prohibit-password](../sshd-prohibit-password/)
|
||||
> SSH Utils includes shortcut commands for some common tasks, including
|
||||
> `ssh-pubkey`, `ssh-setpass`, and `ssh-adduser`
|
||||
|
||||
**ssh-pubkey**:
|
||||
|
||||
@@ -37,29 +32,6 @@ correctly if run as root. `ssh-adduser` adds user `app` with the same
|
||||
**`~/.ssh/authorized_keys`** as the `root` user, with a long random password,
|
||||
and gives `app` `sudo` privileges.
|
||||
|
||||
**sshd-prohibit-password**:
|
||||
|
||||
Enforces security for `/etc/ssh/sshd_config`
|
||||
|
||||
```diff
|
||||
- #PasswordAuthentication yes
|
||||
+ PasswordAuthentication no
|
||||
|
||||
- #PermitRootLogin yes
|
||||
+ PermitRootLogin prohibit-password
|
||||
|
||||
# macOS only
|
||||
- UsePAM yes
|
||||
+ UsePAM no
|
||||
```
|
||||
|
||||
**ssh-authorize**:
|
||||
|
||||
Adds public ssh keys from a string, file, or url to `~/.ssh/authorized_keys` to
|
||||
allow the owner(s) of the keys access to the system to which they're added.
|
||||
|
||||
Also performs various checks to prevent errors.
|
||||
|
||||
**ssh-setpass**:
|
||||
|
||||
`ssh-setpass` will ask you for your old passphrase (if any) and then for the new
|
||||
|
||||
@@ -3,35 +3,23 @@ set -e
|
||||
set -u
|
||||
|
||||
__install_ssh_utils() {
|
||||
rm -f "$HOME/.local/bin/ssh-authorize"
|
||||
webi_download \
|
||||
"$WEBI_HOST/packages/ssh-authorize/ssh-authorize" \
|
||||
"$HOME/.local/bin/ssh-authorize"
|
||||
chmod a+x "$HOME/.local/bin/ssh-authorize"
|
||||
|
||||
rm -rf "$HOME/.local/bin/ssh-adduser"
|
||||
webi_download \
|
||||
"$WEBI_HOST/packages/ssh-adduser/ssh-adduser.sh" \
|
||||
rm -f \
|
||||
"$HOME/.local/bin/ssh-pubkey" \
|
||||
"$HOME/.local/bin/ssh-setpass" \
|
||||
"$HOME/.local/bin/ssh-adduser"
|
||||
chmod a+x "$HOME/.local/bin/ssh-adduser"
|
||||
# done
|
||||
|
||||
rm -rf "$HOME/.local/bin/ssh-pubkey"
|
||||
webi_download \
|
||||
"$WEBI_HOST/packages/ssh-pubkey/ssh-pubkey.sh" \
|
||||
"$HOME/.local/bin/ssh-pubkey"
|
||||
chmod a+x "$HOME/.local/bin/ssh-pubkey"
|
||||
|
||||
rm -rf "$HOME/.local/bin/ssh-setpass"
|
||||
webi_download \
|
||||
"$WEBI_HOST/packages/ssh-setpass/ssh-setpass.sh" \
|
||||
"$HOME/.local/bin/ssh-setpass"
|
||||
chmod a+x "$HOME/.local/bin/ssh-setpass"
|
||||
|
||||
rm -rf "$HOME/.local/bin/sshd-prohibit-password"
|
||||
webi_download \
|
||||
"$WEBI_HOST/packages/sshd-prohibit-password/sshd-prohibit-password" \
|
||||
"$HOME/.local/bin/sshd-prohibit-password"
|
||||
chmod a+x "$HOME/.local/bin/sshd-prohibit-password"
|
||||
"$WEBI_HOST/packages/ssh-adduser/ssh-adduser.sh" \
|
||||
"$HOME/.local/bin/ssh-adduser"
|
||||
|
||||
chmod a+x "$HOME/.local/bin/ssh-"*
|
||||
}
|
||||
|
||||
__install_ssh_utils
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
---
|
||||
title: SSH Prohibit Password
|
||||
homepage: https://webinstall.dev/sshd-prohibit-password
|
||||
tagline: |
|
||||
SSH Prohibit Password: Because friends don't let friends ssh with passwords
|
||||
linux: true
|
||||
---
|
||||
|
||||
## Cheat Sheet
|
||||
|
||||
> Will check if your system This will check if your Modern SSH deployments are
|
||||
> key-only and don't allow root login. However, there's a lot of legacy systems
|
||||
> out there.
|
||||
|
||||
`sshd-prohibit-password` will inspect `/etc/ssh/sshd_config` and
|
||||
|
||||
1. Enforce that `PasswordAuthentication` is `no`
|
||||
2. Enforce that `PermitRootLogin` is `no` or `prohibit-password` \
|
||||
(or `without-password`, for older systems)
|
||||
3. (macOS only) Enforce that `UsePAM` is `no`
|
||||
|
||||
This **will run automatically** and **uses `sudo`** to make changes.
|
||||
|
||||
### What's checked and changed?
|
||||
|
||||
```diff
|
||||
- #PasswordAuthentication yes
|
||||
+ PasswordAuthentication no
|
||||
|
||||
- #PermitRootLogin yes
|
||||
+ PermitRootLogin prohibit-password
|
||||
|
||||
# macOS only
|
||||
- UsePAM yes
|
||||
+ UsePAM no
|
||||
```
|
||||
|
||||
### How to restart SSH?
|
||||
|
||||
```sh
|
||||
# Ubuntu / Debian / RedHat
|
||||
sudo systemctl restart sshd
|
||||
|
||||
# Alpine / Gentoo
|
||||
sudo rc-service sshd restart
|
||||
|
||||
# macOS
|
||||
sudo launchctl unload /System/Library/LaunchDaemons/ssh.plist
|
||||
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist
|
||||
|
||||
# others
|
||||
killall sshd
|
||||
```
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
set -u
|
||||
|
||||
__install_sshd_prohibit_password() {
|
||||
my_cmd="sshd-prohibit-password"
|
||||
|
||||
rm -f "$HOME/.local/bin/${my_cmd}"
|
||||
|
||||
webi_download \
|
||||
"$WEBI_HOST/packages/${my_cmd}/${my_cmd}" \
|
||||
"$HOME/.local/bin/${my_cmd}"
|
||||
|
||||
chmod a+x "$HOME/.local/bin/${my_cmd}"
|
||||
|
||||
# run the command
|
||||
"$HOME/.local/bin/${my_cmd}"
|
||||
}
|
||||
|
||||
__install_sshd_prohibit_password
|
||||
@@ -1,148 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
set -u
|
||||
|
||||
main() {
|
||||
cmd_sudo=''
|
||||
if command -v sudo > /dev/null; then
|
||||
my_id="$(id -u)"
|
||||
if test "0" != "${my_id}"; then
|
||||
cmd_sudo='sudo'
|
||||
fi
|
||||
fi
|
||||
|
||||
cmd_sed="${cmd_sudo} sed -i -E"
|
||||
my_bsd_sed=''
|
||||
if ! sed -V 2>&1 | grep -q 'GNU'; then
|
||||
cmd_sed="${cmd_sudo} sed -i .prohibit-password-bak -E"
|
||||
my_bsd_sed='true'
|
||||
fi
|
||||
|
||||
my_changes=''
|
||||
|
||||
# PasswordAuthentication
|
||||
echo ""
|
||||
echo "Checking for 'PasswordAuthentication no'..."
|
||||
echo " grep '^\s*PasswordAuthentication\s*no' /etc/ssh/sshd_config"
|
||||
my_allow_passwords="$(
|
||||
grep -q \
|
||||
'^\s*PasswordAuthentication\s*no\s*$' \
|
||||
/etc/ssh/sshd_config ||
|
||||
echo 'true'
|
||||
)"
|
||||
if test -n "${my_allow_passwords}"; then
|
||||
$cmd_sed \
|
||||
's/#*[[:space:]]*PasswordAuthentication[[:space:]]*(yes|no)[[:space:]]*$/PasswordAuthentication no/g' \
|
||||
/etc/ssh/sshd_config
|
||||
|
||||
if ! grep -q '^PasswordAuthentication no$' /etc/ssh/sshd_config; then
|
||||
echo ""
|
||||
echo "ERROR"
|
||||
echo " failed to update '/etc/ssh/sshd_config'"
|
||||
echo ""
|
||||
return 1
|
||||
fi
|
||||
echo " RESTART REQUIRED: disabled user password login"
|
||||
my_changes='true'
|
||||
else
|
||||
echo " PASS: passwords are NOT allowed"
|
||||
fi
|
||||
|
||||
# PermitRootLogin
|
||||
echo ""
|
||||
echo "Checking for 'PermitRootLogin prohibit-password'..."
|
||||
echo " grep -E '^\s*PermitRootLogin\s*(no|prohibit-password)' /etc/ssh/sshd_config"
|
||||
my_allow_root="$(
|
||||
grep -q -E \
|
||||
'^\s*PermitRootLogin\s*(no|prohibit-password|without-password)\s*$' \
|
||||
/etc/ssh/sshd_config ||
|
||||
echo 'true'
|
||||
)"
|
||||
if test -n "${my_allow_root}"; then
|
||||
$cmd_sed \
|
||||
's/#*[[:space:]]*PermitRootLogin[[:space:]]*(yes|no|prohibit-password|without-password)[[:space:]]*$/PermitRootLogin prohibit-password/g' \
|
||||
/etc/ssh/sshd_config
|
||||
if ! grep -q -E \
|
||||
'^PermitRootLogin prohibit-password$' \
|
||||
/etc/ssh/sshd_config; then
|
||||
echo ""
|
||||
echo "ERROR"
|
||||
echo " failed to update '/etc/ssh/sshd_config'"
|
||||
echo ""
|
||||
return 1
|
||||
fi
|
||||
echo " RESTART REQUIRED: disabled root password login"
|
||||
my_changes='true'
|
||||
else
|
||||
echo " PASS: 'root' can NOT login via password"
|
||||
fi
|
||||
|
||||
# UsePAM
|
||||
echo ""
|
||||
echo "Checking for 'UsePAM no' (macOS only)..."
|
||||
# shellcheck disable=SC2016
|
||||
echo ' test "$(uname -s)" = "Darwin" &&'
|
||||
echo " grep '^\s*UsePAM\s*no' /etc/ssh/sshd_config"
|
||||
if test "$(uname -s)" = "Darwin"; then
|
||||
my_allow_pam="$(
|
||||
grep -q \
|
||||
'^\s*UsePAM\s*no' \
|
||||
/etc/ssh/sshd_config ||
|
||||
echo 'true'
|
||||
)"
|
||||
if test -n "${my_allow_pam}"; then
|
||||
$cmd_sed \
|
||||
's/#*[[:space:]]*UsePAM[[:space:]]*(yes|no)[[:space:]]*$/UsePAM no/g' \
|
||||
/etc/ssh/sshd_config
|
||||
if ! grep -q '^UsePAM no$' /etc/ssh/sshd_config; then
|
||||
echo ""
|
||||
echo "ERROR"
|
||||
echo " failed to update '/etc/ssh/sshd_config'"
|
||||
echo ""
|
||||
return 1
|
||||
fi
|
||||
echo " RESTART REQUIRED: disabled macOS password login"
|
||||
my_changes='true'
|
||||
else
|
||||
echo " PASS: passwords are NOT allowed"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "${my_changes}"; then
|
||||
echo ""
|
||||
echo ""
|
||||
echo "All checks pass. No changes necessary."
|
||||
echo ""
|
||||
return 0
|
||||
fi
|
||||
|
||||
if test -n "${my_bsd_sed}"; then
|
||||
$cmd_sudo rm -f /etc/ssh/sshd_config.prohibit-password-bak
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "##################################################################"
|
||||
echo "# #"
|
||||
echo "# IMPORTANT #"
|
||||
echo "# #"
|
||||
echo "# READ CAREFULLY #"
|
||||
echo "# #"
|
||||
echo "# (or get locked out) #"
|
||||
echo "# #"
|
||||
echo "##################################################################"
|
||||
echo ""
|
||||
|
||||
echo ""
|
||||
echo "1. TEST SSH KEYS"
|
||||
echo ""
|
||||
echo " Be sure that you can login as an admin user with ssh keys"
|
||||
echo ""
|
||||
echo "2. RESTART SSH with one of the following:"
|
||||
echo ""
|
||||
echo " systemctl restart sshd # Ubuntu / Debian"
|
||||
echo " rc-service sshd restart # Alpine / Gentoo"
|
||||
echo " killall sshd # all others"
|
||||
echo ""
|
||||
}
|
||||
|
||||
main "${1:-app}" "${2:-}"
|
||||
@@ -5,5 +5,8 @@ echo "Installing sudo.cmd..."
|
||||
# Couldn't figure out how to get this to work with "here strings", so forgive the ugly, but at least it works
|
||||
Set-Content -Path .local\bin\sudo.cmd -Value "@echo off`r`npowershell -Command ""Start-Process cmd -Verb RunAs -ArgumentList '/c cd /d %CD% && %*'""`r`n@echo on"
|
||||
|
||||
# Add to path
|
||||
& "$Env:USERPROFILE\.local\bin\pathman.exe" add ~/.local/bin
|
||||
|
||||
echo "Installed to '$Env:USERPROFILE\.local\bin\sudo.cmd'"
|
||||
echo ""
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
---
|
||||
title: vim-airline-themes
|
||||
homepage: https://github.com/vim-airline/vim-airline-themes
|
||||
tagline: |
|
||||
vim-airline-themes are the 1st-party themes for vim-airline
|
||||
---
|
||||
|
||||
To update (replacing the current version) run `webi vim-airline-themes`.
|
||||
|
||||
### Files
|
||||
|
||||
These are the files / directories that are created and/or modified with this
|
||||
install:
|
||||
|
||||
```text
|
||||
~/.vimrc
|
||||
~/.vim/plugins/airline.vim
|
||||
~/.vim/pack/plugins/start/vim-airline-themes/
|
||||
```
|
||||
|
||||
## Cheat Sheet
|
||||
|
||||
> The official themes for vim-airline.
|
||||
|
||||
Adds the theme selection to `~/.vim/plugins/airline.vim` \
|
||||
(see [vim-airline](../vim-airline/)).
|
||||
|
||||
```vim
|
||||
let g:airline_theme='simple'
|
||||
```
|
||||
|
||||
See
|
||||
[github.com/vim-airline/vim-airline-themes](https://github.com/vim-airline/vim-airline-themes)
|
||||
for a list of available themes.
|
||||
@@ -1 +0,0 @@
|
||||
let g:airline_theme='simple'
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/usr/bin/env pwsh
|
||||
|
||||
IF (!(Test-Path -Path "$Env:USERPROFILE\.vim\pack\plugins\start")) {
|
||||
New-Item -Path "$Env:USERPROFILE\.vim\pack\plugins\start" -ItemType Directory -Force | out-null
|
||||
}
|
||||
Remove-Item -Path "$Env:USERPROFILE\.vim\pack\plugins\start\vim-airline-themes" -Recurse -ErrorAction Ignore
|
||||
& git clone --depth=1 https://github.com/vim-airline/vim-airline-themes.git "$Env:USERPROFILE\.vim\pack\plugins\start\vim-airline-themes"
|
||||
@@ -1,42 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
__init_vim_airline_themes() {
|
||||
set -e
|
||||
set -u
|
||||
|
||||
mkdir -p "$HOME/.vim/pack/plugins/start"
|
||||
rm -rf "$HOME/.vim/pack/plugins/start/vim-airline-themes"
|
||||
git clone --depth=1 https://github.com/vim-airline/vim-airline-themes.git "$HOME/.vim/pack/plugins/start/vim-airline-themes"
|
||||
|
||||
if [ ! -f "$HOME/.vimrc" ]; then
|
||||
touch "$HOME/.vimrc"
|
||||
fi
|
||||
|
||||
mkdir -p ~/.vim/plugins
|
||||
if [ -f "$HOME/.vim/plugins/airline.vim" ]; then
|
||||
WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"}
|
||||
if ! grep -qF "let g:airline_theme=" $HOME/.vim/plugins/airline.vim; then
|
||||
echo ""
|
||||
echo "set theme 'simple' as default, update in $HOME/.vim/plugins/airline.vim"
|
||||
curl -s "$WEBI_HOST/packages/vim-airline-themes/airline.vim" >> $HOME/.vim/plugins/airline.vim
|
||||
fi
|
||||
else
|
||||
curl -fsSL -o ~/.vim/plugins/airline.vim "$WEBI_HOST/packages/vim-airline-themes/airline.vim"
|
||||
fi
|
||||
|
||||
if ! grep 'source.*plugins.airline.vim' -r ~/.vimrc > /dev/null 2> /dev/null; then
|
||||
set +e
|
||||
mkdir -p ~/.vim/plugins
|
||||
printf '\n" vim-airline-themes: reasonable defaults from webinstall.dev/vim-airline-themes\n' >> ~/.vimrc
|
||||
printf 'source ~/.vim/plugins/airline.vim\n' >> ~/.vimrc
|
||||
set -e
|
||||
echo ""
|
||||
echo "add ~/.vim/plugins/airline.vim"
|
||||
echo "updated ~/.vimrc with 'source ~/.vim/plugins/airline.vim'"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "vim-airline-themes enabled with reasonable defaults"
|
||||
}
|
||||
|
||||
__init_vim_airline_themes
|
||||
@@ -1,27 +0,0 @@
|
||||
---
|
||||
title: vim-airline
|
||||
homepage: https://github.com/vim-airline/vim-airline
|
||||
tagline: |
|
||||
vim-airline: Lean & mean status/tabline for vim that's light as air.
|
||||
---
|
||||
|
||||
To update (replacing the current version) run `webi vim-airline`.
|
||||
|
||||
### Files
|
||||
|
||||
These are the files / directories that are created and/or modified with this
|
||||
install:
|
||||
|
||||
```text
|
||||
~/.vimrc
|
||||
~/.vim/plugins/airline.vim
|
||||
~/.vim/pack/plugins/start/vim-airline/
|
||||
```
|
||||
|
||||
## Cheat Sheet
|
||||
|
||||
> A single-line status bar for vim.
|
||||
|
||||

|
||||
|
||||
See [vim-airline-themes](../vim-airline-themes/) for additional themes.
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/usr/bin/env pwsh
|
||||
|
||||
IF (!(Test-Path -Path "$Env:USERPROFILE\.vim\pack\plugins\start")) {
|
||||
New-Item -Path "$Env:USERPROFILE\.vim\pack\plugins\start" -ItemType Directory -Force | out-null
|
||||
}
|
||||
Remove-Item -Path "$Env:USERPROFILE\.vim\pack\plugins\start\vim-airline" -Recurse -ErrorAction Ignore
|
||||
& git clone --depth=1 https://github.com/vim-airline/vim-airline.git "$Env:USERPROFILE\.vim\pack\plugins\start\vim-airline"
|
||||
@@ -1,36 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
__init_vim_airline() {
|
||||
set -e
|
||||
set -u
|
||||
|
||||
mkdir -p "$HOME/.vim/pack/plugins/start"
|
||||
rm -rf "$HOME/.vim/pack/plugins/start/vim-airline"
|
||||
git clone --depth=1 https://github.com/vim-airline/vim-airline.git "$HOME/.vim/pack/plugins/start/vim-airline"
|
||||
|
||||
if [ ! -f "$HOME/.vimrc" ]; then
|
||||
touch "$HOME/.vimrc"
|
||||
fi
|
||||
|
||||
mkdir -p ~/.vim/plugins
|
||||
if ! [ -f "$HOME/.vim/plugins/airline.vim" ]; then
|
||||
WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"}
|
||||
curl -fsSL -o ~/.vim/plugins/airline.vim "$WEBI_HOST/packages/vim-airline/airline.vim"
|
||||
fi
|
||||
|
||||
if ! grep 'source.*plugins.airline.vim' -r ~/.vimrc > /dev/null 2> /dev/null; then
|
||||
set +e
|
||||
mkdir -p ~/.vim/plugins
|
||||
printf '\n" vim-airline: reasonable defaults from webinstall.dev/vim-airline\n' >> ~/.vimrc
|
||||
printf 'source ~/.vim/plugins/airline.vim\n' >> ~/.vimrc
|
||||
set -e
|
||||
echo ""
|
||||
echo "add ~/.vim/plugins/airline.vim"
|
||||
echo "updated ~/.vimrc with 'source ~/.vim/plugins/airline.vim'"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "vim-airline enabled with reasonable defaults"
|
||||
}
|
||||
|
||||
__init_vim_airline
|
||||
@@ -1,70 +0,0 @@
|
||||
---
|
||||
title: vim-italics
|
||||
homepage: https://webinstall.dev/vim-italics
|
||||
tagline: |
|
||||
vim-italics sets vim to use underlines for italics
|
||||
---
|
||||
|
||||
To update (replacing the current version) run `webi vim-italics`.
|
||||
|
||||
### Files
|
||||
|
||||
These are the files / directories that are created and/or modified with this
|
||||
install:
|
||||
|
||||
```text
|
||||
~/.vimrc
|
||||
~/.vim/plugins/italics.vim
|
||||
```
|
||||
|
||||
## Cheat Sheet
|
||||
|
||||
`vim` uses background highlighting for italics by default.
|
||||
|
||||
Many Terminal color themes use the same color for background highlighting as for
|
||||
the cursor, which makes tracking the cursor difficult.
|
||||
|
||||
This swaps to italics to use underlines instead, which works in all themes.
|
||||
|
||||
### How to install manually
|
||||
|
||||
Create the file `~/.vim/plugins/spell.vim`. Add the same contents as
|
||||
<https://github.com/webinstall/webi-installers/blob/master/vim-italics/italics.vim>.
|
||||
|
||||
That will look something like this:
|
||||
|
||||
```vim
|
||||
" use underlines for italics
|
||||
" (keeps the cursor visible while moving over italic text in all themes)
|
||||
highlight htmlItalic gui=italic ctermfg=214
|
||||
```
|
||||
|
||||
You'll then need to update `~/.vimrc` to source that plugin:
|
||||
|
||||
```vim
|
||||
" Vim Italics: underlines for italics from webinstall.dev/vim-italics
|
||||
source ~/.vim/plugins/italics.vim
|
||||
```
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
If you still can't see your cursor on italics, or things otherwise look wrong,
|
||||
try moving the `source ~/.vim/plugins/italics.vim` closer to the top of your
|
||||
config - above other things that may also be modifying the italics behavior.
|
||||
|
||||
#### Example
|
||||
|
||||
`~/.vimrc`:
|
||||
|
||||
```diff
|
||||
+ " Vim Italics: underlines for italics from webinstall.dev/vim-italics
|
||||
+ source ~/.vim/plugins/italics.vim
|
||||
|
||||
" ALE: reasonable defaults from webinstall.dev/vim-ale
|
||||
source ~/.vim/plugins/ale.vim
|
||||
|
||||
- " Vim Italics: underlines for italics from webinstall.dev/vim-italics
|
||||
- source ~/.vim/plugins/italics.vim
|
||||
```
|
||||
|
||||
Or, in some cases, moving it closer to the bottom may help.
|
||||
@@ -1,36 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
__init_vim_italics() {
|
||||
set -e
|
||||
set -u
|
||||
|
||||
mkdir -p "$HOME/.vim/plugins"
|
||||
rm -rf "$HOME/.vim/plugins/italics.vim"
|
||||
|
||||
echo ""
|
||||
|
||||
if [ ! -e "$HOME/.vimrc" ]; then
|
||||
touch "$HOME/.vimrc"
|
||||
fi
|
||||
|
||||
if ! [ -f "$HOME/.vim/plugins/italics.vim" ]; then
|
||||
mkdir -p ~/.vim/plugins
|
||||
WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"}
|
||||
curl -fsS -o ~/.vim/plugins/italics.vim "$WEBI_HOST/packages/vim-italics/italics.vim"
|
||||
fi
|
||||
|
||||
if ! grep 'source.*plugins.italics.vim' -r ~/.vimrc > /dev/null 2> /dev/null; then
|
||||
set +e
|
||||
mkdir -p ~/.vim/plugins
|
||||
printf '\n" Vim Italics: underlines for italics from webinstall.dev/vim-italics\n' >> ~/.vimrc
|
||||
printf 'source ~/.vim/plugins/italics.vim\n' >> ~/.vimrc
|
||||
set -e
|
||||
echo "added ~/.vim/plugins/italics.vim"
|
||||
echo "updated ~/.vimrc with 'source ~/.vim/plugins/italics.vim'"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
echo "vim-italics enabled"
|
||||
}
|
||||
|
||||
__init_vim_italics
|
||||
@@ -1,3 +0,0 @@
|
||||
" use underlines for italics
|
||||
" (keeps the cursor visible while moving over italic text in all themes)
|
||||
highlight htmlItalic gui=italic cterm=underline ctermfg=214
|
||||
@@ -62,8 +62,10 @@ These are the files that are installed when you use [webinstall.dev](/):
|
||||
~/.local/opt/pathman-*
|
||||
|
||||
# Windows
|
||||
~/.local/bin/webi.bat
|
||||
~/.local/bin/webi.cmd
|
||||
~/.local/bin/webi-pwsh.ps1
|
||||
~/.local/bin/pathman.exe
|
||||
~/.local/opt/pathman-*
|
||||
```
|
||||
|
||||
Assuming that you don't use `pathman` for anything else, you can safely remove
|
||||
|
||||
@@ -57,4 +57,4 @@ Remove-Item -Path "$pkg_dst" -Recurse -ErrorAction Ignore | out-null
|
||||
Copy-Item -Path "$pkg_src" -Destination "$pkg_dst" -Recurse
|
||||
|
||||
# Add to Windows PATH
|
||||
webi_path_add ~/.local/opt/zig
|
||||
& "$Env:USERPROFILE\.local\bin\pathman.exe" add ~/.local/opt/zig
|
||||
|
||||
Reference in New Issue
Block a user