add apt config generation to tmp

parent b954c382
......@@ -7,32 +7,44 @@ VM=false
CLEAN=false
DESKTOP_ENVS=() # Список выбранных рабочих окружений (например, gnome, hyprland)
# базовые функции
. $(dirname $0)/common
if [ -z "$VMDIR" ]; then
VMDIR="/var/ftp/pvt/ISO/testing/template/iso"
fi
if [ -z "$APTCONF" ]; then
APTCONF="/etc/eterbuild/apt/apt.conf.sisyphus"
fi
if [ -z "$PROFILESDIR" ]; then
PROFILESDIR="/home/$USER/Projects/ximper-builder/mkimage-profiles"
fi
# базовые функции
. $(dirname $0)/common
create_tmp() {
echo $(mktemp -d -t ximper-builder.XXXXXXX)
}
print_paths() {
remove_tmp() {
rm -rf "$1"
}
print_build_info() {
echo "____________________"
print_blue "VMDIR: $VMDIR"
print_blue "PROFILESDIR: $PROFILESDIR"
print_blue "APTCONF: $APTCONF"
print_blue "APTCONF: $APTCONF"
echo "____________________"
if [ "$VER" == "devel" ]; then
print_yellow "VERSION: $VER"
else
print_green "VERSION: $VER"
fi
print_green "REPOSITORIES: $REPOS"
}
cleartmp() {
[ "$CLEAN" == true ] || return
echo "____________________"
/home/"$USER"/Projects/ximper-builder/bin/cleartmp -i
$HOME/Projects/ximper-builder/bin/cleartmp -i
# shellcheck disable=SC2012
# Удаляем все, кроме самого нового
[ "$VER" == "devel" ] && ls -t "$VMDIR"/ximper-"$desktop_env""$iso_suffix"-devel-*-x86_64.iso | tail -n +2 | xargs -I {} rm -v -- {}
......@@ -74,6 +86,7 @@ ifexit() {
print_yellow "Скрипт принудительно завершен. Выполняю некоторые действия..."
revert_temp_commit
CLEAN=true cleartmp
remove_tmp $buildertmp
CLEAN=false
exit 1
}
......@@ -120,12 +133,9 @@ makebuild() {
# Отмена временного коммита после завершения сборки
revert_temp_commit
echo "____________________"
}
pushd "$PROFILESDIR" || exit
OPTS=$(getopt -o h --long help,nvidia,debug,clean,all,vm,gnome,hyprland -- "$@")
OPTS=$(getopt -o h --long help,nvidia,debug,clean,all,vm,gnome,hyprland,repos: -- "$@")
if [ $? != 0 ]; then
print_error "Ошибка обработки опций."
exit 1
......@@ -179,17 +189,33 @@ while true; do
DESKTOP_ENVS+=("hyprland")
shift
;;
--repos)
REPOS="$2"
shift
;;
--)
shift
break
;;
*)
if [ -n "$REPOS" ] && [ "$1" = "$REPOS" ]; then
shift
continue
fi
print_error "Неверная опция: $1"
exit 1
;;
esac
done
if [ -z "REPOS" ]; then
REPOS="sisyphus,ximper"
fi
buildertmp=$(create_tmp)
APTCONF=$($(dirname $0)/gen-apt-conf -d $buildertmp -r $REPOS)
APTTMP=$(dirname $APTCONF)
# Установить GNOME по умолчанию, если ничего не выбрано
if [ ${#DESKTOP_ENVS[@]} -eq 0 ]; then
DESKTOP_ENVS+=("gnome")
......@@ -198,19 +224,13 @@ fi
# Обработка версии дистрибутива
if [ -n "$1" ]; then
VER=$1
echo "____________________"
if [ "$VER" == "devel" ]; then
print_yellow "VERSION: $VER"
else
print_green "VERSION: $VER"
fi
shift
else
print_error "Не указана версия дистрибутива."
exit 1
fi
print_paths
print_build_info
# Генерация списка задач на сборку
build_list=()
......@@ -228,6 +248,8 @@ for desktop_env in "${DESKTOP_ENVS[@]}"; do
fi
done
pushd "$PROFILESDIR" > /dev/null || exit
# Выполнение сборки для каждого элемента в списке
for build_item in "${build_list[@]}"; do
IFS=':' read -r desktop_env build_type <<< "$build_item"
......@@ -235,5 +257,8 @@ for build_item in "${build_list[@]}"; do
done
cleartmp
popd || exit
popd > /dev/null || exit
remove_tmp $buildertmp
print_green "ЗАВЕРШЕНО"
......@@ -3,24 +3,26 @@
# базовые функции
. $(dirname $0)/common
print_blue "Cleaning...."
print_blue "Очистка...."
[ -d "$PROFILESDIR/build" ] && \
pushd $PROFILESDIR \
&& make clean \
&& rm -rf $TMP/mkimage-profiles.build.* \
&& rm -rf ./build && popd \
&& print_green "cleaning mkimage-profiles is DONE"
[ -d $TMP/hasher-sisyphus-64 ] && rm -rf $TMP/hasher-sisyphus-64/ \
&& print_green "cleaning hasher-sisyphus is DONE"
if [ -d $PROFILESDIR/build ]; then
pushd PROFILESDIR
make clean
rm -rf $TMP/mkimage-profiles.build.*
rm -rf ./build
popd
print_green "mkimage-profiles очищен"
fi
rmiso() {
rm -rf /tmp/.private/"$USER"/out/*
if [ -d $TMP/out/ ]; then
rm -rf $TMP/out/*
print_green "iso файлы удалены"
fi
}
while [ -n "$1" ]; do
case "$1" in
for param in "$@"; do
case "$param" in
-h|--help)
printf "Использование: $0 [опции]\n\n"
printf "Опции:\n"
......@@ -29,11 +31,10 @@ while [ -n "$1" ]; do
;;
--iso|-i)
rmiso
print_green "iso файлы удалены"
shift
;;
esac
shift
done
print_green "DONE"
print_green "Очистка завершена"
#!/bin/bash
# базовые функции
. $(dirname $0)/common
OPTS=$(getopt -o h,d:,r: --long help,dir:,repos: -- "$@")
if [ $? != 0 ]; then
print_error "Ошибка обработки опций."
exit 1
fi
# Применение параметров
eval set -- "$OPTS"
while true; do
case "$1" in
-h|--help)
printf "Использование: $0 [опции]\n\n"
printf "Опции:\n"
printf " -h, --help Вывод этой справки\n"
printf " -d, --dir Путь к tmp\n"
printf " -r, --repos Список репозиториев\n"
shift
;;
-d|--dir)
buildertmp="$2"
shift
;;
-r|--repos)
REPOS="${2//,/ }"
shift
;;
--)
shift
break
;;
*)
shift
;;
esac
done
APTCONF="$buildertmp/apt.conf.ximper"
SOURCES="$buildertmp/sources.list.ximper"
gen_sources() {
for repo in $REPOS; do
case "$repo" in
*sisyphus*)
cat <<EOF >> "$SOURCES"
rpm [alt] file:/var/ftp/ pub/ALTLinux/Sisyphus/x86_64 classic
rpm [alt] file:/var/ftp/ pub/ALTLinux/Sisyphus/noarch classic
rpm [alt] file:/var/ftp/ pub/ALTLinux/Sisyphus/x86_64-i586 classic
EOF
;;
*etersoft*)
cat <<EOF >> "$SOURCES"
rpm file:/var/ftp/pub/Etersoft/WINE@Etersoft/9-testing/WINE x86_64/ALTLinux/Sisyphus main
rpm file:/var/ftp/pub/Etersoft/WINE@Etersoft/9-testing/WINE/x86_64 ALTLinux/Sisyphus/extra main
#rpm file:/var/ftp/pvt/Etersoft/WINE@Etersoft/9-testing/WINE-Network x86_64/ALTLinux/Sisyphus main
EOF
;;
*ximper*)
cat <<EOF >> "$SOURCES"
rpm file:/var/ftp/pub/download/ximper/ XimperLinuxRepository/x86_64 addon
rpm file:/var/ftp/pub/download/ximper/ XimperLinuxRepository/noarch addon
EOF
;;
esac
done
}
gen_config() {
cat <<EOF >> "$APTCONF"
/*
* This is the main configuration file for the APT suite of tools,
* see apt.conf(5) for details.
*/
Dir::Etc::main "/dev/null";
Dir::Etc::parts "/var/empty";
Dir::Etc::SourceParts "/var/empty";
Dir::Etc::SourceList "$SOURCES";
EOF
}
gen_sources
gen_config
echo $APTCONF
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