Skip to content

Commit

Permalink
ADDED: makefile, endpoint in customizer installation
Browse files Browse the repository at this point in the history
  • Loading branch information
AleixMT committed Feb 12, 2024
1 parent f453fac commit bee2a7c
Show file tree
Hide file tree
Showing 6 changed files with 148 additions and 126 deletions.
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
PREFIX = /usr
MANDIR = $(PREFIX)/share/man

all:
@echo Run \'make install\' to install customizer.

install:
@sudo bash src/core/install.sh -v -o customizer

uninstall:
@sudo bash src/core/uninstall.sh -v -o customizer
2 changes: 1 addition & 1 deletion data/features/customizer/customizer.dat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ customizer_manualcontentavailable="0;0;1"
customizer_flagsoverride="0;;;;;" # Install always as root
customizer_bashfunctions=("customizer.sh" "shortcuts.sh")
customizer_packagedependencies=("python3" "python-venv" "wget" "git" "git-lfs" "bash-completion" "file" "python3.8" "python3.8-venv") # python3.8-venv is now needed to create venv in Ubuntu/Debian
customizer_binariesinstalledpaths=("${CUSTOMIZER_PROJECT_FOLDER}/src/core/uninstall.sh;customizer-uninstall" "${CUSTOMIZER_PROJECT_FOLDER}/src/core/install.sh;customizer-install")
customizer_binariesinstalledpaths=("${CUSTOMIZER_PROJECT_FOLDER}/src/core/uninstall.sh;customizer-uninstall" "${CUSTOMIZER_PROJECT_FOLDER}/src/core/install.sh;customizer-install" "${CUSTOMIZER_PROJECT_FOLDER}/src/customizer.sh;customizer")
Empty file modified data/features/kse/kse.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified data/tools/iochem.txt
100644 → 100755
Empty file.
136 changes: 136 additions & 0 deletions src/core/customizer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
#!/usr/bin/env bash
########################################################################################################################
# - Name: Linux Auto-Customizer endpoint wrapper #
# - Description: Processes the arguments to call the customizer backend #
# - Creation Date: 13/2/24 #
# - Last Modified: 13/2/24 #
# - Author & Maintainer: Aleix Mariné-Tena #
# - Email: [email protected] #
# - Permissions: This script has to be executed directly. It can be run either as root or as an unprivileged user. You #
# will need certain privileges for different installations. #
# - Arguments: Arguments to modulate the call to the backend and all the arguments that the backends accept #
# - Usage: #
# * customizer ARGUMENTS #
# * bash customizer.sh ARGUMENTS #
# * sudo customizer ARGUMENTS #
# * sudo bash customizer.sh ARGUMENTS #
# - License: GPL v3.0 #
########################################################################################################################


# - Description: Processes the arguments received from the outside and activates or deactivates flags and calls
# add_program to append a keyname to the list of features to install.
# - Permission: Can be called as root or user.
# - Argument 1, 2, 3... : Arguments for the whole program.
argument_processing()
{
while [ $# -gt 0 ]; do
key="$1"

case "${key}" in
### INTROSPECTION AND INFORMATION ###
features)
local all_arguments+=("${feature_keynames[@]}")
echo "${all_arguments[@]}"
exit 0
;;
commands)
local all_arguments+=("${feature_keynames[@]}")
all_arguments+=("${auxiliary_arguments[@]}")
all_arguments+=("${WRAPPERS_KEYNAMES[@]}")
echo "${all_arguments[@]}"
exit 0
;;
flags)
local all_arguments+=("${auxiliary_arguments[@]}")
echo "${all_arguments[@]}"
exit 0
;;
wrappers)
generate_wrappers
display_wrappers
exit 0
;;
installations)
cat "${INSTALLED_FEATURES}"
exit 0
;;
initializations)
cat "${INITIALIZATIONS_PATH}"
exit 0
;;
functions)
cat "${FUNCTIONS_PATH}"
exit 0
;;
favorites|favourites)
cat "${PROGRAM_FAVORITES_PATH}"
exit 0
;;
keybindings)
cat "${PROGRAM_KEYBINDINGS_PATH}"
exit 0
;;


--flush=favorites)
if [ "${FLAG_MODE}" == "uninstall" ]; then
remove_all_favorites
fi
;;
--flush=keybindings)
if [ "${FLAG_MODE}" == "uninstall" ]; then
remove_all_keybindings
fi
;;
--flush=functions)
if [ "${FLAG_MODE}" == "uninstall" ]; then
remove_all_functions
fi
;;
--flush=initializations)
if [ "${FLAG_MODE}" == "uninstall" ]; then
remove_all_initializations
fi
;;
--flush=structures)
if [ "${FLAG_MODE}" == "uninstall" ]; then
remove_structures
fi
;;
--flush=cache)
if [ "${FLAG_MODE}" == "uninstall" ]; then
rm -Rf "${CACHE_FOLDER}"
fi
;;

*)

;;
esac
shift
done
}



main() {
FLAG_MODE=wrapper # Install mode
argument_processing "$@"
bell_sound
}


DIR=$(dirname "$(realpath "$0")")
export CUSTOMIZER_PROJECT_FOLDER="$(cd "${DIR}/../.." &>/dev/null && pwd)"
if [ -f "${DIR}/functions_common.sh" ]; then
# shellcheck source=./functions_common.sh
source "${DIR}/functions_common.sh"
else
# output without output_proxy_executioner because it does not exist at this point, since we did not source common_data
echo -e "\e[91m$(date +%Y-%m-%d_%T) -- ERROR: functions_common.sh not found. Aborting..."
exit 1
fi

# Call main function
main "$@"
125 changes: 0 additions & 125 deletions src/core/functions_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -622,131 +622,6 @@ argument_processing()
FLAG_IGNORE_DEPENDENCIES=1
;;


### INTROSPECTION AND INFORMATION ###
# Activates introspection mode to take into account order of arguments
inspect)
mode=inspect
;;

features)
if [ "${mode}" != "inspect" ]; then
output_proxy_executioner "\"features\" options can only be used if you specify inspect mode first. Try
with customizer-install inspect features" "ERROR"
fi
local all_arguments+=("${feature_keynames[@]}")
echo "${all_arguments[@]}"
exit 0
;;

commands)
if [ "${mode}" != "inspect" ]; then
output_proxy_executioner "\"commands\" options can only be used if you specify inspect mode first. Try
with customizer-install inspect commands" "ERROR"
fi
local all_arguments+=("${feature_keynames[@]}")
all_arguments+=("${auxiliary_arguments[@]}")
all_arguments+=("${WRAPPERS_KEYNAMES[@]}")
echo "${all_arguments[@]}"
exit 0
;;

flags)
if [ "${mode}" != "inspect" ]; then
output_proxy_executioner "\"flags\" options can only be used if you specify inspect mode first. Try
with customizer-install inspect flags" "ERROR"
fi
local all_arguments+=("${auxiliary_arguments[@]}")
echo "${all_arguments[@]}"
exit 0
;;

wrappers)
if [ "${mode}" != "inspect" ]; then
output_proxy_executioner "\"commands\" options can only be used if you specify inspect mode first. Try
with customizer-install inspect commands" "ERROR"
fi
generate_wrappers
display_wrappers
exit 0
;;

installations)
if [ "${mode}" != "inspect" ]; then
output_proxy_executioner "\"installations\" options can only be used if you specify inspect mode first. Try
with customizer-install inspect installations" "ERROR"
fi
cat "${INSTALLED_FEATURES}"
exit 0
;;

initializations)
if [ "${mode}" != "inspect" ]; then
output_proxy_executioner "\"initializations\" options can only be used if you specify inspect mode first. Try
with customizer-install inspect initializations" "ERROR"
fi
cat "${INITIALIZATIONS_PATH}"
exit 0
;;

functions)
if [ "${mode}" != "inspect" ]; then
output_proxy_executioner "\"functions\" options can only be used if you specify inspect mode first. Try
with customizer-install inspect functions" "ERROR"
fi
cat "${FUNCTIONS_PATH}"
exit 0
;;

favorites|favourites)
if [ "${mode}" != "inspect" ]; then
output_proxy_executioner "\"functions\" options can only be used if you specify inspect mode first. Try
with customizer-install inspect functions" "ERROR"
fi
cat "${PROGRAM_FAVORITES_PATH}"
exit 0
;;

keybindings)
if [ "${mode}" != "inspect" ]; then
output_proxy_executioner "\"keybindings\" options can only be used if you specify inspect mode first. Try
with customizer-install inspect keybindings" "ERROR"
fi
cat "${PROGRAM_KEYBINDINGS_PATH}"
exit 0
;;

--flush=favorites)
if [ "${FLAG_MODE}" == "uninstall" ]; then
remove_all_favorites
fi
;;
--flush=keybindings)
if [ "${FLAG_MODE}" == "uninstall" ]; then
remove_all_keybindings
fi
;;
--flush=functions)
if [ "${FLAG_MODE}" == "uninstall" ]; then
remove_all_functions
fi
;;
--flush=initializations)
if [ "${FLAG_MODE}" == "uninstall" ]; then
remove_all_initializations
fi
;;
--flush=structures)
if [ "${FLAG_MODE}" == "uninstall" ]; then
remove_structures
fi
;;
--flush=cache)
if [ "${FLAG_MODE}" == "uninstall" ]; then
rm -Rf "${CACHE_FOLDER}"
fi
;;

--readme|readme|features|FEATURES|FEATURES.sh|features.sh)
# Print list of possible arguments and finish the program
autogen_readme
Expand Down

0 comments on commit bee2a7c

Please sign in to comment.