-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfix_db_cache.sh
More file actions
executable file
·35 lines (29 loc) · 919 Bytes
/
Copy pathfix_db_cache.sh
File metadata and controls
executable file
·35 lines (29 loc) · 919 Bytes
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
#!/bin/bash
# Fix gzip decompression issue in ADB SQLite cache
# Load environment variables from .env file
if [ -f .env ]; then
export $(grep -v '^#' .env | xargs)
fi
# Default values if not set in .env
PACKAGE_NAME=${PACKAGE_NAME:-com.winitsoftware.emiratessnacks}
DB_NAME=${DB_NAME:-master_data.db}
# Get cache directory dynamically
CACHE_DIR="${TMPDIR:-/tmp}/adb_sqlite_cache"
DB_FILE="$CACHE_DIR/${PACKAGE_NAME}_${DB_NAME}"
# Check if file exists
if [ ! -f "$DB_FILE" ]; then
echo "Database file not found: $DB_FILE"
exit 1
fi
# Check if file is gzipped
FILE_TYPE=$(file "$DB_FILE" | grep -o "gzip compressed data")
if [ -n "$FILE_TYPE" ]; then
echo "Database is gzipped, decompressing..."
mv "$DB_FILE" "$DB_FILE.gz"
gunzip "$DB_FILE.gz"
echo "✅ Database decompressed successfully"
file "$DB_FILE"
else
echo "✅ Database is already decompressed"
file "$DB_FILE"
fi