forked from draekko/AIK-Linux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcleanup.sh
executable file
·40 lines (31 loc) · 909 Bytes
/
cleanup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
# AIK-Linux/cleanup: reset working directory
# osm0sis @ xda-developers
case $1 in
--help) echo "usage: cleanup.sh [--local] [--quiet]"; exit 1;
esac;
case $(uname -s) in
Darwin|Macintosh)
statarg="-f %Su";
readlink() { perl -MCwd -e 'print Cwd::abs_path shift' "$2"; }
;;
*) statarg="-c %U";;
esac;
aik="${BASH_SOURCE:-$0}";
aik="$(dirname "$(readlink -f "$aik")")";
bin="$aik/bin";
case $1 in
--local) shift;;
*) cd "$aik";;
esac;
chmod -R 755 "$bin" "$aik"/*.sh;
chmod 644 "$bin/magic" "$bin/androidbootimg.magic" "$bin/boot_signer.jar" "$bin/avb/"* "$bin/chromeos/"*;
if [ -d ramdisk ] && [ "$(stat $statarg ramdisk | head -n 1)" = "root" -o ! "$(find ramdisk 2>&1 | cpio -o >/dev/null 2>&1; echo $?)" -eq "0" ]; then
sudo=sudo;
fi;
$sudo rm -rf ramdisk split_img *new.* || exit 1;
case $1 in
--quiet) ;;
*) echo "Working directory cleaned.";;
esac;
exit 0;