From 6f6c7f53a8b99219537daf763293b6ebbd36b971 Mon Sep 17 00:00:00 2001 From: fedora Date: Wed, 15 May 2019 06:29:35 +0200 Subject: [PATCH] Updated location of easetup.sh and upgraded it for CentOS compatibility Disclaimer: not tested on CentOS --- alltheconfigs.sh | 2 +- setup-env/EASetup.sh | 70 +++++++++++++++++++++++++------------------- 2 files changed, 41 insertions(+), 31 deletions(-) diff --git a/alltheconfigs.sh b/alltheconfigs.sh index 97bfe90..367895c 100755 --- a/alltheconfigs.sh +++ b/alltheconfigs.sh @@ -22,7 +22,7 @@ rsync -auP ~/MEGAsync/backups/createarchive.sh $dotfiles/backups rsync -auP ~/MEGAsync/fedora-backup/fedora-setup/fedora-setup.sh $dotfiles/setup-env rsync -auP ~/MEGAsync/fedora-backup/fedora-setup/deploy-dotfiles.sh $dotfiles/setup-env -rsync -auP ~/MEGAsync/EASetup.sh $dotfiles/setup-env +rsync -auP ~/MEGAsync/fedora-backup/fedora-setup/EASetup.sh $dotfiles/setup-env #rsync -auP ~/.config/openbox/autostart $dotfiles/config/openbox diff --git a/setup-env/EASetup.sh b/setup-env/EASetup.sh index 24e28ee..5afe0da 100644 --- a/setup-env/EASetup.sh +++ b/setup-env/EASetup.sh @@ -56,6 +56,7 @@ unsetVars() { unset DONE unset OVER unset NP_USR + unset pkgmgr } introduction() { @@ -80,43 +81,53 @@ introduction() { # first, let's check it's Fedora we're running on... isFedora() { local relll="/etc/redhat-release" - echo -e " ${INFO} checking platform..." - - if grep -iq 'fedora' $relll ; then - echo -e " ${TICK} neat. working on a ${COL_PURPLE}$(cat $relll) ${COL_NC} [hint: supported]" - echo -e " ${INFO} some more detail `uname -a`" #cat /proc/version also poss - # maybe test on centos later - #elif grep -iq 'centos' /etc/redhat-release; then - echo - else - echo -e " ${CROSS} only ${COL_LIGHT_BLUE}Fedora is supported${COL_NC} at the moment, exiting..." - unsetVars && exit 9807362 + if [ ! -f "$relll" ]; then + echo -e " ${CROSS} only ${COL_LIGHT_BLUE}Fedora/CentOS are supported${COL_NC} at the moment, exiting..." + unsetVars && exit 9807362 fi + + echo -e " ${INFO} checking platform..." + # centos not tested + #if [ (grep -iq 'fedora' $relll) || (grep -iq 'centos' $relll) ]; then + echo -e " ${TICK} neat. working on a ${COL_PURPLE}$(cat $relll) ${COL_NC} [hint: supported]" + echo -e " ${INFO} some more detail about you" #cat /proc/version also possible + echo " kernel: v`uname -r`" + echo " platform: `uname -i`" + echo "`command free -m | head -2`" + #fi } wineRepos() { - if grep -iq 'wine:/fedora' /etc/yum.repos.d/* ;then - echo -e " ${TICK} winehq repository already registered, skipping" - echo - else - echo -e " ${INFO} registering a winehq repository" - dnf config-manager --add-repo https://download.opensuse.org/repositories/Emulators:/Wine:/Fedora/Fedora_29_standard/Emulators:Wine:Fedora.repo - if [ `echo $?` -ne 0 ]; then - echo -e " ${CROSS} failed to register winehq repository, aborting..." - unsetVars && exit 1 - else - echo -e " ${TICK} winehq repository successfully registered" - echo - fi - fi + if grep -iq 'winehq.org/wine-builds' /etc/yum.repos.d/* ;then + echo -e " ${TICK} winehq repository already registered, skipping" + echo + else + echo -e " ${INFO} registering a winehq repository" + fi + if grep -iq 'fedora' $relll ; then + export pkgmgr=dnf + $pkgmgr clean all + $pkgmgr config-manager --add-repo https://dl.winehq.org/wine-builds/fedora/30/winehq.repo + elif grep -iq 'centos' $relll ; then + export pkgmgr=yum + yum clean metadata + rpm -Uhv https://dl.winehq.org/wine-builds/fedora/30/winehq.repo + fi + if [ `echo $?` -ne 0 ]; then + echo -e " ${CROSS} failed to register winehq repository, aborting..." + unsetVars && exit 1 + else + echo -e " ${TICK} winehq repository successfully registered" + echo + fi } upgradePkgCache() { local str="refreshing pkg cache" echo -e " ${INFO} ${str}" - dnf upgrade -y --refresh > /dev/null 2>&1 || dilemmaFailedPkgCacheUpgrade + $pkgmgr -y upgrade > /dev/null 2>&1 || dilemmaFailedPkgCacheUpgrade echo -e " ${TICK} pkg cache refreshed" echo } @@ -147,7 +158,7 @@ wineAndFonts() { echo -e " ${TICK} winehq-devel is already installed, skipping" else echo -e " ${INFO} not installed, so installing winehq-devel" - dnf install -y winehq-devel > /dev/null 2>&1 + $pkgmgr -y install winehq-devel > /dev/null 2>&1 if [ `echo $?` -ne 0 ]; then echo -e " ${CROSS} failed to install winehq-devel, aborting..." echo -e " we would not have much fun without that pkg either..." @@ -162,7 +173,7 @@ wineAndFonts() { echo else echo -e " ${INFO} not installed, so installing texlive-carlito (ea compat font)" - dnf install -y texlive-carlito > /dev/null 2>&1 + $pkgmgr -y install texlive-carlito > /dev/null 2>&1 if [ `echo $?` -ne 0 ]; then echo -e " ${CROSS} failed to install compat font, aborting... \n fonts for win\$hit could be an issue" unsetVars && exit 1 @@ -457,7 +468,7 @@ goodbye() { echo -e " ${TICK} you should be all set now" echo -e " ${DONE}" } - + main() { setVars @@ -475,7 +486,6 @@ main() { } main - echo # some docs #