appimage-builder-docker/build

50 lines
1.8 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
while [[ $# -gt 0 ]]; do
key="${1}"
value="${2}"
case "${key}" in
-u|--user)
if [[ ! "${value}" =~ ^[0-9]+$ ]]; then
echo "Пользователь должен быть указан в числовом представлении"
exit 1
fi
user="${value}"
echo "На готовые файлы будут установлены права ${user}:${user} в output и cache"
shift
;;
-t|--appimage-tool|-r|--appimage-runtime|-i|--input-path|-o|--output-path|-c|--cache-path|-l|--log-path)
echo "Переданы недопустимые флаги"
exit 1
;;
-h|--help)
echo -e "\n" \
"Использование: docker-container [ОПЦИИ]... [СПИСОК ПАКЕТОВ ДЛЯ СБОРКИ]\n" \
"Основные опции:\n" \
"\t-u\t--user\t\t\tУказать UID пользователя для установки прав на полученные файлы в output и cache\n" \
"Дополнительно:\n" \
"\t-h\t--help\t\t\tПоказать справку\n" \
"\t-v\t--version\t\tВерсия скрипта appimage-builder\n"
exit 0
;;
bash|ash|sh)
${key}
exit 0
;;
*)
apps+=("${key}")
;;
esac
shift
done
[ -z "${apps}" ] && echo "Не указан ни один пакет для сборки AppImage" && exit 1
appimage-builder.sh -i /input -o /output -c /cache "${apps}"
if [ -v user ] && [ -n "${user}" ] ; then
chown -R -v ${user}:${user} /output /cache
else
chown -R -v 1000:1000 /output /cache
fi