Skip to content

Commit

Permalink
Merge pull request #173 from szymonos/dev
Browse files Browse the repository at this point in the history
Merge dev to main
  • Loading branch information
szymonos authored Oct 21, 2024
2 parents 5243906 + 0a4829d commit 8ef40af
Show file tree
Hide file tree
Showing 7 changed files with 129 additions and 17 deletions.
12 changes: 12 additions & 0 deletions .assets/config/omp_cfg/nerd.omp.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@
"template": "<#CCCCCC>[</>{{ .FormattedMs }}<#CCCCCC>]</> ",
"type": "executiontime"
},
{
"foreground": "#23D18B",
"foreground_templates": [
"{{ if gt .Code 0 }}#F14C4C{{ end }}"
],
"properties": {
"always_enabled": true
},
"style": "plain",
"template": "<b>→</b> ",
"type": "status"
},
{
"foreground": "#2CC7EE",
"style": "plain",
Expand Down
10 changes: 5 additions & 5 deletions .assets/provision/install_base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ SYS_ID="$(sed -En '/^ID.*(alpine|arch|fedora|debian|ubuntu|opensuse).*/{s//\1/;p

case $SYS_ID in
alpine)
apk add --no-cache bash bind-tools build-base ca-certificates iputils curl git jq less lsb-release-minimal mandoc nmap openssh-client openssl sudo tar tree unzip vim
apk add --no-cache bash bind-tools build-base ca-certificates iputils curl git jq less lsb-release-minimal mandoc nmap openssh-client openssl sudo tar tig tree unzip vim
;;
arch)
pacman -Sy --needed --noconfirm --color=auto base-devel bash-completion dnsutils git jq lsb-release man-db nmap openssh openssl tar tree unzip vim wget 2>/dev/null
pacman -Sy --needed --noconfirm --color=auto base-devel bash-completion dnsutils git jq lsb-release man-db nmap openssh openssl tar tig tree unzip vim wget 2>/dev/null
# install paru
if ! pacman -Qqe paru &>/dev/null; then
user=${1:-$(id -un 1000 2>/dev/null)}
Expand All @@ -33,14 +33,14 @@ arch)
;;
fedora)
rpm -q patch &>/dev/null || dnf groupinstall -y 'Development Tools'
dnf install -qy bash-completion bind-utils curl dnf-plugins-core git iputils jq redhat-lsb-core man-db nmap openssl tar tree unzip vim wget
dnf install -qy bash-completion bind-utils curl dnf-plugins-core git iputils jq redhat-lsb-core man-db nmap openssl tar tig tree unzip vim wget
;;
debian | ubuntu)
export DEBIAN_FRONTEND=noninteractive
apt-get update && apt-get install -y build-essential bash-completion ca-certificates gnupg dnsutils curl git iputils-tracepath jq lsb-release man-db nmap openssl tar tree unzip vim wget
apt-get update && apt-get install -y build-essential bash-completion ca-certificates gnupg dnsutils curl git iputils-tracepath jq lsb-release man-db nmap openssl tar tig tree unzip vim wget
;;
opensuse)
rpm -q patch &>/dev/null || zypper in -yt pattern devel_basis
zypper in -y bash-completion bind-utils git jq lsb-release nmap openssl tar tree unzip vim wget
zypper in -y bash-completion bind-utils git jq lsb-release nmap openssl tar tig tree unzip vim wget
;;
esac
46 changes: 46 additions & 0 deletions .assets/provision/install_crictl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env bash
: '
sudo .assets/provision/install_crictl.sh >/dev/null
'
if [ $EUID -ne 0 ]; then
printf '\e[31;1mRun the script as root.\e[0m\n' >&2
exit 1
fi

# dotsource file with common functions
. .assets/provision/source.sh

# define variables
APP='crictl'
REL=$1
retry_count=0
# get latest release if not provided as a parameter
if [ -z "$REL" ]; then
if REL="$(get_gh_release_latest --owner 'kubernetes-sigs' --repo 'cri-tools')"; then
# return latest release
echo $REL
else
exit 1
fi
fi

if type $APP &>/dev/null; then
VER=$(crictl --version | sed -En 's/crictl version v([0-9\.]+).*/\1/p')
if [ "$REL" = "$VER" ]; then
printf "\e[32m$APP v$VER is already latest\e[0m\n" >&2
exit 0
fi
fi

printf "\e[92minstalling \e[1m$APP\e[22m v$REL\e[0m\n" >&2
# create temporary dir for the downloaded binary
TMP_DIR=$(mktemp -dp "$PWD")
# calculate download uri
URL="https://github.com/kubernetes-sigs/cri-tools/releases/download/v${REL}/${APP}-v${REL}-linux-amd64.tar.gz"
# download and install file
if download_file --uri $URL --target_dir $TMP_DIR; then
tar -zxf "$TMP_DIR/$(basename $URL)" --no-same-owner -C "$TMP_DIR"
install -m 0755 "$TMP_DIR/crictl" /usr/local/bin/
fi
# remove temporary dir
rm -fr "$TMP_DIR"
4 changes: 3 additions & 1 deletion .assets/provision/install_etcdctl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ URL="https://github.com/etcd-io/etcd/releases/download/v${REL}/etcd-v${REL}-linu
# download and install file
if download_file --uri $URL --target_dir $TMP_DIR; then
tar -zxf "$TMP_DIR/$(basename $URL)" --strip-components=1 --no-same-owner -C "$TMP_DIR"
install -m 0755 "$TMP_DIR/$(basename $URL)" /usr/local/bin/
install -m 0755 "$TMP_DIR/etcd" /usr/local/bin/
install -m 0755 "$TMP_DIR/etcdctl" /usr/local/bin/
install -m 0755 "$TMP_DIR/etcdutl" /usr/local/bin/
fi
# remove temporary dir
rm -fr "$TMP_DIR"
48 changes: 48 additions & 0 deletions .assets/provision/install_nerdctl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env bash
: '
sudo .assets/provision/install_nerdctl.sh >/dev/null
'
if [ $EUID -ne 0 ]; then
printf '\e[31;1mRun the script as root.\e[0m\n' >&2
exit 1
fi

# dotsource file with common functions
. .assets/provision/source.sh

# define variables
APP='nerdctl'
REL=$1
retry_count=0
# get latest release if not provided as a parameter
if [ -z "$REL" ]; then
if REL="$(get_gh_release_latest --owner 'containerd' --repo 'nerdctl')"; then
# return latest release
echo $REL
else
exit 1
fi
fi

if type $APP &>/dev/null; then
VER=$(nerdctl --version | sed -En 's/nerdctl version ([0-9\.]+).*/\1/p')
if [ "$REL" = "$VER" ]; then
printf "\e[32m$APP v$VER is already latest\e[0m\n" >&2
exit 0
fi
fi

printf "\e[92minstalling \e[1m$APP\e[22m v$REL\e[0m\n" >&2
# create temporary dir for the downloaded binary
TMP_DIR=$(mktemp -dp "$PWD")
# calculate download uri
URL="https://github.com/containerd/nerdctl/releases/download/v${REL}/${APP}-${REL}-linux-amd64.tar.gz"
# download and install file
if download_file --uri $URL --target_dir $TMP_DIR; then
tar -zxf "$TMP_DIR/$(basename $URL)" --no-same-owner -C "$TMP_DIR"
install -m 0755 "$TMP_DIR/nerdctl" /usr/local/bin/
install -m 0755 "$TMP_DIR/containerd-rootless-setuptool.sh" /usr/local/bin/
install -m 0755 "$TMP_DIR/containerd-rootless.sh" /usr/local/bin/
fi
# remove temporary dir
rm -fr "$TMP_DIR"
2 changes: 1 addition & 1 deletion .assets/provision/install_terraform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ fedora)
debian | ubuntu)
export DEBIAN_FRONTEND=noninteractive
wget -O- https://apt.releases.hashicorp.com/gpg 2>/dev/null | gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
gpg --no-default-keyring --keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg --fingerprint 2>/dev/null && rm -fr $HOME/.gnupg
gpg --no-default-keyring --keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg --fingerprint 2>/dev/null
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" >/etc/apt/sources.list.d/hashicorp.list
apt-get update && apt-get install terraform
;;
Expand Down
24 changes: 14 additions & 10 deletions .assets/provision/setup_profile_user.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,20 @@ for ($i = 0; ((Get-Module PSReadLine -ListAvailable).Count -eq 1) -and $i -lt 5;
}

# install kubectl autocompletion
$kubectlSet = try { Select-String '__kubectl_debug' -Path $PROFILE -Quiet } catch { $false }
if ((Test-Path /usr/bin/kubectl) -and -not $kubectlSet) {
Write-Host 'adding kubectl auto-completion...'
# build completer text
$completer = [string]::Join("`n",
(/usr/bin/kubectl completion powershell) -join "`n",
"Register-ArgumentCompleter -CommandName 'k' -ScriptBlock `${__kubectlCompleterBlock}"
)
# add additional ArgumentCompleter at the end of the profile
[System.IO.File]::WriteAllText($PROFILE, $completer)
if (Test-Path /usr/bin/kubectl) {
$kubectlSet = try { Select-String 'Set-Alias -Name k' -Path $PROFILE.CurrentUserCurrentHost -SimpleMatch -Quiet } catch { $false }
if (-not $kubectlSet) {
Write-Host 'adding kubectl auto-completion...'
# build completer text
$completer = [string]::Join("`n",
(/usr/bin/kubectl completion powershell) -join "`n",
"`n# setup autocompletion for the 'k' alias",
'Set-Alias -Name k -Value kubectl',
"Register-ArgumentCompleter -CommandName 'k' -ScriptBlock `${__kubectlCompleterBlock}"
)
# add additional ArgumentCompleter at the end of the profile
[System.IO.File]::WriteAllText($PROFILE, $completer)
}
}

# setup conda initialization
Expand Down

0 comments on commit 8ef40af

Please sign in to comment.