Update deploy script

parent 3267a45d
...@@ -3,19 +3,64 @@ ...@@ -3,19 +3,64 @@
BUILDERDIR=$(realpath "$(dirname "$0")"/..) BUILDERDIR=$(realpath "$(dirname "$0")"/..)
SOURCE_DIR="/var/ftp/pvt/ISO/testing/template/iso" SOURCE_DIR="/var/ftp/pvt/ISO/testing/template/iso"
IS_DEVEL=false IS_DEVEL=false
DEBUG=false
COMMIT=false
# базовые функции # базовые функции
# shellcheck disable=SC1091 # shellcheck disable=SC1091
. "$BUILDERDIR"/bin/common . "$BUILDERDIR"/bin/common
if [[ "$1" == "--devel" ]]; then OPTS=$(getopt -o h --long help,debug,devel,commit -- "$@") || {
IS_DEVEL=true print_error "Ошибка обработки опций."
VERSION="devel" }
shift eval set -- "$OPTS"
elif [ -z "$1" ]; then
print_error "Не указана версия образов. Использование: ./deploy.sh <версия> [--devel]" 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 else
VERSION="$1" VERSION="$1"
if [[ "$VERSION" == *.rc* && "$COMMIT" == "false" || "$VERSION" == "devel" ]]; then
IS_DEVEL=true
fi
shift shift
fi fi
...@@ -40,18 +85,30 @@ for iso_file in "$SOURCE_DIR"/ximper-*"$VERSION"*-*.iso; do ...@@ -40,18 +85,30 @@ for iso_file in "$SOURCE_DIR"/ximper-*"$VERSION"*-*.iso; do
target_file="$TARGET_DIR/$new_filename" target_file="$TARGET_DIR/$new_filename"
echo "$iso_file" if $DEBUG; then
echo "$target_file" print_blue "VERSION: $VERSION"
#cp "$iso_file" "$target_file" || print_error "Не удалось скопировать файл: $iso_file -> $target_file" 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") copied_files+=("$target_file")
done done
if [ ${#copied_files[@]} -eq 0 ]; then if [ ${#copied_files[@]} -eq 0 ]; then
print_error "Не найдено ни одного образа для версии $VERSION" print_error "Не выбрано ни одного образа для версии $VERSION"
fi fi
exit 0
for file in "${copied_files[@]}"; do for file in "${copied_files[@]}"; do
"$BUILDERDIR"/bin/gen_md5 "$file" "$BUILDERDIR"/bin/gen_md5 "$file"
done 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