Skip to content

Commit

Permalink
update: wait running apt processes
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed Nov 8, 2017
1 parent 01a33d4 commit 8dbd282
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 17 deletions.
8 changes: 7 additions & 1 deletion build-devel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@
# this is a replica of ncp-update, but from devel branch
install()
{
test -f /etc/apt/apt.conf.d/20nextcloudpi-upgrades && { echo "deactivate unattended upgrades first"; return 1; }
# wait for other apt processes
test -f /var/lib/apt/lists/lock && echo "waiting for apt processes to finish..." && \
while :; do
test -f /var/lib/apt/lists/lock && break
sleep 1
done

echo -e "Downloading updates"
rm -rf /tmp/ncp-update-tmp
git clone --depth 20 -q -b devel https://github.com/nextcloud/nextcloudpi.git /tmp/ncp-update-tmp
Expand Down
16 changes: 0 additions & 16 deletions buildlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,22 +143,6 @@ function copy_to_image()
rmdir tmpmnt &>/dev/null
}

function deactivate_unattended_upgrades()
{
local IMG=$1
local SECTOR
local OFFSET
SECTOR=$( fdisk -l "$IMG" | grep Linux | awk '{ print $2 }' )
OFFSET=$(( SECTOR * 512 ))

[ -f "$IMG" ] || { echo "no image"; return 1; }
mkdir -p tmpmnt
sudo mount "$IMG" -o offset="$OFFSET" tmpmnt || return 1
sudo rm -f tmpmnt/etc/apt/apt.conf.d/20nextcloudpi-upgrades
sudo umount -l tmpmnt
rmdir tmpmnt &>/dev/null
}

function download_resize_raspbian_img()
{
local SIZE=$1
Expand Down
4 changes: 4 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ EXCL_DOCKER+="
nc-update.sh
nc-autoupdate-ncp.sh
"

# wait for other apt processes
test -f /var/lib/apt/lists/lock && { echo "apt is currently running. Try again later"; exit 1; }

cp etc/library.sh /usr/local/etc/

source /usr/local/etc/library.sh
Expand Down

0 comments on commit 8dbd282

Please sign in to comment.