addet some content
This commit is contained in:
parent
5c07745407
commit
2f5fadd6bb
10 changed files with 346 additions and 757 deletions
|
@ -1,190 +0,0 @@
|
|||
{
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# ─< Check if the given command exists silently >─────────────────────────────────────────
|
||||
command_exists() {
|
||||
command -v "$@" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# WHY:
|
||||
# This import will give you the following variables:
|
||||
# _sudo="sudo -E" <- only if non root user
|
||||
# distro = <distro name, like 'arch', 'debian', 'fedora'..>
|
||||
# arch = bool
|
||||
# fedora = bool
|
||||
# opensuse = bool....
|
||||
# You can then use it for, `if $arch; then`
|
||||
# Also this gives you the _install command, which installs a package pased on the packagemanager/distro used.
|
||||
# CAUTION:
|
||||
# This only wokrs for generic package names, like neovim, or vim, or tmux etc..
|
||||
# not every package packagemanager has the same packagenames for their packages..
|
||||
getImports() {
|
||||
i="https://git.k4li.de/scripts/imports/raw/branch/main/distros.sh"
|
||||
import="$(mktemp)"
|
||||
if command_exists curl; then
|
||||
curl -fsSL $i -o $import
|
||||
else
|
||||
echo "curl is required, but missing.."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source "$import"
|
||||
sleep 0.3
|
||||
rm "$import"
|
||||
# echo_warning "cleaned $import"
|
||||
|
||||
source-script "https://git.k4li.de/scripts/beddu/raw/branch/main/dist/beddu.sh"
|
||||
}
|
||||
|
||||
getDependencies() {
|
||||
echo_pkg deps "Checking build dependencies, and installs missing.."
|
||||
|
||||
local depsDebian=(git ninja-build gettext cmake curl build-essential)
|
||||
local depsFedora=(git ninja-build cmake gcc make gettext curl glibc-gconv-extra)
|
||||
local depsOpensuse=(git ninja cmake gcc-c++ gettext-tools curl)
|
||||
local depsArch=(git base-devel cmake ninja curl)
|
||||
local depsAlpine=(git build-base cmake coreutils curl gettext-tiny-dev)
|
||||
|
||||
declare -A deps=(
|
||||
[debian]="depsDebian"
|
||||
[ubuntu]="depsDebian"
|
||||
[opensuse]="depsOpensuse"
|
||||
[fedora]="depsFedora"
|
||||
[arch]="depsArch"
|
||||
[alpine]="depsAlpine"
|
||||
)
|
||||
|
||||
declare -n pkgArray="${deps[$distro]}"
|
||||
|
||||
case "$distro" in
|
||||
debian | ubuntu | arch | fedora | alpine | opensuse)
|
||||
checkAndInstall "${pkgArray[@]}"
|
||||
;;
|
||||
*)
|
||||
echo_error "Cannot install for $distro"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
cloneSources() {
|
||||
local err
|
||||
cloneDir="$(mktemp -d)"
|
||||
# echo_pkg git "Cloning $PACKAGE sources at $cloneDir/neovim.."
|
||||
|
||||
cd $cloneDir || mkdir $cloneDir && cd $cloneDir
|
||||
|
||||
if command_exists git; then
|
||||
spin yellow "Cloning $PACKAGE sources at $cloneDir/neovim.."
|
||||
sleep 1
|
||||
if run --err err git clone --depth=1 https://github.com/neovim/neovim.git; then
|
||||
check "Cloned sources"
|
||||
line
|
||||
|
||||
cd neovim || throw "Cannot navigate into neovim"
|
||||
# pen ${output:-}
|
||||
else
|
||||
throw "Cannot clone the repo.."
|
||||
pen bold red "The error: $err"
|
||||
fi
|
||||
else
|
||||
echo_error "Git was required, but is missing.. exiting now"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
makeInstall() {
|
||||
# echo_pkg build "Compiling neovim from source"
|
||||
spin "Compiling neovim from source"
|
||||
if run make CMAKE_BUILD_TYPE=RelWithDebInfo; then
|
||||
check "Compiled $PACKAGE from source"
|
||||
line
|
||||
echo_pkg install
|
||||
$_sudo make install
|
||||
else
|
||||
echo_error "Failure while building!"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
checkAndInitConfig() {
|
||||
if [ -d "$HOME/.config/nvim/" ]; then
|
||||
# echo_pkg qol "Prefetching neovim setup configuration.."
|
||||
spin "Prefetching neovim setup configuration.."
|
||||
if run nvim --headless +q; then
|
||||
check "Prefetched config"
|
||||
else
|
||||
throw "Prefetching config went terribly wrong!"
|
||||
fi
|
||||
else
|
||||
# echo_warning "You don't have a neovim config installed. Do you want to clone one now? [Y]es (standard), [m]inimal, [n]o"
|
||||
# read -r askNvim
|
||||
choose askNvim "You don't have a neovim config installed. Do you want to clone one now?" "pika's standard config" "pika's minimal config" none
|
||||
|
||||
case "$askNvim" in
|
||||
"pika's standard config")
|
||||
git clone --recursive --depth=1 https://git.k4li.de/dotfiles/nvim.git "$HOME/.config/nvim"
|
||||
sleep 0.2
|
||||
nvim --headless +q
|
||||
;;
|
||||
"pika's minimal config")
|
||||
git clone --recursive --depth=1 https://git.k4li.de/dotfiles/nvim-mini.git "$HOME/.config/nvim"
|
||||
sleep 0.2
|
||||
nvim --headless +q
|
||||
;;
|
||||
none) return 0 ;;
|
||||
*)
|
||||
echo_error "Something failed HARD!"
|
||||
return 69
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
if $silent; then
|
||||
echo_warning "Executing script silently!"
|
||||
fi
|
||||
|
||||
if ! getDependencies; then
|
||||
echo_error "Error when installing dependencies.."
|
||||
fi
|
||||
|
||||
cloneSources
|
||||
makeInstall
|
||||
|
||||
checkAndInitConfig </dev/tty
|
||||
}
|
||||
|
||||
if getImports; then
|
||||
# ─< package variable >───────────────────────────────────────────────────────────────────
|
||||
unset PACKAGE
|
||||
|
||||
# ─< argument list variables >────────────────────────────────────────────────────────────
|
||||
silent=false
|
||||
|
||||
sleep 0.1
|
||||
|
||||
PACKAGE=neovim
|
||||
if command_exists "$PACKAGE"; then
|
||||
echo_warning "$PACKAGE is already installed!"
|
||||
echo_warning "Exiting now!"
|
||||
exit 69
|
||||
fi
|
||||
|
||||
# ─< parse arguments and get variable contents >──────────────────────────────────────────
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--silent | -s)
|
||||
export silent=true
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
main </dev/tty
|
||||
fi
|
||||
|
||||
echo_note "Cleaning up old $cloneDir directory.."
|
||||
rm -rf "$cloneDir"
|
||||
}
|
|
@ -3,12 +3,10 @@ FROM ubuntu:noble
|
|||
RUN apt update && apt install --assume-yes curl zsh fzf zoxide unzip sudo git make stow
|
||||
|
||||
COPY ./.src/colorscript.sh .
|
||||
COPY ./.src/neovim.sh .
|
||||
COPY ./.src/omp.sh .
|
||||
|
||||
RUN bash ./omp.sh -d /bin && rm ./omp.sh
|
||||
RUN bash colorscript.sh && rm colorscript.sh
|
||||
RUN bash neovim.sh && rm neovim.sh
|
||||
|
||||
# RUN useradd -m -G sudo -r -s /usr/bin/zsh ubuntu
|
||||
RUN usermod -aG sudo ubuntu
|
||||
|
@ -17,7 +15,7 @@ RUN echo "ubuntu ALL=(ALL:ALL) NOPASSWD:ALL" >> /etc/sudoers
|
|||
USER ubuntu
|
||||
WORKDIR /home/ubuntu
|
||||
|
||||
COPY .src/setup.sh .
|
||||
COPY .src/setup.sh /bin/setup
|
||||
|
||||
RUN git clone --recursive --depth=1 https://git.k4li.de/dotfiles/minimal.git /home/ubuntu/dotfiles
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue