Update deploy script

parent 3267a45d
......@@ -3,19 +3,64 @@
BUILDERDIR=$(realpath "$(dirname "$0")"/..)
SOURCE_DIR="/var/ftp/pvt/ISO/testing/template/iso"
IS_DEVEL=false
DEBUG=false
COMMIT=false
# базовые функции
# shellcheck disable=SC1091
. "$BUILDERDIR"/bin/common
if [[ "$1" == "--devel" ]]; then
IS_DEVEL=true
VERSION="devel"
shift
elif [ -z "$1" ]; then
print_error "Не указана версия образов. Использование: ./deploy.sh <версия> [--devel]"
OPTS=$(getopt -o h --long help,debug,devel,commit -- "$@") || {
print_error "Ошибка обработки опций."
}
eval set -- "$OPTS"
while true; do
case "$1" in
-h|--help)
printf "\n"
printf "Использование: %s [версия дистрибутива] [опции]\n\n" "$0"
printf "Опции:\n"
printf " -h | --help Вывод этой справки\n"
printf " --debug Включить режим отладки\n"
printf " --devel Включить режим devel\n"
printf " --commit переместить из Devel в Current\n"
exit 0
;;
--debug)
DEBUG=true
shift
;;
--devel)
IS_DEVEL=true
shift
;;
--commit)
SOURCE_DIR="/var/ftp/pub/Etersoft/XimperLinux/Devel/ISO"
IS_DEVEL=false
COMMIT=true
shift
;;
--)
shift
break
;;
"")
shift
;;
*)
print_error "Неверная опция: $1"
;;
esac
done
if [ -z "$1" ]; then
print_error "Не указана версия образов."
else
VERSION="$1"
if [[ "$VERSION" == *.rc* && "$COMMIT" == "false" || "$VERSION" == "devel" ]]; then
IS_DEVEL=true
fi
shift
fi
......@@ -40,18 +85,30 @@ for iso_file in "$SOURCE_DIR"/ximper-*"$VERSION"*-*.iso; do
target_file="$TARGET_DIR/$new_filename"
echo "$iso_file"
echo "$target_file"
#cp "$iso_file" "$target_file" || print_error "Не удалось скопировать файл: $iso_file -> $target_file"
if $DEBUG; then
print_blue "VERSION: $VERSION"
print_blue "DEVEL: $IS_DEVEL"
print_blue "SOURCE: $iso_file"
print_blue "TARGET: $target_file"
read -p "Продолжить? (y/n): " answer
case "${answer,,}" in
y|yes|д|да|"")
;;
n|no|*)
continue
;;
esac
fi
cp "$iso_file" "$target_file" || print_error "Не удалось скопировать файл: $iso_file -> $target_file"
copied_files+=("$target_file")
done
if [ ${#copied_files[@]} -eq 0 ]; then
print_error "Не найдено ни одного образа для версии $VERSION"
print_error "Не выбрано ни одного образа для версии $VERSION"
fi
exit 0
for file in "${copied_files[@]}"; do
"$BUILDERDIR"/bin/gen_md5 "$file"
done
......
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