Сравнить коммиты

...

2 Коммитов

Автор SHA1 Сообщение Дата
864756c815 Remove --skip-unavailable for dnf5 2024-11-29 22:20:31 -05:00
116636c9a3 Archive existing image builds 2024-11-29 22:17:09 -05:00

Просмотреть файл

@@ -101,7 +101,7 @@ init() {
# Set distro-specific functions
case "$ID" in
fedora|centos) pkg_install(){ sudo "$RPM_MGR" install --skip-unavailable -y "$@"; } ;;
fedora|centos) pkg_install(){ sudo "$RPM_MGR" install -y "$@"; } ;;
debian|ubuntu) pkg_install(){ sudo apt-get install --ignore-missing -y -q0 "$@"; } ;;
suse) pkg_install(){ sudo zypper --non-interactive -q install --force --no-confirm "$@"; } ;;
arch) pkg_install(){ sudo pacman -S --noconfirm --needed "$@"; } ;;
@@ -616,6 +616,22 @@ extract() {
return 1
fi
}
backup_image() {
debug "${FUNCNAME[0]} $*"
local file="$1"
local dir="$2"
local count=1
[[ -f $file ]] || return
local creation_date
creation_date=$(stat -c %w "$file" 2>/dev/null || stat -c %y "$file" | cut -d' ' -f1)
execute mkdir -p "$dir"
local base_name
base_name=$(basename "$file")
while [[ -e "$dir/$creation_date-$base_name.bk.$count" ]]; do
((count++))
done
execute mv "$file" "$dir/$creation_date-$base_name.bk.$count"
}
verify() {
debug "${FUNCNAME[0]}" "$*"
local file_to_check="$1"
@@ -651,6 +667,7 @@ main() {
# Fallback to SCRIPTDIR if BUILDROOT has not been set
declare -g BUILDROOT="${BUILDROOT:=$SCRIPTDIR}"
declare -g FILESDIR="${FILESDIR:=$BUILDROOT/src/files}"
declare -g BACKUPDIR="$SCRIPTDIR/backups"
# This could be dangerous
if [[ $BUILDROOT == "/" ]]; then
@@ -729,6 +746,8 @@ main() {
declare -g SYSUPGRADEIMGGZ="$BUILDDIR/$img_fname-sysupgrade.img.gz"
fi
backup_image "$SYSUPGRADEIMGGZ" "$BACKUPDIR/$profile/$RELEASE"
if ((RESET)); then
if ((FROM_SOURCE)); then
[[ -d $GITWORKTREEDIR ]] && ask_ok "Remove $GITWORKTREEDIR?"