diff --git a/sdata/dist-arch/install-setups.sh b/sdata/dist-arch/install-setups.sh deleted file mode 100644 index 923ac2bc5..000000000 --- a/sdata/dist-arch/install-setups.sh +++ /dev/null @@ -1,15 +0,0 @@ -# This script is meant to be sourced. -# It's not for directly running. - -##################################################################################### -# These python packages are installed using uv into the venv (virtual environment). Once the folder of the venv gets deleted, they are all gone cleanly. So it's considered as setups, not dependencies. -showfun install-python-packages -v install-python-packages - -v sudo usermod -aG video,i2c,input "$(whoami)" -v bash -c "echo i2c-dev | sudo tee /etc/modules-load.d/i2c-dev.conf" -v systemctl --user enable ydotool --now -v sudo systemctl enable bluetooth --now -v gsettings set org.gnome.desktop.interface font-name 'Rubik 11' -v gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark' -v kwriteconfig6 --file kdeglobals --group KDE --key widgetStyle Darkly diff --git a/sdata/dist-fallback/install-setups.sh b/sdata/dist-fallback/install-setups.sh deleted file mode 100644 index 923ac2bc5..000000000 --- a/sdata/dist-fallback/install-setups.sh +++ /dev/null @@ -1,15 +0,0 @@ -# This script is meant to be sourced. -# It's not for directly running. - -##################################################################################### -# These python packages are installed using uv into the venv (virtual environment). Once the folder of the venv gets deleted, they are all gone cleanly. So it's considered as setups, not dependencies. -showfun install-python-packages -v install-python-packages - -v sudo usermod -aG video,i2c,input "$(whoami)" -v bash -c "echo i2c-dev | sudo tee /etc/modules-load.d/i2c-dev.conf" -v systemctl --user enable ydotool --now -v sudo systemctl enable bluetooth --now -v gsettings set org.gnome.desktop.interface font-name 'Rubik 11' -v gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark' -v kwriteconfig6 --file kdeglobals --group KDE --key widgetStyle Darkly diff --git a/sdata/dist-fedora/install-setups.sh b/sdata/dist-fedora/install-setups.sh deleted file mode 100644 index 6364ca3f5..000000000 --- a/sdata/dist-fedora/install-setups.sh +++ /dev/null @@ -1,19 +0,0 @@ -# This script is meant to be sourced. -# It's not for directly running. - -##################################################################################### -# These python packages are installed using uv into the venv (virtual environment). Once the folder of the venv gets deleted, they are all gone cleanly. So it's considered as setups, not dependencies. -showfun install-python-packages -v install-python-packages - -v sudo usermod -aG video,input "$(whoami)" -v mkdir -p "${XDG_CONFIG_HOME}/systemd/user" -v ln -s /usr/lib/systemd/system/ydotool.service "${XDG_CONFIG_HOME}/systemd/user/ydotool.service" -v bash -c "echo uinput | sudo tee /etc/modules-load.d/uinput.conf" -v bash -c 'echo SUBSYSTEM==\"misc\", KERNEL==\"uinput\", MODE=\"0660\", GROUP=\"input\" | - sudo tee /etc/udev/rules.d/99-uinput.rules' -v systemctl --user enable ydotool -v sudo systemctl enable bluetooth --now -v gsettings set org.gnome.desktop.interface font-name 'Rubik 11' -v gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark' -v kwriteconfig6 --file kdeglobals --group KDE --key widgetStyle Darkly diff --git a/sdata/dist-gentoo/install-setups.sh b/sdata/dist-gentoo/install-setups.sh deleted file mode 100644 index db75e555d..000000000 --- a/sdata/dist-gentoo/install-setups.sh +++ /dev/null @@ -1,39 +0,0 @@ -# This script is meant to be sourced. -# It's not for directly running. - -##################################################################################### -# These python packages are installed using uv into the venv (virtual environment). Once the folder of the venv gets deleted, they are all gone cleanly. So it's considered as setups, not dependencies. -showfun install-python-packages -v install-python-packages - -if [[ -z $(getent group i2c) ]]; then - v sudo groupadd i2c -fi - -v sudo usermod -aG video,i2c,input "$(whoami)" - -if [[ ! -z $(systemctl --version) ]]; then - v bash -c "echo i2c-dev | sudo tee /etc/modules-load.d/i2c-dev.conf" - v systemctl --user enable ydotool --now - v sudo systemctl enable bluetooth --now -elif [[ ! -z $(openrc --version) ]]; then - v bash -c "echo 'modules=i2c-dev' | sudo tee -a /etc/conf.d/modules" - v sudo rc-update add modules boot - v sudo rc-update add ydotool default - v sudo rc-update add bluetooth default - - x sudo rc-service ydotool start - x sudo rc-service bluetooth start -else - printf "${STY_RED}" - printf "====================INIT SYSTEM NOT FOUND====================\n" - printf "${STY_RST}" - pause -fi - -v sudo chown -R $(whoami):$(whoami) ~/.config/hypr/ -v sudo chown -R $(whoami):$(whoami) ~/.config/quickshell/ - -v gsettings set org.gnome.desktop.interface font-name 'Rubik 11' -v gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark' -v kwriteconfig6 --file kdeglobals --group KDE --key widgetStyle Darkly diff --git a/sdata/dist-nix/install-setups.sh b/sdata/dist-nix/install-setups.sh deleted file mode 100644 index 0ddcfcf37..000000000 --- a/sdata/dist-nix/install-setups.sh +++ /dev/null @@ -1,39 +0,0 @@ -# This script is meant to be sourced. -# It's not for directly running. - -##################################################################################### -# These python packages are installed using uv into the venv (virtual environment). Once the folder of the venv gets deleted, they are all gone cleanly. So it's considered as setups, not dependencies. -showfun install-python-packages -v install-python-packages - -if [[ -z $(getent group i2c) ]]; then - v sudo groupadd i2c -fi - -v sudo usermod -aG video,i2c,input "$(whoami)" - -if [[ ! -z $(systemctl --version) ]]; then - v bash -c "echo i2c-dev | sudo tee /etc/modules-load.d/i2c-dev.conf" - # TODO: find a proper way for enable Nix installed ydotool - if ! [[ "${INSTALL_VIA_NIX}" == true ]]; then - v systemctl --user enable ydotool --now - fi - v sudo systemctl enable bluetooth --now -elif [[ ! -z $(openrc --version) ]]; then - v bash -c "echo 'modules=i2c-dev' | sudo tee -a /etc/conf.d/modules" - v sudo rc-update add modules boot - v sudo rc-update add ydotool default - v sudo rc-update add bluetooth default - - x sudo rc-service ydotool start - x sudo rc-service bluetooth start -else - printf "${STY_RED}" - printf "====================INIT SYSTEM NOT FOUND====================\n" - printf "${STY_RST}" - pause -fi - -v gsettings set org.gnome.desktop.interface font-name 'Rubik 11' -v gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark' -v kwriteconfig6 --file kdeglobals --group KDE --key widgetStyle Darkly diff --git a/sdata/subcmd-install/2.setups-selector.sh b/sdata/subcmd-install/2.setups-selector.sh deleted file mode 100644 index 0a72e8728..000000000 --- a/sdata/subcmd-install/2.setups-selector.sh +++ /dev/null @@ -1,95 +0,0 @@ -# This script is meant to be sourced. -# It's not for directly running. -printf "${STY_CYAN}[$0]: 2. Setup for permissions/services etc\n${STY_RST}" - -# shellcheck shell=bash - -#################### -# Detect distro -# Helpful link(s): -# http://stackoverflow.com/questions/29581754 -# https://github.com/which-distro/os-release -export OS_RELEASE_FILE=${OS_RELEASE_FILE:-/etc/os-release} -test -f ${OS_RELEASE_FILE} || \ - ( echo "${OS_RELEASE_FILE} does not exist. Aborting..." ; exit 1 ; ) -export OS_DISTRO_ID=$(awk -F'=' '/^ID=/ { gsub("\"","",$2); print tolower($2) }' ${OS_RELEASE_FILE} 2> /dev/null) -export OS_DISTRO_ID_LIKE=$(awk -F'=' '/^ID_LIKE=/ { gsub("\"","",$2); print tolower($2) }' ${OS_RELEASE_FILE} 2> /dev/null) - - - -if [[ "$INSTALL_VIA_NIX" == "true" ]]; then - - TARGET_ID=nix - printf "${STY_YELLOW}" - printf "===WARNING===\n" - printf "./sdata/dist-${TARGET_ID}/install-setups.sh will be used.\n" - printf "The process is still WIP.\n" - printf "Proceed only at your own risk.\n" - printf "\n" - printf "${STY_RST}" - pause - source ./sdata/dist-${TARGET_ID}/install-setups.sh - -elif [[ "$OS_DISTRO_ID" == "arch" ]]; then - - TARGET_ID=arch - printf "${STY_GREEN}" - printf "===INFO===\n" - printf "Detected distro ID: ${OS_DISTRO_ID}\n" - printf "./sdata/dist-${TARGET_ID}/install-setups.sh will be used.\n" - printf "\n" - printf "${STY_RST}" - pause - source ./sdata/dist-${TARGET_ID}/install-setups.sh - -elif [[ -f "./sdata/dist-${OS_DISTRO_ID}/install-setups.sh" ]]; then - - TARGET_ID=${OS_DISTRO_ID} - printf "${STY_PURPLE}" - printf "===NOTICE===\n" - printf "Detected distro ID: ${OS_DISTRO_ID}\n" - printf "./sdata/dist-${TARGET_ID}/install-setups.sh will be used.\n" - printf "This file is provided by the community.\n" - printf "It is not officially supported by github:end-4/dots-hyprland .\n" - printf "${STY_INVERT}" - printf "If you find out any problems about it, PR is welcomed if you are able to address it. Or, create a discussion about it, but please do not submit issue, because the developers do not use this distro, therefore they cannot help.${STY_RST}\n" - printf "${STY_PURPLE}" - printf "Proceed only at your own risk.\n" - printf "\n" - printf "${STY_RST}" - pause - source ./sdata/dist-${TARGET_ID}/install-setups.sh - -elif [[ "$OS_DISTRO_ID_LIKE" == "arch" || "$OS_DISTRO_ID" == "cachyos" ]]; then - - TARGET_ID=arch - printf "${STY_YELLOW}" - printf "===WARNING===\n" - printf "Detected distro ID: ${OS_DISTRO_ID}\n" - printf "Detected distro ID_LIKE: ${OS_DISTRO_ID_LIKE}\n" - printf "./sdata/dist-${TARGET_ID}/install-setups.sh will be used.\n" - printf "Ideally, it should also work for your distro.\n" - printf "Still, there is a chance that it not works as expected or even fails.\n" - printf "Proceed only at your own risk.\n" - printf "\n" - printf "${STY_RST}" - pause - source ./sdata/dist-${TARGET_ID}/install-setups.sh - -else - - TARGET_ID=fallback - printf "${STY_RED}" - printf "===WARNING===\n" - printf "Detected distro ID: ${OS_DISTRO_ID}\n" - printf "Detected distro ID_LIKE: ${OS_DISTRO_ID_LIKE}\n" - printf "./sdata/dist-${OS_DISTRO_ID}/install-setups.sh not found.\n" - printf "./sdata/dist-${TARGET_ID}/install-setups.sh will be used.\n" - printf "It might fail or disrupt your system.\n" - printf "Proceed only at your own risk.\n" - printf "\n" - printf "${STY_RST}" - pause - source ./sdata/dist-${TARGET_ID}/install-setups.sh - -fi diff --git a/sdata/subcmd-install/2.setups.sh b/sdata/subcmd-install/2.setups.sh new file mode 100644 index 000000000..2d8e03ba1 --- /dev/null +++ b/sdata/subcmd-install/2.setups.sh @@ -0,0 +1,64 @@ +# This script is meant to be sourced. +# It's not for directly running. + +function prepare_systemd_user_service(){ + if [[ ! -d "${XDG_CONFIG_HOME}/systemd/user" ]]; then + x mkdir -p "${XDG_CONFIG_HOME}/systemd/user" + fi + if [[ ! -e "${XDG_CONFIG_HOME}/systemd/user/ydotool.service" ]]; then + x ln -s /usr/lib/systemd/system/ydotool.service "${XDG_CONFIG_HOME}/systemd/user/ydotool.service" + fi +} +##################################################################################### +# These python packages are installed using uv into the venv (virtual environment). Once the folder of the venv gets deleted, they are all gone cleanly. So it's considered as setups, not dependencies. +showfun install-python-packages +v install-python-packages + +if [[ -z $(getent group i2c) ]]; then + v sudo groupadd i2c +fi +v sudo usermod -aG video,i2c,input "$(whoami)" + +if [[ ! -z $(systemctl --version) ]]; then + if [[ "$OS_DISTRO_ID" == "fedora" ]]; then + v bash -c "echo uinput | sudo tee /etc/modules-load.d/uinput.conf" + v bash -c 'echo SUBSYSTEM==\"misc\", KERNEL==\"uinput\", MODE=\"0660\", GROUP=\"input\" | sudo tee /etc/udev/rules.d/99-uinput.rules' + else + v bash -c "echo i2c-dev | sudo tee /etc/modules-load.d/i2c-dev.conf" + fi + # TODO: find a proper way for enable Nix installed ydotool. When running `systemctl --user enable ydotool, it errors "Failed to enable unit: Unit ydotool.service does not exist". + if [[ ! "${INSTALL_VIA_NIX}" == true ]]; then + if [[ "$OS_DISTRO_ID" == "fedora" ]]; then + v prepare_systemd_user_service + fi + # When $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR are empty, it commonly means that the current user has been logged in with `su - user` or `ssh user@hostname`. In such case `systemctl --user enable ` is not usable. It should be `sudo systemctl --machine=$(whoami)@.host --user enable ` instead. + if [[ ! -z "${DBUS_SESSION_BUS_ADDRESS}" ]]; then + v systemctl --user enable ydotool --now + else + v sudo systemctl --machine=$(whoami)@.host --user enable ydotool --now + fi + fi + v sudo systemctl enable bluetooth --now +elif [[ ! -z $(openrc --version) ]]; then + v bash -c "echo 'modules=i2c-dev' | sudo tee -a /etc/conf.d/modules" + v sudo rc-update add modules boot + v sudo rc-update add ydotool default + v sudo rc-update add bluetooth default + + x sudo rc-service ydotool start + x sudo rc-service bluetooth start +else + printf "${STY_RED}" + printf "====================INIT SYSTEM NOT FOUND====================\n" + printf "${STY_RST}" + pause +fi + +if [[ "$OS_DISTRO_ID" == "gentoo" ]]; then + v sudo chown -R $(whoami):$(whoami) ~/.config/hypr/ + v sudo chown -R $(whoami):$(whoami) ~/.config/quickshell/ +fi + +v gsettings set org.gnome.desktop.interface font-name 'Rubik 11' +v gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark' +v kwriteconfig6 --file kdeglobals --group KDE --key widgetStyle Darkly diff --git a/setup b/setup index 9309491e2..342471210 100755 --- a/setup +++ b/setup @@ -70,7 +70,7 @@ case ${SUBCMD_NAME} in source ${SUBCMD_DIR}/1.deps-selector.sh fi if [[ "${SKIP_ALLSETUPS}" != true ]]; then - source ${SUBCMD_DIR}/2.setups-selector.sh + source ${SUBCMD_DIR}/2.setups.sh fi if [[ "${SKIP_ALLFILES}" != true ]]; then source ${SUBCMD_DIR}/3.files.sh @@ -83,7 +83,7 @@ case ${SUBCMD_NAME} in ;; install-setups) if [[ "${SKIP_ALLSETUPS}" != true ]]; then - source ${SUBCMD_DIR}/2.setups-selector.sh + source ${SUBCMD_DIR}/2.setups.sh fi ;; install-files)