move common functions to bin/common

parent 0858350d
...@@ -19,25 +19,8 @@ if [ -z "$PROFILESDIR" ]; then ...@@ -19,25 +19,8 @@ if [ -z "$PROFILESDIR" ]; then
PROFILESDIR="/home/$USER/Projects/ximper-builder/mkimage-profiles" PROFILESDIR="/home/$USER/Projects/ximper-builder/mkimage-profiles"
fi fi
print_error() { # базовые функции
printf "\033[1;31m%s\033[0m\n" "$1" . $(dirname $0)/common
}
print_green() {
printf "\033[1;32m%s\033[0m\n" "$1"
}
print_yellow() {
printf "\033[1;33m%s\033[0m\n" "$1"
}
print_blue() {
printf "\033[1;34m%s\033[0m\n" "$1"
}
print_red() {
printf "\033[1;31m%s\033[0m\n" "$1"
}
print_paths() { print_paths() {
echo "____________________" echo "____________________"
...@@ -155,7 +138,7 @@ eval set -- "$OPTS" ...@@ -155,7 +138,7 @@ eval set -- "$OPTS"
while true; do while true; do
case "$1" in case "$1" in
-h|--help) -h|--help)
printf "Использование: ./distrobuild.sh [опции] [версия дистрибутива]\n\n" printf "Использование: $0 [опции] [версия дистрибутива]\n\n"
printf "Опции:\n" printf "Опции:\n"
printf " --nvidia Собирает дистрибутив с драйверами nvidia\n" printf " --nvidia Собирает дистрибутив с драйверами nvidia\n"
printf " --debug Включает режим отладки\n" printf " --debug Включает режим отладки\n"
......
#!/bin/bash #!/bin/bash
echo "Cleaning...." # базовые функции
. $(dirname $0)/common
print_blue "Cleaning...."
[ -d "$PROFILESDIR/build" ] && \ [ -d "$PROFILESDIR/build" ] && \
pushd $PROFILESDIR \ pushd $PROFILESDIR \
&& make clean \ && make clean \
&& rm -rf $TMP/mkimage-profiles.build.* \ && rm -rf $TMP/mkimage-profiles.build.* \
&& rm -rf ./build && popd \ && rm -rf ./build && popd \
&& echo "cleaning mkimage-profiles is DONE" && print_green "cleaning mkimage-profiles is DONE"
[ -d $TMP/hasher-sisyphus-64 ] && rm -rf $TMP/hasher-sisyphus-64/ \ [ -d $TMP/hasher-sisyphus-64 ] && rm -rf $TMP/hasher-sisyphus-64/ \
&& echo "cleaning hasher-sisyphus is DONE" && print_green "cleaning hasher-sisyphus is DONE"
rmiso() { rmiso() {
rm -rf /tmp/.private/"$USER"/out/* rm -rf /tmp/.private/"$USER"/out/*
...@@ -19,18 +22,18 @@ rmiso() { ...@@ -19,18 +22,18 @@ rmiso() {
while [ -n "$1" ]; do while [ -n "$1" ]; do
case "$1" in case "$1" in
-h|--help) -h|--help)
printf "Использование: ./bin/cleartmp [опции]\n\n" printf "Использование: $0 [опции]\n\n"
printf "Опции:\n" printf "Опции:\n"
printf " --iso -i Удаляет iso файлы в /tmp/.private/USER/out\n" printf " --iso -i Удаляет iso файлы в /tmp/.private/USER/out\n"
exit 0 exit 0
;; ;;
--iso|-i) --iso|-i)
rmiso rmiso
echo "iso файлы удалены" print_green "iso файлы удалены"
shift shift
;; ;;
esac esac
shift shift
done done
echo "DONE" print_green "DONE"
#!/bin/bash
print_error() {
printf "\033[1;31m%s\033[0m\n" "$1"
}
print_green() {
printf "\033[1;32m%s\033[0m\n" "$1"
}
print_yellow() {
printf "\033[1;33m%s\033[0m\n" "$1"
}
print_blue() {
printf "\033[1;34m%s\033[0m\n" "$1"
}
print_red() {
printf "\033[1;31m%s\033[0m\n" "$1"
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment