deb commit for modified packages should be working now
This commit is contained in:
parent
c19c9a579a
commit
64093db75a
12
functions.sh
12
functions.sh
@ -55,12 +55,22 @@ if [ ! "$build_already_defined_colors" = "true" ]; then
|
|||||||
colors
|
colors
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$VERBOSE" -ge 2 -o "$DEBUG" == "1" ]; then
|
||||||
|
chroot() {
|
||||||
|
local retval
|
||||||
|
true ${blue}
|
||||||
|
/usr/sbin/chroot "$@"
|
||||||
|
retval=$?
|
||||||
|
true ${reset}
|
||||||
|
return $retval
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# Display messages in color
|
# Display messages in color
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
info() {
|
info() {
|
||||||
echo "${bold}${cyan}INFO: ${1}${reset}"
|
echo "${bold}${blue}INFO: ${1}${reset}"
|
||||||
}
|
}
|
||||||
|
|
||||||
debug() {
|
debug() {
|
||||||
|
@ -78,6 +78,7 @@ EOF
|
|||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
debug "Upgrading system"
|
debug "Upgrading system"
|
||||||
chroot "$INSTALLDIR" apt-get update
|
chroot "$INSTALLDIR" apt-get update
|
||||||
|
true "${stout}"
|
||||||
DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
|
DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
|
||||||
chroot "$INSTALLDIR" apt-get -y --force-yes dist-upgrade
|
chroot "$INSTALLDIR" apt-get -y --force-yes dist-upgrade
|
||||||
|
|
||||||
@ -143,12 +144,11 @@ EOF
|
|||||||
chroot "$INSTALLDIR" apt-mark hold sysvinit
|
chroot "$INSTALLDIR" apt-mark hold sysvinit
|
||||||
|
|
||||||
# Pin sysvinit to prevent being re-installed
|
# Pin sysvinit to prevent being re-installed
|
||||||
read -r -d '' SYSVINIT_APT_PIN <<'EOF'
|
cat > "$INSTALLDIR/etc/apt/preferences.d/qubes_sysvinit" <<EOF
|
||||||
Package: sysvinit
|
Package: sysvinit
|
||||||
Pin: version *
|
Pin: version *
|
||||||
Pin-Priority: -100
|
Pin-Priority: -100
|
||||||
EOF
|
EOF
|
||||||
echo "$SYSVINIT_APT_PIN" > "$INSTALLDIR/etc/apt/preferences.d/qubes_sysvinit"
|
|
||||||
chmod 0644 "$INSTALLDIR/etc/apt/preferences.d/qubes_sysvinit"
|
chmod 0644 "$INSTALLDIR/etc/apt/preferences.d/qubes_sysvinit"
|
||||||
|
|
||||||
chroot "$INSTALLDIR" apt-get update
|
chroot "$INSTALLDIR" apt-get update
|
||||||
|
@ -181,43 +181,74 @@ if ! [ -f "$INSTALLDIR/tmp/.prepared_whonix" ]; then
|
|||||||
# Patch Whonix submodules
|
# Patch Whonix submodules
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Chekout a branch; create a branch first if it does not exist
|
||||||
|
checkout_branch() {
|
||||||
|
branch=$(git symbolic-ref --short -q HEAD)
|
||||||
|
if ! [ "$branch" == "$1" ]; then
|
||||||
|
su user -c git checkout "$1" >/dev/null 2>&1 || \
|
||||||
|
{
|
||||||
|
su user -c git branch "$1"
|
||||||
|
su user -c git checkout "$1"
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# sed search and replace. return 0 if replace happened, otherwise 1
|
||||||
|
search_replace() {
|
||||||
|
local search="$1"
|
||||||
|
local replace="$2"
|
||||||
|
local file="$3"
|
||||||
|
sed -i.bak '/'"$search"'/,${s//'"$replace"'/;b};$q1' "$file"
|
||||||
|
}
|
||||||
|
|
||||||
# Patch anon-meta-packages to not depend on grub-pc
|
# Patch anon-meta-packages to not depend on grub-pc
|
||||||
pushd "$WHONIX_DIR"
|
pushd "$WHONIX_DIR"
|
||||||
{
|
{
|
||||||
#su user -c "git branch qubes 9.2" || :;
|
search_replace "grub-pc" "" "grml_packages" || :
|
||||||
#su user -c "git checkout qubes" || :;
|
|
||||||
sed -i 's/grub-pc//g' grml_packages || :;
|
|
||||||
#su user -c "git commit -am 'removed grub-pc depend'" || :;
|
|
||||||
}
|
}
|
||||||
popd
|
popd
|
||||||
|
|
||||||
pushd "$WHONIX_DIR/packages/anon-meta-packages/debian"
|
pushd "$WHONIX_DIR/packages/anon-meta-packages/debian"
|
||||||
{
|
{
|
||||||
#su user -c "git branch qubes" || :;
|
search1=" grub-pc,"
|
||||||
#su user -c "git checkout qubes" || :;
|
replace=""
|
||||||
sed -i 's/ grub-pc,//g' control || :;
|
|
||||||
cd ..;
|
#checkout_branch qubes
|
||||||
su user -c "dpkg-source -q --commit . no_grub" || :;
|
search_replace "$search1" "$replace" control && \
|
||||||
|
{
|
||||||
|
cd "$WHONIX_DIR/packages/anon-meta-packages"
|
||||||
|
:
|
||||||
|
#sudo -E -u user make deb-pkg || :
|
||||||
|
#su user -c "dpkg-source --commit" || :
|
||||||
#git add .
|
#git add .
|
||||||
#su user -c "git commit -am 'removed grub-pc depend'" || :;
|
#su user -c "git commit -am 'removed grub-pc depend'"
|
||||||
|
} || :
|
||||||
}
|
}
|
||||||
popd
|
popd
|
||||||
|
|
||||||
pushd "$WHONIX_DIR/packages/anon-shared-build-fix-grub/usr/lib/anon-dist/chroot-scripts-post.d"
|
pushd "$WHONIX_DIR/packages/anon-shared-build-fix-grub/usr/lib/anon-dist/chroot-scripts-post.d"
|
||||||
{
|
{
|
||||||
#su user -c "git branch qubes" || :;
|
search1="update-grub"
|
||||||
#su user -c "git checkout qubes" || :;
|
replace=":"
|
||||||
sed -i 's/update-grub/:/g' 85_update_grub || :;
|
|
||||||
cd ../../../..;
|
#checkout_branch qubes
|
||||||
su user -c "dpkg-source -q --commit . no_grub" || :;
|
search_replace "$search1" "$replace" 85_update_grub && \
|
||||||
|
{
|
||||||
|
cd "$WHONIX_DIR/packages/anon-shared-build-fix-grub"
|
||||||
|
sudo -E -u user make deb-pkg || :
|
||||||
|
su user -c "EDITOR=/bin/true dpkg-source -q --commit . no_grub"
|
||||||
#git add .
|
#git add .
|
||||||
#su user -c "git commit -am 'removed grub-pc depend'" || :;
|
#su user -c "git commit -am 'removed grub-pc depend'"
|
||||||
|
} || :
|
||||||
}
|
}
|
||||||
popd
|
popd
|
||||||
|
|
||||||
pushd "$WHONIX_DIR/build-steps.d"
|
pushd "$WHONIX_DIR/build-steps.d"
|
||||||
{
|
{
|
||||||
sed -i 's/ check_for_uncommited_changes/ #check_for_uncommited_changes/g' 1200_create-debian-packages;
|
search1=" check_for_uncommited_changes"
|
||||||
|
replace=" #check_for_uncommited_changes"
|
||||||
|
|
||||||
|
search_replace "$search1" "$replace" 1200_create-debian-packages || :
|
||||||
}
|
}
|
||||||
popd
|
popd
|
||||||
|
|
||||||
@ -228,14 +259,15 @@ if ! [ -f "$INSTALLDIR/tmp/.prepared_whonix" ]; then
|
|||||||
#cannot stat `/boot/grub/grub.cfg': No such file or directory
|
#cannot stat `/boot/grub/grub.cfg': No such file or directory
|
||||||
|
|
||||||
# Qubes needs a user named 'user'
|
# Qubes needs a user named 'user'
|
||||||
if chroot "$INSTALLDIR" id -u 'user' >/dev/null 2>&1; then
|
debug "Whonix Add user"
|
||||||
:
|
chroot "$INSTALLDIR" id -u 'user' >/dev/null 2>&1 || \
|
||||||
else
|
{
|
||||||
chroot "$INSTALLDIR" groupadd -f user
|
chroot "$INSTALLDIR" groupadd -f user
|
||||||
chroot "$INSTALLDIR" useradd -g user -G dialout,cdrom,floppy,sudo,audio,dip,video,plugdev -m -s /bin/bash user
|
chroot "$INSTALLDIR" useradd -g user -G dialout,cdrom,floppy,sudo,audio,dip,video,plugdev -m -s /bin/bash user
|
||||||
fi
|
}
|
||||||
|
|
||||||
# Change hostname to 'host'
|
# Change hostname to 'host'
|
||||||
|
debug "Whonix change host"
|
||||||
echo "host" > "$INSTALLDIR/etc/hostname"
|
echo "host" > "$INSTALLDIR/etc/hostname"
|
||||||
chroot "$INSTALLDIR" sed -i "s/localhost/host/g" /etc/hosts
|
chroot "$INSTALLDIR" sed -i "s/localhost/host/g" /etc/hosts
|
||||||
|
|
||||||
@ -255,8 +287,7 @@ if ! [ -f "$INSTALLDIR/tmp/.prepared_whonix" ]; then
|
|||||||
debug "Building Whonix..."
|
debug "Building Whonix..."
|
||||||
mount --bind "../Whonix" "$INSTALLDIR/home/user/Whonix"
|
mount --bind "../Whonix" "$INSTALLDIR/home/user/Whonix"
|
||||||
|
|
||||||
# This breaks whonix depends since it must just rely on recommended
|
# XXX: Does this break Whonix build?
|
||||||
# packages since it seems to install just about everything :)
|
|
||||||
# Install apt-get preferences
|
# Install apt-get preferences
|
||||||
#echo "$WHONIX_APT_PREFERENCES" > "$INSTALLDIR/etc/apt/apt.conf.d/99whonix"
|
#echo "$WHONIX_APT_PREFERENCES" > "$INSTALLDIR/etc/apt/apt.conf.d/99whonix"
|
||||||
#chmod 0644 "$INSTALLDIR/etc/apt/apt.conf.d/99whonix"
|
#chmod 0644 "$INSTALLDIR/etc/apt/apt.conf.d/99whonix"
|
||||||
@ -285,6 +316,9 @@ if ! [ -f "$INSTALLDIR/tmp/.prepared_whonix" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
chroot "$INSTALLDIR" su user -c "cd ~; ./whonix_build $BUILD_TYPE $DIST" || { exit 1; }
|
chroot "$INSTALLDIR" su user -c "cd ~; ./whonix_build $BUILD_TYPE $DIST" || { exit 1; }
|
||||||
|
else
|
||||||
|
error "chroot /home/user/Whonix directory does not exist... exiting!"
|
||||||
|
exit
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ umount_kill() {
|
|||||||
# since we are doing an exact string match on the path
|
# since we are doing an exact string match on the path
|
||||||
MOUNTDIR=$(echo "$MOUNTDIR" | sed s#//*#/#g)
|
MOUNTDIR=$(echo "$MOUNTDIR" | sed s#//*#/#g)
|
||||||
|
|
||||||
debug "-> Attempting to kill any processes still running in '$MOUNTDIR' before un-mounting"
|
warn "-> Attempting to kill any processes still running in '$MOUNTDIR' before un-mounting"
|
||||||
for dir in $(sudo grep "$MOUNTDIR" /proc/mounts | cut -f2 -d" " | sort -r | grep "^$MOUNTDIR")
|
for dir in $(sudo grep "$MOUNTDIR" /proc/mounts | cut -f2 -d" " | sort -r | grep "^$MOUNTDIR")
|
||||||
do
|
do
|
||||||
sudo lsof "$dir" 2> /dev/null | \
|
sudo lsof "$dir" 2> /dev/null | \
|
||||||
@ -49,13 +49,13 @@ umount_kill() {
|
|||||||
xargs --no-run-if-empty sudo kill -9
|
xargs --no-run-if-empty sudo kill -9
|
||||||
|
|
||||||
if ! [ "$2" ] && $(mountpoint -q "$dir"); then
|
if ! [ "$2" ] && $(mountpoint -q "$dir"); then
|
||||||
debug "un-mounting $dir"
|
info "un-mounting $dir"
|
||||||
sudo umount -n "$dir" 2> /dev/null || \
|
sudo umount -n "$dir" 2> /dev/null || \
|
||||||
sudo umount -n -l "$dir" 2> /dev/null || \
|
sudo umount -n -l "$dir" 2> /dev/null || \
|
||||||
error "umount $dir unsuccessful!"
|
error "umount $dir unsuccessful!"
|
||||||
elif ! [ "$2" ]; then
|
elif ! [ "$2" ]; then
|
||||||
# Look for (deleted) mountpoints
|
# Look for (deleted) mountpoints
|
||||||
debug "not a regular mount point: $dir"
|
info "not a regular mount point: $dir"
|
||||||
base=$(basename "$dir")
|
base=$(basename "$dir")
|
||||||
dir=$(dirname "$dir")
|
dir=$(dirname "$dir")
|
||||||
base=$(echo "$base" | sed 's/[\].*$//')
|
base=$(echo "$base" | sed 's/[\].*$//')
|
||||||
|
Loading…
Reference in New Issue
Block a user