#!/bin/sh if [ -f /etc/os-release ]; then . /etc/os-release DISTRO=$ID if [ "$DISTRO" = "ubuntu" ] || [ "$DISTRO" = "debian" ]; then OS=DEBIAN elif [ "$DISTRO" = "fedora" ] || [ "$DISTRO" = "centos" ]; then OS=CENTOS else echo "OS not detected" exit 1 fi else echo "/etc/os-release not found, cannot determine OS." exit 1 fi PREFIX=/usr/local/bin/wmde copy_files() { mkdir -p $PREFIX cp wmde-rp-init.sh $PREFIX/ cp wmde-rp-check-pam-user.sh $PREFIX/ #cp wmde-rp-unison-initial-sync-nfs.sh $PREFIX/ cp wmde-rp-generate-known-hosts.sh $PREFIX/ #cp wmde-rp-usersync-nfs.sh $PREFIX/ cp wmde-rp-usersync-ssh.sh $PREFIX/ cp wmde-rp-progress.sh $PREFIX/ cp wmde-rp-common.sh $PREFIX/ chmod 755 $PREFIX/* cp wmde-rp-usersync.service /etc/systemd/user/wmde-rp-usersync.service mkdir -p /etc/systemd/user/default.target.wants rm -rf /etc/systemd/user/default.target.wants/wmde-rp-usersync.service ln -s /etc/systemd/user/wmde-rp-usersync.service /etc/systemd/user/default.target.wants/wmde-rp-usersync.service cp wmde-rp-full.prf /etc cp wmde-rp-config.prf /etc cp wmde-rp-perm.prf /etc cp wmde-rp.conf /etc } update_pam() { rm -rf /etc/authselect/custom/wmde authselect create-profile wmde -b sssd --symlink-meta cp postlogin /etc/authselect/custom/wmde/postlogin authselect select custom/wmde with-mkhomedir with-sudo authselect apply-changes } if [ "$OS" = "CENTOS" ]; then dnf install -y unison copy_files update_pam fi if [ "$OS" = "DEBIAN" ]; then apt purge -y unison mkdir -p unison_temp cd unison_temp wget https://github.com/bcpierce00/unison/releases/download/v2.53.7/unison-2.53.7-ubuntu-x86_64-static.tar.gz tar xvfz unison-2.53.7-ubuntu-x86_64-static.tar.gz cd bin chmod +x unison unison-fsmonitor sudo mv unison unison-fsmonitor /usr/local/bin/ cd .. cd .. rm -rf unison_temp copy_files fi