2022-01-05 02:25:46 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-08-31 01:01:56 +02:00
|
|
|
# SPDX-FileCopyrightText: 2022 debgerme <fossgerme@tuta.io>
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2022-06-14 02:14:26 +02:00
|
|
|
# define the colors
|
2022-01-05 02:25:46 +01:00
|
|
|
info_color="\e[1;34m" # tasks color
|
|
|
|
comple_color="\e[1;32m" # Ok color
|
|
|
|
reset_colors="\e[0m" # this resets the coloring
|
|
|
|
|
2022-06-14 02:14:26 +02:00
|
|
|
|
2022-07-08 20:10:50 +02:00
|
|
|
# Check dependencies
|
2022-07-08 21:30:05 +02:00
|
|
|
# If you are having trobule with a dependency that IS in your system but
|
|
|
|
# the script can't continue, please add this to your command: --ignore-dependency-check
|
2022-08-17 00:33:25 +02:00
|
|
|
case "$@" in *-k*|*--ignore-deps*)
|
2022-07-08 21:30:05 +02:00
|
|
|
IGNOREDEPS=ok
|
|
|
|
esac
|
|
|
|
# this checks for that option and if it is ok, skip this process
|
|
|
|
if [ "$IGNOREDEPS" != ok ]
|
|
|
|
then
|
2022-07-08 20:10:50 +02:00
|
|
|
# It mutes the output but verifies if the command returns an error
|
|
|
|
# if that's true, then the process can't continue
|
2022-07-28 05:29:36 +02:00
|
|
|
command -v inkscape >/dev/null 2>&1 || { echo >&2 "Missing dependency: inkscape"; DEPSCOMPLETE=n; }
|
|
|
|
command -v parallel >/dev/null 2>&1 || { echo >&2 "Missing dependency: parallel"; DEPSCOMPLETE=n; }
|
|
|
|
command -v bash >/dev/null 2>&1 || { echo >&2 "Missing dependency: bash"; DEPSCOMPLETE=n; }
|
2022-07-08 20:10:50 +02:00
|
|
|
fi
|
2022-06-14 02:14:26 +02:00
|
|
|
|
2022-07-08 20:10:50 +02:00
|
|
|
# Check for --help
|
|
|
|
# This is the help message
|
2022-08-17 03:29:19 +02:00
|
|
|
case "$@" in *-h*|*help*)
|
2022-07-08 20:10:50 +02:00
|
|
|
printf "${info_color}Aleta's build script help${reset_colors}\\n\
|
2022-08-16 21:15:33 +02:00
|
|
|
Usage: ./tasks/build.sh [args]...
|
2022-07-08 20:10:50 +02:00
|
|
|
|
2022-08-16 20:37:23 +02:00
|
|
|
${info_color}Examples:${reset_colors}
|
2022-08-17 01:15:32 +02:00
|
|
|
./tasks/build.sh -r -e Start the build from cero
|
|
|
|
./tasks/build.sh -r -e -i Same but now it autoinstalls
|
|
|
|
./tasks/build.sh -o -e -r Same as the first one but now launch optipng
|
|
|
|
./tasks/build.sh -e Continue building. useful if you cancelled the build
|
2022-08-16 20:37:23 +02:00
|
|
|
|
2022-08-16 21:15:33 +02:00
|
|
|
${info_color}Arguments:${reset_colors}
|
2022-08-17 00:33:25 +02:00
|
|
|
-h --help help Show this help.
|
|
|
|
-e --export Export the remaining icons
|
|
|
|
-o --use-optipng Launch optipng process
|
|
|
|
-v --verbose Show more info. useful for debugging (NIY)
|
|
|
|
-r --from-cero Copy the SVG again and start the build again
|
|
|
|
-i --autoinstall Autoinstall to User directory
|
|
|
|
-k --ignore-deps Don't check for dependencies.
|
2022-08-16 21:15:33 +02:00
|
|
|
|
2022-08-16 21:39:49 +02:00
|
|
|
NIY means Not Implemented Yet
|
|
|
|
|
2022-07-08 20:10:50 +02:00
|
|
|
This software is licensed under the GPLv3 and the CC-BY-SA 4.0 licenses.
|
2022-07-11 01:28:05 +02:00
|
|
|
See README and LICENSE for more information\\n"
|
2022-07-08 20:10:50 +02:00
|
|
|
exit 0;
|
|
|
|
esac
|
|
|
|
|
2022-08-16 21:52:39 +02:00
|
|
|
# check if you written verbose and set that variable
|
2022-08-17 00:33:25 +02:00
|
|
|
case "$@" in *-v*|*--verbose*)
|
2022-08-16 21:52:39 +02:00
|
|
|
VERBOSE=yes
|
|
|
|
esac
|
|
|
|
|
2022-08-16 21:15:33 +02:00
|
|
|
# here is the checking. it is sepparated for practicy
|
|
|
|
if [ "$DEPSCOMPLETE" = n ]
|
|
|
|
then
|
|
|
|
echo Please install the missing dependencies to start building
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-07-08 20:10:50 +02:00
|
|
|
# begin exportation and stuff
|
2022-06-14 02:14:26 +02:00
|
|
|
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"
|
2022-01-05 02:25:46 +01:00
|
|
|
|
2022-08-16 21:39:49 +02:00
|
|
|
# check if there is a valid option, if it is, continue. if not, mark the variable NOTOPTIONS and stop the process
|
2022-08-17 00:33:25 +02:00
|
|
|
case "$@" in *-e*|*--export*|*-h*|*--help*|*help*|*-r*|*--from-cero*|*-o*|*--use-optipng*|*-i*|*--autoinstall*)
|
2022-08-16 21:39:49 +02:00
|
|
|
NOTOPTIONS=thereis
|
|
|
|
esac
|
|
|
|
|
|
|
|
if [ "$NOTOPTIONS" != thereis ] ; then
|
2022-08-16 21:45:17 +02:00
|
|
|
printf "please add arguments.
|
|
|
|
type ${comple_color}./tasks/build.sh${reset_colors} --help to see all the arguments available
|
|
|
|
ERROR: there is no options, exit.\\n"
|
2022-08-16 21:39:49 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-08-17 03:29:19 +02:00
|
|
|
case "$@" in *-r*|*--from-cero*)
|
2022-07-08 20:34:07 +02:00
|
|
|
RESTART=yes
|
|
|
|
esac
|
|
|
|
|
2022-07-08 21:05:29 +02:00
|
|
|
if [ "$RESTART" = yes ]
|
2022-07-08 20:34:07 +02:00
|
|
|
|
|
|
|
# this deletes the build directory
|
|
|
|
then printf "${info_color}cleaning up the build directory...${reset_colors}\\n"
|
2022-01-10 00:20:33 +01:00
|
|
|
rm _build/aleta -rf
|
2022-01-05 02:25:46 +01:00
|
|
|
|
2022-07-08 20:34:07 +02:00
|
|
|
# this creates the folder structure used in the build and while the building
|
2022-04-30 01:52:57 +02:00
|
|
|
printf "${info_color}rebuilding folder structure...${reset_colors}\\n"
|
2022-01-05 02:25:46 +01:00
|
|
|
./tasks/rebuildfolders.sh
|
|
|
|
|
2022-07-08 20:34:07 +02:00
|
|
|
# this copies the "SVG in" to the build folders
|
2022-04-30 01:52:57 +02:00
|
|
|
printf "${info_color}copying the files to build in the build dir${reset_colors}\\n"
|
2022-01-10 00:20:33 +01:00
|
|
|
cp icons/apps/*.svg _build/icons-t/apps/
|
|
|
|
cp icons/places/*.svg _build/icons-t/places/
|
|
|
|
cp icons/categories/*.svg _build/icons-t/categories/
|
|
|
|
cp icons/devices/*.svg _build/icons-t/devices/
|
|
|
|
cp icons/status/*.svg _build/icons-t/status/
|
|
|
|
cp icons/mimetypes/*.svg _build/icons-t/mimetypes/
|
|
|
|
cp icons/actions/*.svg _build/icons-t/actions/
|
|
|
|
cp icons/animations/*.svg _build/icons-t/animations/
|
2022-09-07 03:25:13 +02:00
|
|
|
cp icons/emblems/*.svg _build/icons-t/emblems/
|
2022-07-08 20:34:07 +02:00
|
|
|
|
2022-09-10 23:38:17 +02:00
|
|
|
cp icons/apps-symbolic/*.svg _build/icons-t/apps-symbolic/
|
|
|
|
cp icons/places-symbolic/*.svg _build/icons-t/places-symbolic/
|
|
|
|
cp icons/categories-symbolic/*.svg _build/icons-t/categories-symbolic/
|
|
|
|
cp icons/devices-symbolic/*.svg _build/icons-t/devices-symbolic/
|
|
|
|
cp icons/status-symbolic/*.svg _build/icons-t/status-symbolic/
|
|
|
|
cp icons/mimetypes-symbolic/*.svg _build/icons-t/mimetypes-symbolic/
|
|
|
|
cp icons/actions-symbolic/*.svg _build/icons-t/actions-symbolic/
|
|
|
|
cp icons/animations-symbolic/*.svg _build/icons-t/animations-symbolic/
|
|
|
|
cp icons/emblems-symbolic/*.svg _build/icons-t/emblems-symbolic/
|
|
|
|
|
2022-07-08 20:10:50 +02:00
|
|
|
fi
|
|
|
|
|
2022-08-16 21:39:49 +02:00
|
|
|
# Check if you written the export option
|
2022-08-17 00:33:25 +02:00
|
|
|
case "$@" in *-e*|*--export*)
|
2022-08-16 21:39:49 +02:00
|
|
|
# I dont want to conflict with the export command XD
|
|
|
|
EXPOR=yes
|
|
|
|
esac
|
2022-01-10 00:20:33 +01:00
|
|
|
|
2022-08-16 21:39:49 +02:00
|
|
|
if [ "$EXPOR" = yes ]; then
|
|
|
|
printf "${info_color}exporting all the icons... this will take a long time.${reset_colors}\\n"
|
2022-09-10 21:43:56 +02:00
|
|
|
./tasks/runexport.sh
|
2022-08-16 21:39:49 +02:00
|
|
|
fi
|
2022-01-05 02:25:46 +01:00
|
|
|
|
2022-08-17 00:33:25 +02:00
|
|
|
case "$@" in *--use-optipng*|*-o*)
|
2022-08-16 21:52:39 +02:00
|
|
|
OPTIPNG=use
|
2022-07-08 20:10:50 +02:00
|
|
|
esac
|
|
|
|
|
2022-08-17 00:33:25 +02:00
|
|
|
if [ "$OPTIPNG" = use ]; then
|
|
|
|
if [ "$IGNOREDEPS" != ok ]; then
|
|
|
|
command -v optipng >/dev/null 2>&1 || { echo >&2 "Missing dependency: optipng"; DEPSCOMPLETE=n; }
|
|
|
|
if [ "$DEPSCOMPLETE" = n ]; then
|
|
|
|
echo To optimize the build, please install optipng
|
|
|
|
exit 1
|
|
|
|
fi
|
2022-08-16 21:15:33 +02:00
|
|
|
fi
|
|
|
|
printf "${info_color}Using optipng to reduce the size of the build...${reset_colors}\\n"
|
|
|
|
./tasks/opticall.sh
|
2022-07-08 20:10:50 +02:00
|
|
|
fi
|
2022-06-14 02:14:26 +02:00
|
|
|
|
2022-04-30 01:52:57 +02:00
|
|
|
printf "${info_color}Launching misc commands...${reset_colors}\\n"
|
2022-01-05 02:25:46 +01:00
|
|
|
./tasks/misc.sh
|
|
|
|
|
2022-06-14 02:14:26 +02:00
|
|
|
printf "${info_color}starting link process...${reset_colors}\\n"
|
2022-08-16 21:52:39 +02:00
|
|
|
if [ "$VERBOSE" = yes ] ; then
|
2022-09-10 20:32:33 +02:00
|
|
|
./tasks/runlink.sh
|
2022-08-16 21:52:39 +02:00
|
|
|
else
|
2022-09-10 20:32:33 +02:00
|
|
|
./tasks/runlink.sh >/dev/null 2>&1
|
2022-08-16 21:52:39 +02:00
|
|
|
fi
|
2022-08-17 00:33:25 +02:00
|
|
|
case "$@" in *--autoinstall*|*-i*)
|
2022-07-08 20:10:50 +02:00
|
|
|
printf "${info_color}Performing an Update/Installation of aleta${reset_colors}\\n"
|
2022-09-03 02:20:05 +02:00
|
|
|
|
|
|
|
cp -r ./_build/aleta ~/.icons/tmpaleta
|
2022-08-29 22:41:22 +02:00
|
|
|
rm -rf ~/.icons/aleta
|
|
|
|
mv ~/.icons/tmpaleta ~/.icons/aleta
|
2022-07-08 20:34:07 +02:00
|
|
|
printf "${info_color}Updating gtk icon cache...${reset_colors}\\n"
|
|
|
|
gtk-update-icon-cache ~/.icons/aleta/
|
|
|
|
|
2022-07-08 20:10:50 +02:00
|
|
|
esac
|
2022-01-05 02:25:46 +01:00
|
|
|
|
2022-07-08 20:10:50 +02:00
|
|
|
printf "${comple_color}\\nCOMPLETED! The icon pack is builded.${reset_colors}\\n"
|