xref: /aosp_15_r20/external/obstack/post_update.sh (revision 6912a2bee9c91e2e65d305b4d8eb5813eb26cd9f)
1*6912a2beSHONG Yifan#!/bin/bash -x
2*6912a2beSHONG Yifan
3*6912a2beSHONG Yifan# $1 Path to the new version.
4*6912a2beSHONG Yifan# $2 Path to the old version.
5*6912a2beSHONG Yifan
6*6912a2beSHONG Yifan# We only want a few files from the archive, so delete any files that weren't
7*6912a2beSHONG Yifan# in the old version.  Start with deleting whole directories first.
8*6912a2beSHONG Yifanfind $1 -maxdepth 1 -type d -printf "%P\n" | while read f; do
9*6912a2beSHONG Yifan  if [ ! -d "$2/$f" ]; then
10*6912a2beSHONG Yifan      rm -rf $1/$f
11*6912a2beSHONG Yifan  fi
12*6912a2beSHONG Yifandone
13*6912a2beSHONG Yifan
14*6912a2beSHONG Yifanfind $1 -printf "%P\n" | while read f; do
15*6912a2beSHONG Yifan  if [ ! -e "$2/$f" ]; then
16*6912a2beSHONG Yifan      rm -rf $1/$f
17*6912a2beSHONG Yifan  fi
18*6912a2beSHONG Yifandone
19*6912a2beSHONG Yifan
20*6912a2beSHONG Yifan# Copy over the android directory
21*6912a2beSHONG Yifancp -r $2/android $1/android
22