Skip to content

Commit

Permalink
Fixed functions
Browse files Browse the repository at this point in the history
  • Loading branch information
kboshold committed Aug 7, 2024
1 parent 91f1c44 commit 6432260
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 15 deletions.
75 changes: 71 additions & 4 deletions src/zellij/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ install_dependencies() {

# Get an adjusted ID independent of distro variants
if [ "${id}" = "debian" ] || [ "${id_like}" = "debian" ]; then
dependencies_install_debian ninja-build gettext cmake unzip curl build-essential jq;
dependencies_install_debian curl jq zip g++ libssl-dev pkg-config make

else
echo "Linux distro ${id} not supported. Please create a new issue: https://github.com/boshold/devcontainer-features/issues/new"
exit 1
fi
}

install_neovim_source() {
install_zellij_source() {
local repository="$1"
local version="$2"

Expand Down Expand Up @@ -46,6 +47,72 @@ install_neovim_source() {
rm -rf "$local_temp_folder"
}

install_neovim_apt() {
echo test
install_zellij_binary() {
ocal repository="$1"
local version="$2"

# Install required dependencies
install_dependencies

# Get the correct tag for the passed in version

local tag_name=`github_get_valid_tag "$repository" "$version" && util_result`
if [ $tag_name = "" ]; then
# If the tag is not found, return an error message
echo "No tag found in '$repository' for the provided version: $version" >&2
exit 1
fi

echo "The tag to be installed is '$tag_name' (https://github.com/${repository}/releases/tag/${tag_name})"
local local_temp_folder="/tmp/source-neovim-${tag_name}"
rm -rf $local_temp_folder
mkdir $local_temp_folder

# Download neovim
echo "Downloading source for ${repository}:${tag_name}..."
curl -sL https://github.com/${repository}/archive/refs/tags/${tag_name}.tar.gz | tar -xzC "$local_temp_folder" --strip-components=1 2>&1

# Build neovim
echo "Building..."
cd "$local_temp_folder"
make && make CMAKE_INSTALL_PREFIX=/usr/local/nvim install
ln -sf /usr/local/nvim/bin/nvim /usr/local/bin/nvim

# Clean up
rm -rf "$local_temp_folder"
}

install_zellij_cargo() {
ocal repository="$1"
local version="$2"

# Install required dependencies
install_dependencies

# Get the correct tag for the passed in version

local tag_name=`github_get_valid_tag "$repository" "$version" && util_result`
if [ $tag_name = "" ]; then
# If the tag is not found, return an error message
echo "No tag found in '$repository' for the provided version: $version" >&2
exit 1
fi

echo "The tag to be installed is '$tag_name' (https://github.com/${repository}/releases/tag/${tag_name})"
local local_temp_folder="/tmp/source-neovim-${tag_name}"
rm -rf $local_temp_folder
mkdir $local_temp_folder

# Download neovim
echo "Downloading source for ${repository}:${tag_name}..."
curl -sL https://github.com/${repository}/archive/refs/tags/${tag_name}.tar.gz | tar -xzC "$local_temp_folder" --strip-components=1 2>&1

# Build neovim
echo "Building..."
cd "$local_temp_folder"
make && make CMAKE_INSTALL_PREFIX=/usr/local/nvim install
ln -sf /usr/local/nvim/bin/nvim /usr/local/bin/nvim

# Clean up
rm -rf "$local_temp_folder"
}
14 changes: 3 additions & 11 deletions src/zellij/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ main() {
local configRepository=${CONFIG:-""}
local configHookEnabled=${CONFIG_HOOK:-"true"}
local installNerdFont=${NERDFONT:-"false"}
local installLazyGit=${LAZYGIT:-"false"}

if [ "$version" = "latest" ]; then
version="stable"
fi

echo "Installing feature 'neovim' using the passed configuration:"
echo " Mode: ${mode}"
Expand All @@ -34,20 +29,17 @@ main() {
echo " Config repository: ${configLocation}"
echo " Config hook enabled: ${configHookEnabled}"
echo " Install NerdFont: ${installNerdFont}"
echo " Install LazyGit: ${installLazyGit}"

util_start_time_measure

# Verify that current user is root
util_verify_is_root

if [ "$mode" = "auto" ]; then
if [ "$mode" = "source" ]; then
# local install_version=`dependencies_get_version_debian "neovim" && util_result`
install_neovim_source "$repository" "$version"
elif [ "$mode" = "apt" ]; then
install_neovim_apt
elif [ "$mode" = "source" ]; then
install_neovim_source "$repository" "$version"
else
install_neovim_binary "$repository" "$version"
fi

echo 'Running `nvim -v`:'
Expand Down

0 comments on commit 6432260

Please sign in to comment.