updated a lot the build script, added help and some other checks and options

This commit is contained in:
germedeb 2022-07-08 15:10:50 -03:00
parent 6e0a9ea8ac
commit 0f2d7cbd8b

View File

@ -6,12 +6,43 @@ comple_color="\e[1;32m" # Ok color
reset_colors="\e[0m" # this resets the coloring reset_colors="\e[0m" # this resets the coloring
# check dependencies # Check dependencies
command -v inkscape >/dev/null 2>&1 || { echo >&2 "I cannot continue without 'inkscape'"; exit 1; } # It mutes the output but verifies if the command returns an error
command -v parallel >/dev/null 2>&1 || { echo >&2 "I cannot continue without 'parallel'"; exit 1; } # if that's true, then the process can't continue
command -v bash >/dev/null 2>&1 || { echo >&2 "I cannot continue without 'bash'"; exit 1; } command -v inkscape >/dev/null 2>&1 || { echo >&2 "I cannot continue without 'inkscape'"; DEPSCOMPLETE=no; }
command -v parallel >/dev/null 2>&1 || { echo >&2 "I cannot continue without 'parallel'"; DEPSCOMPLETE=no; }
command -v bash >/dev/null 2>&1 || { echo >&2 "I cannot continue without 'bash'"; DEPSCOMPLETE=no; }
# here is the checking. it is sepparated for practicy
if [ DEPSCOMPLETE = no ]
then exit 1
fi
# Check for --help
# This is the help message
case "$@" in *--help*|*-h*)
printf "${info_color}Aleta's build script help${reset_colors}\\n\
--help -h Show this help.
--no-optipng
--avoid-optipng Don't launch optipng process
-r
--from-cero
--again
--restart Copy the SVG again and start the build again
-i
--update
--autoinstall Autoinstall to User directory
This software is licensed under the GPLv3 and the CC-BY-SA 4.0 licenses.
See README and LICENSE for more information"
exit 0;
esac
# begin exportation and stuff
printf "${info_color}This script runs the build tasks and performs an install (or an update) of aleta to your home${reset_colors}\\n\\n" printf "${info_color}This script runs the build tasks and performs an install (or an update) of aleta to your home${reset_colors}\\n\\n"
printf "${info_color}cleaning up the build directory...${reset_colors}\\n" printf "${info_color}cleaning up the build directory...${reset_colors}\\n"
@ -20,6 +51,12 @@ rm _build/aleta -rf
printf "${info_color}rebuilding folder structure...${reset_colors}\\n" printf "${info_color}rebuilding folder structure...${reset_colors}\\n"
./tasks/rebuildfolders.sh ./tasks/rebuildfolders.sh
case "$@" in *-r*|*--restart*|*--again*|*--from-cero*)
RESTART=avoid
esac
if [ RESTART = yes ]
then\
printf "${info_color}copying the files to build in the build dir${reset_colors}\\n" printf "${info_color}copying the files to build in the build dir${reset_colors}\\n"
cp icons/apps/*.svg _build/icons-t/apps/ cp icons/apps/*.svg _build/icons-t/apps/
cp icons/places/*.svg _build/icons-t/places/ cp icons/places/*.svg _build/icons-t/places/
@ -29,6 +66,8 @@ cp icons/status/*.svg _build/icons-t/status/
cp icons/mimetypes/*.svg _build/icons-t/mimetypes/ cp icons/mimetypes/*.svg _build/icons-t/mimetypes/
cp icons/actions/*.svg _build/icons-t/actions/ cp icons/actions/*.svg _build/icons-t/actions/
cp icons/animations/*.svg _build/icons-t/animations/ cp icons/animations/*.svg _build/icons-t/animations/
fi
printf "${info_color}exporting all the icons... this will take a long time.${reset_colors}\\n" printf "${info_color}exporting all the icons... this will take a long time.${reset_colors}\\n"
./tasks/export/export-places.sh ./tasks/export/export-places.sh
@ -40,8 +79,14 @@ printf "${info_color}exporting all the icons... this will take a long time.${res
./tasks/export/export-actions.sh ./tasks/export/export-actions.sh
./tasks/export/export-animations.sh ./tasks/export/export-animations.sh
printf "${info_color}Using optipng to reduce the size of the build...${reset_colors}\\n" case "$@" in *--avoid-optipng*|*--no-optipng*)
./tasks/opticall.sh OPTIPNG=avoid
esac
if [ $OPTIPNG != avoid ];
then printf "${info_color}Using optipng to reduce the size of the build...${reset_colors}\\n"
./tasks/opticall.sh
fi
printf "${info_color}Launching misc commands...${reset_colors}\\n" printf "${info_color}Launching misc commands...${reset_colors}\\n"
./tasks/misc.sh ./tasks/misc.sh
@ -49,12 +94,14 @@ printf "${info_color}Launching misc commands...${reset_colors}\\n"
printf "${info_color}starting link process...${reset_colors}\\n" printf "${info_color}starting link process...${reset_colors}\\n"
./tasks/linkcall.sh ./tasks/linkcall.sh
printf "${info_color}Performing an Update/Installation of aleta${reset_colors}\\n" case "$@" in *--autoinstall*|*--update*|*-i*)
rm -rf ~/.icons/aleta printf "${info_color}Performing an Update/Installation of aleta${reset_colors}\\n"
mkdir ~/.icons/aleta -p rm -rf ~/.icons/aleta
cp -r ./_build/aleta/* ~/.icons/aleta/ mkdir ~/.icons/aleta -p
cp -r ./_build/aleta/* ~/.icons/aleta/
esac
printf "${info_color}Updating gtk icon cache...${reset_colors}\\n" printf "${info_color}Updating gtk icon cache...${reset_colors}\\n"
gtk-update-icon-cache ~/.icons/aleta/ gtk-update-icon-cache ~/.icons/aleta/
printf "${comple_color}\\nCOMPLETED\! The icon pack is installed/updated.${reset_colors}\\n" printf "${comple_color}\\nCOMPLETED! The icon pack is builded.${reset_colors}\\n"