Compare commits
3 Commits
96b48e45ee
...
4f137bd19a
Author | SHA1 | Date |
---|---|---|
|
4f137bd19a | |
|
2e60bb0779 | |
|
8d30e01771 |
|
@ -1 +1 @@
|
||||||
echo "~/.bash_profile is executed"
|
source ~/.profile
|
||||||
|
|
|
@ -167,7 +167,7 @@ section_end
|
||||||
# home bin
|
# home bin
|
||||||
section "home bin"
|
section "home bin"
|
||||||
if [ $PROFILE_BIN -gt 0 ]; then
|
if [ $PROFILE_BIN -gt 0 ]; then
|
||||||
PATH="$HOME/bin:$PATH"
|
PATH="$HOME/bin:$HOME/.local/bin:$PATH"
|
||||||
export PATH
|
export PATH
|
||||||
fi
|
fi
|
||||||
section_end
|
section_end
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
echo "~/.zprofile is being executed"
|
source ~/.profile
|
||||||
|
|
|
@ -0,0 +1,92 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
tag_file="$(mktemp)"
|
||||||
|
trap 'rm "${tag_file}"' EXIT
|
||||||
|
|
||||||
|
add_tag() {
|
||||||
|
for tag in "$@"; do
|
||||||
|
if ! has_tags "$tag"; then
|
||||||
|
echo "Adding detected tag: $tag"
|
||||||
|
echo "${tag}" >> "${tag_file}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
has_tags() {
|
||||||
|
for req in "$@"; do
|
||||||
|
printf "Checking for tag: $req... "
|
||||||
|
local detected=0
|
||||||
|
while IFS= read -r line; do
|
||||||
|
if [ "$line" = "$req" ]; then
|
||||||
|
echo "yes"
|
||||||
|
detected=1
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done < "$tag_file"
|
||||||
|
if [ "$detected" -eq 0 ]; then
|
||||||
|
echo "no"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
has_binary() {
|
||||||
|
printf "Checking for binary: $1... "
|
||||||
|
if ! command -v "$1" >/dev/null 2>&1; then
|
||||||
|
echo "no"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
echo "yes"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# arch linux
|
||||||
|
|
||||||
|
if [ -f /etc/arch-release ]; then
|
||||||
|
add_tag os:arch
|
||||||
|
add_tag os_like:archlinux
|
||||||
|
fi
|
||||||
|
|
||||||
|
# os-release
|
||||||
|
|
||||||
|
if [ -f /etc/os-release ]; then
|
||||||
|
(
|
||||||
|
source /etc/os-release
|
||||||
|
add_tag "os:${ID}"
|
||||||
|
if [ ! -z "${ID_LIKE}" ]; then
|
||||||
|
add_tag "os_like:${ID_LIKE}"
|
||||||
|
fi
|
||||||
|
if [ ! -z "${VERSION_ID}" ]; then
|
||||||
|
add_tag "version:${VERSION_ID}"
|
||||||
|
fi
|
||||||
|
if [ ! -z "${VERSION_CODENAME}" ]; then
|
||||||
|
add_tag "version:${VERSION_CODENAME}"
|
||||||
|
fi
|
||||||
|
if [ ! -z "${UBUNTU_CODENAME}" ]; then
|
||||||
|
add_tag "version:${UBUNTU_CODENAME}"
|
||||||
|
fi
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# package manager detection
|
||||||
|
|
||||||
|
for pm in \
|
||||||
|
pacaur \
|
||||||
|
pacman \
|
||||||
|
pip \
|
||||||
|
npm \
|
||||||
|
yaourt \
|
||||||
|
yarn \
|
||||||
|
yay \
|
||||||
|
; do
|
||||||
|
if has_binary "$pm"; then
|
||||||
|
add_tag "pm:$pm"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# graphics UI detection
|
||||||
|
# basically just checks if an X server is running on the machine and if yes, we just assume it's a desktop, not a server
|
||||||
|
if ps aux | grep Xorg >/dev/null 2>&1; then
|
||||||
|
add_tag "xorg_running" "desktop"
|
||||||
|
fi
|
|
@ -0,0 +1,121 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
source ./os.sh
|
||||||
|
|
||||||
|
apt_install() {
|
||||||
|
DEBIAN_FRONTEND="noninteractive" apt-get install -y "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
pacman_install() {
|
||||||
|
sudo pacman -S --noconfirm --needed "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
yay_install() {
|
||||||
|
yay -S --noconfirm --needed "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
pacaur_install() {
|
||||||
|
pacaur -S --noconfirm --needed "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
yaourt_install() {
|
||||||
|
yaourt -S --noconfirm --needed "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
pip3_install() {
|
||||||
|
pip3 install --user -U "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
# Actual package installation code from here
|
||||||
|
|
||||||
|
# Arch Linux
|
||||||
|
|
||||||
|
if has_tags pm:pacman; then
|
||||||
|
# libarchive for bsdtar
|
||||||
|
pacman_install \
|
||||||
|
makepkg \
|
||||||
|
base-devel \
|
||||||
|
libarchive \
|
||||||
|
tar \
|
||||||
|
gzip \
|
||||||
|
xz
|
||||||
|
|
||||||
|
# yay
|
||||||
|
if ! has_tags pm:yay; then
|
||||||
|
if has_tags pacaur; then
|
||||||
|
pacaur_install yay
|
||||||
|
elif has_tags yaourt; then
|
||||||
|
yaourt_install yay
|
||||||
|
else
|
||||||
|
(
|
||||||
|
dir="$(mktemp -d)"
|
||||||
|
cd "${dir}"
|
||||||
|
wget https://aur.archlinux.org/cgit/aur.git/snapshot/yay.tar.gz -O- | tar -xz --strip=1
|
||||||
|
makepkg -sri --noconfirm
|
||||||
|
cd
|
||||||
|
rm -rf "${dir}"
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
add_tag pm:yay
|
||||||
|
fi
|
||||||
|
|
||||||
|
# from here on we should have yay available
|
||||||
|
yay_install \
|
||||||
|
zsh \
|
||||||
|
zsh-syntax-highlighting
|
||||||
|
|
||||||
|
if has_tags desktop; then
|
||||||
|
yay_install \
|
||||||
|
powerline-fonts \
|
||||||
|
rxvt-unicode-better-wheel-scrolling-unicode3 \
|
||||||
|
ttf-fantasque-sans-mono \
|
||||||
|
rxvt-unicode \
|
||||||
|
urxvt-tabbedex \
|
||||||
|
ibus
|
||||||
|
else
|
||||||
|
yay_install \
|
||||||
|
rxvt-unicode-terminfo
|
||||||
|
fi
|
||||||
|
|
||||||
|
# pip
|
||||||
|
if ! has_tags pm:pip3; then
|
||||||
|
yay_install python-pip
|
||||||
|
add_tag pm:pip3
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Debian/Ubuntu-ish
|
||||||
|
|
||||||
|
if has_tags pm:apt; then
|
||||||
|
sudo apt update
|
||||||
|
apt_install \
|
||||||
|
bsdtar \
|
||||||
|
tar \
|
||||||
|
gzip \
|
||||||
|
xz-utils \
|
||||||
|
python-pip \
|
||||||
|
zsh \
|
||||||
|
zsh-syntax-highlighting \
|
||||||
|
ibus
|
||||||
|
add_tag pm:pip3
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Python3
|
||||||
|
|
||||||
|
if has_tags pm:pip3; then
|
||||||
|
pip3_install powerline-status
|
||||||
|
fi
|
||||||
|
|
||||||
|
# change default terminal to urxvt
|
||||||
|
|
||||||
|
if has_tags desktop; then
|
||||||
|
if has_tags os_like:debian; then
|
||||||
|
sudo update-alternatives --config urxvt
|
||||||
|
fi
|
||||||
|
for de in gnome cinnamon; do
|
||||||
|
gsettings set org.${de}.desktop.default-applications.terminal exec /usr/bin/urxvt
|
||||||
|
gsettings set org.${de}.desktop.default-applications.terminal exec-arg "-x"
|
||||||
|
done
|
||||||
|
fi
|
Loading…
Reference in New Issue