testing
This commit is contained in:
parent
919384e261
commit
c37cdde63f
4 changed files with 78 additions and 53 deletions
|
@ -5,6 +5,30 @@ command_exists() {
|
|||
command -v "$@" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# ─< package variable >───────────────────────────────────────────────────────────────────
|
||||
unset PACKAGE
|
||||
|
||||
# ─< argument list variables >────────────────────────────────────────────────────────────
|
||||
silent=false
|
||||
|
||||
sleep 0.1
|
||||
|
||||
PACKAGE=hyprgraphics
|
||||
if command_exists "$PACKAGE"; then
|
||||
echo "$PACKAGE is already installed!"
|
||||
echo "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
|
||||
|
||||
# WHY:
|
||||
# This import will give you the following variables:
|
||||
# _sudo="sudo -E" <- only if non root user
|
||||
|
@ -32,19 +56,6 @@ getImports() {
|
|||
source "$import"
|
||||
sleep 0.2
|
||||
rm "$import"
|
||||
|
||||
unset PACKAGE
|
||||
|
||||
PACKAGE=hyprgraphics &&
|
||||
echo_note "Installing $PACKAGE.."
|
||||
|
||||
sleep 1
|
||||
|
||||
if command_exists $PACKAGE; then
|
||||
echo_warning "$PACKAGE is alread installed!"
|
||||
echo_warning "Exiting now!"
|
||||
exit 69
|
||||
fi
|
||||
}
|
||||
|
||||
checkComp() {
|
||||
|
@ -101,7 +112,7 @@ getDependencies() {
|
|||
}
|
||||
|
||||
build() {
|
||||
echo_info "Building $PACKAGE"
|
||||
echo_pkg build
|
||||
run cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build
|
||||
run cmake --build ./build --config Release --target all -j$(nproc 2>/dev/null || getconf NPROCESSORS_CONF)
|
||||
}
|
||||
|
@ -110,11 +121,12 @@ cloneAndInstall() {
|
|||
local cloneDir="$(mktemp -d)"
|
||||
cd $cloneDir || mkdir -p "$cloneDir" && cd "$cloneDir"
|
||||
|
||||
echo_pkg clone
|
||||
git clone --depth=1 https://github.com/hyprwm/hyprgraphics.git &&
|
||||
cd hyprgraphics
|
||||
|
||||
if build; then
|
||||
echo_info "Installing package.."
|
||||
echo_pkg install "Installing package.."
|
||||
$_sudo cmake --install build
|
||||
else
|
||||
echo_error "Build has failed for $distro compiling $PACKAGE"
|
||||
|
@ -123,6 +135,14 @@ cloneAndInstall() {
|
|||
}
|
||||
|
||||
main() {
|
||||
if $silent; then
|
||||
echo_warning "Executing script silently!"
|
||||
fi
|
||||
|
||||
if ! getDependencies; then
|
||||
echo_error "Error when installing dependencies.."
|
||||
fi
|
||||
|
||||
case "$distro" in
|
||||
arch)
|
||||
_install hyprgraphics
|
||||
|
@ -134,15 +154,5 @@ main() {
|
|||
}
|
||||
|
||||
if getImports; then
|
||||
case "$@" in
|
||||
--silent | -s)
|
||||
silent=true
|
||||
echo_warning "Running script silently!"
|
||||
;;
|
||||
*)
|
||||
silent=false
|
||||
;;
|
||||
esac
|
||||
getDependencies
|
||||
main
|
||||
fi
|
||||
|
|
|
@ -5,6 +5,30 @@ command_exists() {
|
|||
command -v "$@" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# ─< package variable >───────────────────────────────────────────────────────────────────
|
||||
unset PACKAGE
|
||||
|
||||
# ─< argument list variables >────────────────────────────────────────────────────────────
|
||||
silent=false
|
||||
|
||||
sleep 0.1
|
||||
|
||||
PACKAGE=hyprutils
|
||||
if command_exists "$PACKAGE"; then
|
||||
echo "$PACKAGE is already installed!"
|
||||
echo "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
|
||||
|
||||
# WHY:
|
||||
# This import will give you the following variables:
|
||||
# _sudo="sudo -E" <- only if non root user
|
||||
|
@ -32,23 +56,10 @@ getImports() {
|
|||
source "$import"
|
||||
sleep 0.2
|
||||
rm "$import"
|
||||
|
||||
unset PACKAGE
|
||||
|
||||
PACKAGE=hyprutils &&
|
||||
echo_note "Installing $PACKAGE.."
|
||||
|
||||
sleep 1
|
||||
|
||||
if command_exists $PACKAGE; then
|
||||
echo_warning "$PACKAGE is alread installed!"
|
||||
echo_warning "Exiting now!"
|
||||
exit 69
|
||||
fi
|
||||
}
|
||||
|
||||
getDependencies() {
|
||||
echo_info "Checking build dependencies.."
|
||||
echo_pkg deps "Checking build dependencies.."
|
||||
|
||||
# INFO:
|
||||
# ╭─────────────────────────────────────────────────────────────────────────╮
|
||||
|
@ -84,7 +95,7 @@ getDependencies() {
|
|||
}
|
||||
|
||||
build() {
|
||||
echo_info "Building $package"
|
||||
echo_pkg build
|
||||
run cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build
|
||||
run cmake --build ./build --config Release --target all -j$(nproc 2>/dev/null || getconf NPROCESSORS_CONF)
|
||||
}
|
||||
|
@ -95,12 +106,12 @@ cloneAndInstall() {
|
|||
|
||||
cd $cloneDir || mkdir -p $cloneDir && cd $cloneDir
|
||||
|
||||
echo_info "Cloning sources for $PACKAGE into $cloneDir/$PACKAGE"
|
||||
echo_pkg clone
|
||||
git clone --depth=1 https://github.com/hyprwm/hyprutils.git &&
|
||||
cd hyprutils
|
||||
|
||||
if build; then
|
||||
echo_info "Installing package.."
|
||||
echo_pkg install "Installing package.."
|
||||
$_sudo cmake --install build
|
||||
else
|
||||
echo_error "Build has failed for $distro compiling $package"
|
||||
|
@ -109,6 +120,14 @@ cloneAndInstall() {
|
|||
}
|
||||
|
||||
main() {
|
||||
if $silent; then
|
||||
echo_warning "Executing script silently!"
|
||||
fi
|
||||
|
||||
if ! getDependencies; then
|
||||
echo_error "Error when installing dependencies.."
|
||||
fi
|
||||
|
||||
case "$distro" in
|
||||
arch)
|
||||
_install hyprutils
|
||||
|
@ -127,13 +146,5 @@ checkComp() {
|
|||
}
|
||||
|
||||
if getImports; then
|
||||
silent=false
|
||||
case "$@" in
|
||||
--silent | -s)
|
||||
silent=true
|
||||
echo_warning "Running script silently!"
|
||||
;;
|
||||
esac
|
||||
getDependencies
|
||||
main
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue