mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-10-25 05:54:16 +00:00
* Replace "snap download" with tool that uses snap store's coherence feature
This is important for parallel image builds to ensure all pre-seeded snaps
have the same versions across image variants.
* Inject a proxy into the build providing a snapshot view of the package repo.
When the REPO_SNAPSHOT_STAMP variable is set, the auto/build script will attempt
to launch a transparent HTTP proxy on port 8080, and insert an iptables rule to
redirect all outgoing HTTP requests to this proxy.
The proxy, contained in the `magic-proxy` Python script, examines each request
and silently overrides those pointing to InRelease files or files that are
listed in InRelease files. It will instead provide the contents of the requested
file as it was at REPO_SNAPSHOT_STAMP, by downloading the corresponding asset
"by hash".
* Use series files with dependency handling to generate hook symlinks dynamically
This patch currently only applies to the "ubuntu-cpc" project.
More and more logic has been going into the hook scripts to decide
under which conditions they should run or not. As we are moving
to parallelized builds of image sets, this will get even more
complicated. Base hooks will have to know which image sets they
belong to and modification of the dependency chain between scripts
will become more complicated and prone to errors, as the number of
image sets grows.
This patch introduces explicit ordering and dependency handling for
scripts through the use of `series` files and an explicit syntax
for dependency specification.
58 lines
1.9 KiB
Bash
Executable File
58 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Clean up extraneous log files that may be left around
|
|
rm /etc/ssh/ssh_host*key* || echo "No SSH keys to remove"
|
|
|
|
# Fix LP: #1047707, 1019338
|
|
# Truncate logs that are owned, otherwise remove
|
|
whitelisted_logs=(/var/log/btmp /var/log/lastlog /var/log/wtmp /var/log/fsck/checkfs /var/log/fsck/checkroot)
|
|
|
|
for log in $(find /var/log -type f)
|
|
do
|
|
whitelisted=$(echo "${whitelisted_logs[@]}" | grep -o ${log})
|
|
|
|
if [ -n "${whitelisted}" ]; then
|
|
: > ${log} &&
|
|
echo "Truncated whitelisted log ${log}" ||
|
|
echo "Failed to truncate whitelisted log ${log}"
|
|
else
|
|
|
|
dpkg -S ${log} > /dev/null 2>&1 &&
|
|
{ : > ${log} ||
|
|
echo "Failed to truncate $f"; } ||
|
|
{ rm ${log} &&
|
|
echo "Removed ${log} as an orphaned log file" ||
|
|
echo "Failed to remove unnecessary log $f"; }
|
|
fi
|
|
done
|
|
|
|
# Remove un-owned log directories
|
|
whitelisted_dirs=(/var/log/fsck)
|
|
|
|
for log_d in $(find /var/log/* -type d)
|
|
do
|
|
whitelisted=$(echo "${whitelisted_dirs[@]}" | grep -o "${log_d}")
|
|
if [ -z "${whitelisted}" ]; then
|
|
dpkg -S ${log_d} > /dev/null 2>&1 &&
|
|
echo "Preserving log directory ${log_d}" ||
|
|
{ rm -rf ${log_d} &&
|
|
echo "Removed log directory ${log_d} as orphaned log dir" ||
|
|
echo "Failed to remove unnessasary log dir ${log_d}"; }
|
|
|
|
else
|
|
echo "Preserving whitelisted directory ${log_d}"
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
rm -rf /var/run/* || echo "Failed to clean /var/run/*"
|
|
rm /etc/passwd- || echo "No spare passwd file to cleanup"
|
|
rm /etc/shadow- || echo "No spare shadow file to cleanup"
|
|
rm /etc/gshadow- || echo "No spare gshadow file to cleanup"
|
|
rm /etc/group- || echo "No spare group file to clenaup"
|
|
rm -f /etc/apt/conf.d/00secure || echo "No apt cache to cleanup"
|
|
|
|
# Truncate instead of delete, LP: #707311
|
|
truncate --size=0 -c /etc/popularity-contest.conf
|