-
Notifications
You must be signed in to change notification settings - Fork 7
/
autobuild.sh
97 lines (81 loc) Β· 2.72 KB
/
autobuild.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/usr/bin/bash
# Check for the Distro Type
# Check if pkg package manager is available
which "pkg"
RESULT=$?
if [ $RESULT -eq 0 ]; then
# Install zip and figlet package using pkg
pkg install zip figlet
fi
# Check if apt package manager is available
which "apt"
RESULT=$?
if [ $RESULT -eq 0 ]; then
# Install zip and figlet package using apt-get
sudo apt-get install zip figlet
fi
# Check if yum package manager is available
which "yum"
RESULT=$?
if [ $RESULT -eq 0 ]; then
# Install zip and figlet package using yum
sudo yum install zip figlet
fi
# Check if dnf package manager is available
which "dnf"
RESULT=$?
if [ $RESULT -eq 0 ]; then
# Install zip and figlet package using dnf
sudo dnf install zip figlet
fi
# Check if pacman package manager is available
which "pacman"
RESULT=$?
if [ $RESULT -eq 0 ]; then
# Install zip and figlet package using pacman
sudo pacman -S zip figlet
fi
# Check if zypper package manager is available
which "zypper"
RESULT=$?
if [ $RESULT -eq 0 ]; then
# Install zip and figlet package using zypper
sudo zypper install zip figlet
fi
# Check if the current Linux distribution is Fedora
if [ -f /etc/fedora-release ]; then
# Install zip and figlet package using dnf
sudo dnf install zip figlet
fi
# Display "Lawnchair Magisk" in bigger fonts
figlet "MIUI Launcher MOD"
# Check if zip is installed
if ! command -v zip >/dev/null; then
echo "Error: zip is not installed. Please install it manually and try again."
exit 1
fi
# Read version from module.prop file
version=$(grep "version=" module.prop | cut -d "=" -f 2)
# Delete already exists module zip
rm -rf MIUI\ Launcher\ MOD*
# Check if the current directory has system folder and setup.sh to verify that current directory is valid
if [ ! -d "files" ] || [ ! -f "customize.sh" ]; then
echo "Error: Current directory is not valid. Make sure that you are in the right directory and try again."
exit 1
fi
# Make empty system folder
mkdir system
mkdir system/priv-app
mkdir system/priv-app/aMiuiHome
mkdir system/product
mkdir system/product/overlay
mkdir system/product/priv-app
mkdir system/product/priv-app/aMiuiHome
# Create zip file
echo ">> Creating zip file"
echo "" # make the output look easier to read
zip -r -q "MIUI Launcher MOD $version.zip" . -x .git/\* autobuild.sh README.md # Ignore specified files and folders because they are not needed for the module
echo "" # make the output look easier to read
echo ">> Done! You can find the module zip file in the current directory - '$(pwd)/MIUI Launcher MOD $version.zip'"
# Return back to oriinal state
rm -rf system