-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall
More file actions
executable file
·122 lines (104 loc) · 4.44 KB
/
install
File metadata and controls
executable file
·122 lines (104 loc) · 4.44 KB
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/bin/bash
echo """
██╗░░░░░██╗███╗░░██╗░██████╗████████╗░█████╗░██████╗░███████╗
██║░░░░░██║████╗░██║██╔════╝╚══██╔══╝██╔══██╗██╔══██╗██╔════╝
██║░░░░░██║██╔██╗██║╚█████╗░░░░██║░░░██║░░██║██████╔╝█████╗░░
██║░░░░░██║██║╚████║░╚═══██╗░░░██║░░░██║░░██║██╔══██╗██╔══╝░░
███████╗██║██║░╚███║██████╔╝░░░██║░░░╚█████╔╝██║░░██║███████╗
╚══════╝╚═╝╚═╝░░╚══╝╚═════╝░░░░╚═╝░░░░╚════╝░╚═╝░░╚═╝╚══════╝"""
echo "Welcome to the LinStore installer!"
echo ""
if [ ! -e /usr/local/bin/install_package ]; then
sudo echo
fi
# Check if git and yad are installed
missing_dependencies=false
error() {
echo -e "\033[1;41m\033[97m ERROR:\033[0;41m $1 \033[0m" 1>&2
}
warning() {
echo -e "\033[1;43m\033[97m WARNING:\033[0;43m $1 \033[0m" 1>&2
}
information() {
echo -e "\033[1;104m\033[30m INFO:\033[0;104m $1 \033[0m" 1>&2
}
if ! command -v git &>/dev/null; then
echo "Git is not installed. Please install Git and rerun the installation."
missing_dependencies=true
fi
if ! command -v yad wmctrl convert xdotool &>/dev/null; then
warning "Various dependencies required for LinStore are not installed."
information "Installing dependencies..."
sudo apt update > /dev/null 2>&1
if sudo apt install yad wmctrl imagemagick xdotool -y > /dev/null 2>&1; then
missing_dependencies=false
else
error "Cannot continue, exiting."
missing_dependencies=true
fi
fi
if [ "$missing_dependencies" = true ]; then
exit 1
fi
temp_dir=$(mktemp -d) || {
error "Failed to create a temporary directory, exiting."
exit 1
}
if [ -e "etc/express-updates" ] || [ -e "$HOME/.linstore/etc/express-updates" ]; then
if [[ "$(cat etc/express-updates 2>/dev/null)" == "TRUE" || "$(cat $HOME/.linstore/etc/express-updates 2>/dev/null)" == "TRUE" ]]; then
information "Using existing cloned files from update..."
mv "$HOME"/.linstore/tmp/* "$temp_dir"
rm -rf "$HOME/.linstore/tmp"
else
information "Cloning necessary files from the repository..."
if ! git clone https://github.com/techguy16/linstore "$temp_dir" > /dev/null 2>&1; then
error "Failed to clone repository. Exiting installation."
rm -rf "$temp_dir"
exit 1
fi
fi
else
information "Cloning necessary files from the repository..."
if ! git clone https://github.com/techguy16/linstore "$temp_dir" > /dev/null 2>&1; then
error "Failed to clone repository. Exiting installation."
rm -rf "$temp_dir"
exit 1
fi
fi
information "Copying files to the installation directory..."
install_dir="$HOME/.linstore"
mkdir -p "$install_dir"
cp -r "$temp_dir"/* "$install_dir"
cd "$install_dir"
chmod +x *
chmod +x "gui"
rm -rf "$temp_dir" # Clean up temporary directory
# Create a bin directory if it doesn't exist
if [ ! -e /usr/local/bin/install_package ]; then
sudo mkdir -p /usr/local/bin
# Copy files to /usr/local/bin
information "Copying executable files to /usr/local/bin..."
sudo cp "$install_dir"/etc/tools/*_package /usr/local/bin/
fi
# Create a desktop shortcut for GUI
information "Creating desktop shortcuts..."
desktop_file=("$HOME/.local/share/applications/LinStore.desktop" "$HOME/Desktop/LinStore.desktop")
for desktop_file in "${desktop_file[@]}"; do
cat <<EOF >"$desktop_file"
[Desktop Entry]
Name=LinStore
Comment=The lightest and fastest Linux app store.
Exec=$HOME/.linstore/gui
Type=Application
Version=1.0
Terminal=false
StartupWMClass=LinStore
Icon=$HOME/.linstore/images/logo/logo.png
Categories=Utility;System;PackageManager;
EOF
done
information "Cleaning up cached files..."
rm -rf "$HOME/.linstore/tmp/"
information "Creating important directories..."
mkdir -p "$HOME/.linstore/installscripts"
information "LinStore installed successfully!"