Updated bootstrap to allow for easy git installs
This commit is contained in:
parent
19a5dfbc41
commit
1c6fec2a1f
3 changed files with 66 additions and 33 deletions
|
|
@ -1,37 +1,7 @@
|
||||||
#!/bin/env sh
|
#!/bin/env sh
|
||||||
|
|
||||||
HYPRDROP_GIT_PATH="$HOME/.cache/hyprdrop"
|
addGitInstall "hyprdrop" "https://github.com/kjlo/hyprdrop" setup_hyprdrop
|
||||||
|
|
||||||
install_hyprdrop() {
|
setup_hyprdrop() {
|
||||||
PREV_DIRECTORY=$PWD
|
|
||||||
|
|
||||||
if [ ! -d "$HYPRDROP_GIT_PATH" ]; then
|
|
||||||
git clone https://github.com/kjlo/hyprdrop "$HYPRDROP_GIT_PATH"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd ~/.cache/hyprdrop
|
|
||||||
cargo install --path .
|
cargo install --path .
|
||||||
|
|
||||||
cd $PREV_DIRECTORY
|
|
||||||
}
|
}
|
||||||
|
|
||||||
check_hyprdrop() {
|
|
||||||
if [ ! -d "$HOME/.cache/hyprdrop" ]; then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
PREV_DIRECTORY=$PWD
|
|
||||||
|
|
||||||
cd $HYPRDROP_GIT_PATH
|
|
||||||
|
|
||||||
if ! git remote update && git status | grep behind >>/dev/null; then
|
|
||||||
cd $PREV_DIRECTORY
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
if check_hyprdrop; then
|
|
||||||
addActions install_hyprdrop
|
|
||||||
fi
|
|
||||||
|
|
|
||||||
|
|
@ -6,4 +6,8 @@ reloadDarkman() {
|
||||||
darkman toggle
|
darkman toggle
|
||||||
}
|
}
|
||||||
|
|
||||||
addActions reloadDarkman
|
reloadHyprland() {
|
||||||
|
hyprctl reload
|
||||||
|
}
|
||||||
|
|
||||||
|
addActions reloadDarkman reloadHyprland
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ echo "# Gathering applications"
|
||||||
declare -x -a applications
|
declare -x -a applications
|
||||||
declare -x -a actions
|
declare -x -a actions
|
||||||
actions=()
|
actions=()
|
||||||
|
declare -x -a gitInstalls
|
||||||
|
|
||||||
addApplications ()
|
addApplications ()
|
||||||
{
|
{
|
||||||
|
|
@ -43,15 +44,73 @@ addActions()
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addGitInstall() {
|
||||||
|
local name=$1
|
||||||
|
local path=$2
|
||||||
|
local setupCommand=$3
|
||||||
|
|
||||||
|
gitInstalls+=("$name;$path;$setupCommand")
|
||||||
|
}
|
||||||
|
|
||||||
while IFS= read -r file; do
|
while IFS= read -r file; do
|
||||||
if [[ -x "$file" && ! "$file" =~ "##" && ! "$file" =~ ~$ && ! "$file" =~ ".bak" ]]; then
|
if [[ -x "$file" && ! "$file" =~ "##" && ! "$file" =~ ~$ && ! "$file" =~ ".bak" ]]; then
|
||||||
source $file
|
source $file
|
||||||
fi
|
fi
|
||||||
done < <(find -L "$APPLICATIONS_PATH" -type f | sort)
|
done < <(find -L "$APPLICATIONS_PATH" -type f | sort)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo -n "# Installing/Updating applications (${#applications[@]})"
|
echo -n "# Installing/Updating applications (${#applications[@]})"
|
||||||
installPackages ${applications[*]}
|
installPackages ${applications[*]}
|
||||||
|
|
||||||
|
checkGitInstallExistance() {
|
||||||
|
local path=$1
|
||||||
|
|
||||||
|
if [ ! -d $path ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
PREV_DIRECTORY=$PWD
|
||||||
|
|
||||||
|
cd $path
|
||||||
|
|
||||||
|
if ! git remote update && git status | grep behind >>/dev/null; then
|
||||||
|
cd $PREV_DIRECTORY
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
runGitInstall() {
|
||||||
|
local targetPath=$1
|
||||||
|
local repository=$2
|
||||||
|
local setupCommand=$3
|
||||||
|
|
||||||
|
PREV_DIRECTORY=$PWD
|
||||||
|
|
||||||
|
if [ ! -d "$targetPath" ]; then
|
||||||
|
git clone "$repository" "$targetPath"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd $targetPath
|
||||||
|
|
||||||
|
$setupCommand
|
||||||
|
|
||||||
|
cd $PREV_DIRECTORY
|
||||||
|
}
|
||||||
|
|
||||||
|
for gitInstall in "${gitInstalls[@]}"
|
||||||
|
do
|
||||||
|
arrIN=(${gitInstall//;/ })
|
||||||
|
targetPath="$HOME/.cache/${arrIN[0]}"
|
||||||
|
|
||||||
|
if checkGitInstallExistance "$targetPath"; then
|
||||||
|
echo "Installing... ${arrIN[0]}"
|
||||||
|
runGitInstall "$targetPath" "${arrIN[1]}" "${arrIN[2]}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
echo "# Executing actions... (${#actions[@]})"
|
echo "# Executing actions... (${#actions[@]})"
|
||||||
for action in "${actions[@]}";
|
for action in "${actions[@]}";
|
||||||
do
|
do
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue