fix: improve Ubuntu and derivatives support in install scripts
This commit is contained in:
parent
d7260917b4
commit
d34180537a
2 changed files with 26 additions and 7 deletions
21
install.sh
21
install.sh
|
|
@ -27,6 +27,7 @@ detect_distro() {
|
||||||
if [ -f /etc/os-release ]; then
|
if [ -f /etc/os-release ]; then
|
||||||
. /etc/os-release
|
. /etc/os-release
|
||||||
DISTRO=$ID
|
DISTRO=$ID
|
||||||
|
DISTRO_LIKE=${ID_LIKE:-""}
|
||||||
else
|
else
|
||||||
echo -e "${RED}Error: Cannot detect Linux distribution (/etc/os-release missing).${NC}"
|
echo -e "${RED}Error: Cannot detect Linux distribution (/etc/os-release missing).${NC}"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
@ -40,12 +41,13 @@ install_dependencies() {
|
||||||
echo -e "Installing ${mode} dependencies..."
|
echo -e "Installing ${mode} dependencies..."
|
||||||
|
|
||||||
case "$DISTRO" in
|
case "$DISTRO" in
|
||||||
ubuntu|debian|raspbian|pop|mint|linuxmint|neon)
|
ubuntu|debian|raspbian|pop|mint|linuxmint|neon|zorin|elementary)
|
||||||
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
apt-get update -y
|
apt-get update -y
|
||||||
if [ "$mode" = "build" ]; then
|
if [ "$mode" = "build" ]; then
|
||||||
apt-get install -y build-essential pkg-config libx11-dev libxtst-dev libdbus-1-dev libevdev-dev
|
apt-get install -y build-essential pkg-config libx11-dev libxtst-dev libdbus-1-dev libevdev-dev libwayland-dev curl
|
||||||
fi
|
fi
|
||||||
apt-get install -y libevdev2 libdbus-1-3 libx11-6 libxtst6 xclip wl-clipboard
|
apt-get install -y libevdev2 libdbus-1-3 libx11-6 libxtst6 xclip wl-clipboard libwayland-client0 curl
|
||||||
;;
|
;;
|
||||||
fedora|rhel|centos)
|
fedora|rhel|centos)
|
||||||
if [ "$mode" = "build" ]; then
|
if [ "$mode" = "build" ]; then
|
||||||
|
|
@ -60,11 +62,20 @@ install_dependencies() {
|
||||||
pacman -Sy --needed --noconfirm libevdev libx11 libxtst dbus xclip wl-clipboard
|
pacman -Sy --needed --noconfirm libevdev libx11 libxtst dbus xclip wl-clipboard
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
if [[ "$DISTRO_LIKE" == *"ubuntu"* || "$DISTRO_LIKE" == *"debian"* ]]; then
|
||||||
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
apt-get update -y
|
||||||
|
if [ "$mode" = "build" ]; then
|
||||||
|
apt-get install -y build-essential pkg-config libx11-dev libxtst-dev libdbus-1-dev libevdev-dev libwayland-dev curl
|
||||||
|
fi
|
||||||
|
apt-get install -y libevdev2 libdbus-1-3 libx11-6 libxtst6 xclip wl-clipboard libwayland-client0 curl
|
||||||
|
else
|
||||||
echo -e "${YELLOW}Warning: Unsupported distribution '${DISTRO}'. Please make sure you have the following packages installed manually:${NC}"
|
echo -e "${YELLOW}Warning: Unsupported distribution '${DISTRO}'. Please make sure you have the following packages installed manually:${NC}"
|
||||||
echo -e " - libevdev, libdbus-1, libx11, libxtst, xclip, wl-clipboard"
|
echo -e " - libevdev, libdbus-1, libx11, libxtst, xclip, wl-clipboard"
|
||||||
if [ "$mode" = "build" ]; then
|
if [ "$mode" = "build" ]; then
|
||||||
echo -e " - gcc, pkg-config, and development headers for the above libraries."
|
echo -e " - gcc, pkg-config, and development headers for the above libraries."
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
@ -190,6 +201,10 @@ echo "Installing desktop launcher..."
|
||||||
mkdir -p /usr/share/applications
|
mkdir -p /usr/share/applications
|
||||||
cp "$FILE_DESKTOP" /usr/share/applications/
|
cp "$FILE_DESKTOP" /usr/share/applications/
|
||||||
|
|
||||||
|
if command -v update-desktop-database >/dev/null 2>&1; then
|
||||||
|
update-desktop-database /usr/share/applications >/dev/null 2>&1 || true
|
||||||
|
fi
|
||||||
|
|
||||||
# 5. Install Systemd User Service
|
# 5. Install Systemd User Service
|
||||||
echo "Installing systemd user service..."
|
echo "Installing systemd user service..."
|
||||||
mkdir -p /usr/lib/systemd/user
|
mkdir -p /usr/lib/systemd/user
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,10 @@ echo "Removing desktop files and autostart..."
|
||||||
rm -f /usr/share/applications/vietc.desktop
|
rm -f /usr/share/applications/vietc.desktop
|
||||||
rm -f /etc/xdg/autostart/vietc-tray.desktop
|
rm -f /etc/xdg/autostart/vietc-tray.desktop
|
||||||
|
|
||||||
|
if command -v update-desktop-database >/dev/null 2>&1; then
|
||||||
|
update-desktop-database /usr/share/applications >/dev/null 2>&1 || true
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Removing systemd service..."
|
echo "Removing systemd service..."
|
||||||
rm -f /usr/lib/systemd/user/vietc.service
|
rm -f /usr/lib/systemd/user/vietc.service
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue