apply-live-updates.sh 651 B

123456789101112131415161718192021
  1. #!/bin/sh
  2. if [ -b /dev/mapper/live-rw ] && [ -d /run/initramfs/live/updates -o -d /updates ]; then
  3. info "Applying updates to live image..."
  4. mount -o bind /run $NEWROOT/run
  5. # avoid overwriting symlinks (e.g. /lib -> /usr/lib) with directories
  6. for d in /updates /run/initramfs/live/updates; do
  7. [ -d "$d" ] || continue
  8. (
  9. cd $d
  10. find . -depth -type d | while read dir; do
  11. mkdir -p "$NEWROOT/$dir"
  12. done
  13. find . -depth \! -type d | while read file; do
  14. cp -a "$file" "$NEWROOT/$file"
  15. done
  16. )
  17. done
  18. umount $NEWROOT/run
  19. fi