mirror of
https://github.com/Kron4ek/Conty
synced 2024-11-16 19:50:06 +01:00
Add an argument to show version of the image
This commit is contained in:
parent
8368ec9d44
commit
f278975237
2 changed files with 23 additions and 5 deletions
|
@ -12,14 +12,14 @@ if [ $EUID = 0 ] && [ -z "$ALLOW_ROOT" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
script_version="1.17.1"
|
script_version="1.18"
|
||||||
|
|
||||||
# Full path to the script
|
# Full path to the script
|
||||||
script_literal="${BASH_SOURCE[0]}"
|
script_literal="${BASH_SOURCE[0]}"
|
||||||
script_name="$(basename "${script_literal}")"
|
script_name="$(basename "${script_literal}")"
|
||||||
script="$(readlink -f "${script_literal}")"
|
script="$(readlink -f "${script_literal}")"
|
||||||
|
|
||||||
# MD5 of the last 1 MB of the script
|
# MD5 of the last 1 MB of the file
|
||||||
script_md5="$(tail -c 1000000 "${script}" | md5sum | head -c 7)"
|
script_md5="$(tail -c 1000000 "${script}" | md5sum | head -c 7)"
|
||||||
|
|
||||||
script_id="${RANDOM}"
|
script_id="${RANDOM}"
|
||||||
|
@ -43,16 +43,18 @@ mount_point="${working_dir}"/mnt
|
||||||
# a problem with mounting the image due to an incorrectly calculated offset.
|
# a problem with mounting the image due to an incorrectly calculated offset.
|
||||||
|
|
||||||
# The size of this script
|
# The size of this script
|
||||||
scriptsize=29501
|
scriptsize=29829
|
||||||
|
|
||||||
# The size of the utils.tar.gz archive
|
# The size of the utils archive
|
||||||
# utils.tar.gz contains bwrap, squashfuse and dwarfs binaries
|
|
||||||
utilssize=2928770
|
utilssize=2928770
|
||||||
|
|
||||||
# Offset where the image is stored
|
# Offset where the image is stored
|
||||||
offset=$((scriptsize+utilssize))
|
offset=$((scriptsize+utilssize))
|
||||||
|
|
||||||
# Set to 1 if you are using an image compressed with dwarfs instead of squashfs
|
# Set to 1 if you are using an image compressed with dwarfs instead of squashfs
|
||||||
|
#
|
||||||
|
# Also, don't forget to change the utilssize variable to the size of
|
||||||
|
# utils_dwarfs.tar.gz
|
||||||
dwarfs_image=0
|
dwarfs_image=0
|
||||||
|
|
||||||
dwarfs_cache_size="128M"
|
dwarfs_cache_size="128M"
|
||||||
|
@ -69,6 +71,7 @@ if [ "$1" = "--help" ] || [ "$1" = "-h" ] || ([ -z "$1" ] && [ ! -L "${script_li
|
||||||
echo "Arguments:"
|
echo "Arguments:"
|
||||||
echo
|
echo
|
||||||
echo -e "-v \tShow version of this script"
|
echo -e "-v \tShow version of this script"
|
||||||
|
echo -e "-V \tShow version of the image"
|
||||||
echo -e "-e \tExtract the image"
|
echo -e "-e \tExtract the image"
|
||||||
echo -e "-o \tShow the image offset"
|
echo -e "-o \tShow the image offset"
|
||||||
echo -e "-l \tShow a list of all installed packages"
|
echo -e "-l \tShow a list of all installed packages"
|
||||||
|
@ -474,6 +477,7 @@ if [ "$1" = "-u" ] || [ "$1" = "-U" ]; then
|
||||||
cat <<EOF > container-update.sh
|
cat <<EOF > container-update.sh
|
||||||
reflector --protocol https --score 5 --sort rate --save /etc/pacman.d/mirrorlist
|
reflector --protocol https --score 5 --sort rate --save /etc/pacman.d/mirrorlist
|
||||||
fakeroot -- pacman -Syy 2>/dev/null
|
fakeroot -- pacman -Syy 2>/dev/null
|
||||||
|
date -u +"%d-%m-%Y %H:%M (DMY UTC)" > /version
|
||||||
fakeroot -- pacman --noconfirm -S archlinux-keyring 2>/dev/null
|
fakeroot -- pacman --noconfirm -S archlinux-keyring 2>/dev/null
|
||||||
fakeroot -- pacman --noconfirm -S chaotic-keyring 2>/dev/null
|
fakeroot -- pacman --noconfirm -S chaotic-keyring 2>/dev/null
|
||||||
rm -rf /etc/pacman.d/gnupg
|
rm -rf /etc/pacman.d/gnupg
|
||||||
|
@ -485,6 +489,8 @@ fakeroot -- pacman --noconfirm --overwrite "*" -Su 2>/dev/null
|
||||||
fakeroot -- pacman --noconfirm -Runs ${pkgsremove} 2>/dev/null
|
fakeroot -- pacman --noconfirm -Runs ${pkgsremove} 2>/dev/null
|
||||||
fakeroot -- pacman --noconfirm -S ${pkgsinstall} 2>/dev/null
|
fakeroot -- pacman --noconfirm -S ${pkgsinstall} 2>/dev/null
|
||||||
rm -f /var/cache/pacman/pkg/*
|
rm -f /var/cache/pacman/pkg/*
|
||||||
|
pacman -Qn > /pkglist.x86_64.txt
|
||||||
|
pacman -Qm >> /pkglist.x86_64.txt
|
||||||
update-ca-trust
|
update-ca-trust
|
||||||
locale-gen
|
locale-gen
|
||||||
EOF
|
EOF
|
||||||
|
@ -819,6 +825,16 @@ if [ "$(ls "${mount_point}" 2>/dev/null)" ] || \
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$1" = "-V" ]; then
|
||||||
|
if [ -f "${mount_point}"/version ]; then
|
||||||
|
cat "${mount_point}"/version
|
||||||
|
else
|
||||||
|
echo "Unknown version"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
echo 1 > "${working_dir}"/running_"${script_id}"
|
echo 1 > "${working_dir}"/running_"${script_id}"
|
||||||
|
|
||||||
if [ "${dwarfs_image}" = 1 ] && [ "${QUIET_MODE}" != 1 ]; then
|
if [ "${dwarfs_image}" = 1 ] && [ "${QUIET_MODE}" != 1 ]; then
|
||||||
|
|
|
@ -179,6 +179,8 @@ sed -i 's/#ParallelDownloads = 5/ParallelDownloads = 3/g' "${bootstrap}"/etc/pac
|
||||||
|
|
||||||
run_in_chroot pacman -Syu --noconfirm
|
run_in_chroot pacman -Syu --noconfirm
|
||||||
|
|
||||||
|
date -u +"%d-%m-%Y %H:%M (DMY UTC)" > "${bootstrap}"/version
|
||||||
|
|
||||||
# These packages are required for the self-update feature to work properly
|
# These packages are required for the self-update feature to work properly
|
||||||
run_in_chroot pacman --noconfirm --needed -S base reflector squashfs-tools fakeroot
|
run_in_chroot pacman --noconfirm --needed -S base reflector squashfs-tools fakeroot
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue