-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservice.sh
69 lines (62 loc) · 1.81 KB
/
service.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/system/bin/sh
MODDIR=${0%/*}
FONT_PENDING_DIR=/sdcard/Android/data/com.yubyf.quotelockx/files/fonts/pending
FONT_PENDING_IMPORT_DIR=$FONT_PENDING_DIR/import
FONT_PENDING_REMOVE_DIR=$FONT_PENDING_DIR/remove
FONT_DEST_DIR=$MODDIR/system/fonts/custom
LOG_ENABLED=0
echo_date()
{
if [ $LOG_ENABLED -eq 1 ] ; then
echo "$(date +%y/%m/%dT%H:%M:%S): $*"
fi
}
until [ "$(getprop sys.boot_completed)" -eq 1 ] ; do
sleep 1
done
# Attempt 5 times to wait for sdcard to be mounted
for i in 1 2 3 4 5
do
if [ -d "/sdcard/" ] ; then
break
else
sleep 2
fi
done
(
if [ -f "$FONT_PENDING_DIR/log_enable" ] ; then
LOG_ENABLED=1
fi
echo_date "----------------------------------------"
echo_date "Boot completed, starting fonts sync..."
if [ ! -d "$FONT_PENDING_IMPORT_DIR/" ] ; then
echo_date "No fonts to import"
elif [ ! "$(ls -A $FONT_PENDING_IMPORT_DIR/)" ] ; then
echo_date "No fonts to import"
else
echo_date "Importing fonts..."
mkdir -p "$FONT_DEST_DIR"
for file in "$FONT_PENDING_IMPORT_DIR"/*
do
echo_date "Move $file to $FONT_DEST_DIR/"
cp "$file" "$FONT_DEST_DIR/"
rm "$file"
done
fi
if [ ! -d "$FONT_PENDING_REMOVE_DIR/" ] ; then
echo_date "No fonts to remove"
elif [ ! "$(ls -A $FONT_PENDING_REMOVE_DIR/)" ] ; then
echo_date "No fonts to remove"
else
echo_date "Removing fonts..."
for file in "$FONT_PENDING_REMOVE_DIR"/*
do
file_name=$(basename "$file")
echo_date "Delete $FONT_DEST_DIR/$file_name"
rm "$FONT_DEST_DIR/$file_name"
rm "$file"
done
fi
chmod -R +r "$FONT_DEST_DIR"/
echo_date "Font sync script finished"
) >> $FONT_PENDING_DIR/log 2>&1