Skip to content

Commit

Permalink
Vivaldi code refactoring
Browse files Browse the repository at this point in the history
various Vivaldi bugfixes

added tidy install to vivaldi code

Idea to simplify Vivaldi code

Changes to Vivaldi RPM install code

- For Fedora and OpenSUSE, not including (minus a var or two i use) OFFICIAL Vivaldi instructions for those distros

Vivaldi code refactoring
  • Loading branch information
Xmetalfanx committed Jun 8, 2024
1 parent 1cc23db commit c60f155
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function browserSoftwareMenuCaseStatement() {
3) installUngoogledChromium ;;
4) installFirefoxMeta ;;
5) installLibreWolf ;;
6) installVivaldi ;;
6) meta_install_vivaldi ;;
[sS]) mainSoftwareMenuType ;;
[mM]) mainMenuType ;;
[qQ]) quitScript ;;
Expand Down
107 changes: 49 additions & 58 deletions functions/universal/software/browsers/f_vivaldi.cfg
Original file line number Diff line number Diff line change
@@ -1,86 +1,77 @@
# used to get the URL
function get_vivaldi_url() {
package_search=$1

function vivaldiAddKey() {
vivaldiKey="https://repo.vivaldi.com/stable/linux_signing_key.pub"
curl -s "https://vivaldi.com/download/" | tidy -q --show-warnings no | grep ${package_search} | tr -d '"'

fancy_message action "Adding Vivaldi Key"

case $distroBase in
fedora|opensuse) sudo rpm --import $vivaldiKey ;;

ubuntu)

# Handle Key file
wget -qO- "${vivaldiKey}" | gpg --dearmor | sudo dd of=/usr/share/keyrings/vivaldi-browser.gpg
}

;;
function assign_vivaldi_vars() {

*) return ;;
programName="vivaldi-stable"
programTitle="Vivaldi Web Browser"

esac
case $distroBase in
debian|ubuntu) programURL=$(get_vivaldi_url "amd64.deb" )
;;
fedora|opensuse) programURL=$(get_vivaldi_url "x86_64.rpm" )
;;
esac

vivaldi_package="$(basename ${programURL})"

case $distroBase in
fedora|opensuse|ubuntu) fancy_message info "${programTitle} Key added" ;;
*) return ;;
esac
# idea: i need the downloaded file name for the install step
vivaldi_downloaded_package="${downloadDir}/${vivaldi_package}"


}

# downloads into a user's Downloads folder
function download_vivaldi () {
fancy_message action "Downloading Vivaldi"
wget -q -P ${downloadDir} ${programURL}
}

function installVivaldi() {
programName="vivaldi-stable"
programTitle="Vivaldi Web Browser"

# Resource related to keys and installing: https://help.vivaldi.com/article/obtaining-official-builds/

case $distroBase in
function install_vivaldi() {

arch)
installApp "vivaldi vivaldi-ffmpeg-codecs "
return ;;
fancy_message action "Installing Vivaldi"
# The changes to Fedora and OpenSUSE below are official (sort of .. minus the var) vivaldi instructions
# source: https://help.vivaldi.com/desktop/install-update/manual-setup-vivaldi-linux-repositories/https://help.vivaldi.com/desktop/install-update/manual-setup-vivaldi-linux-repositories/
case $distroBase in

fedora)
installApp "dnf-utils"
arch) installApp "vivaldi vivaldi-ffmpeg-codecs" ;;

fancy_message action "Adding Vivaldi Repo"
sudo dnf config-manager --add-repo https://repo.vivaldi.com/archive/vivaldi-fedora.repo
;;
debian|ubuntu)
# question: does code below execute if deb-get handles thing? if its not installed does the code below run?
# this CHECKS FOR deb-get .. if its not installed it doesn't install/offer to install
debGetInstall && return

opensuse)
# Add/Import Vivaldi Key
vivaldiAddKey
gdebiInstall ${programURL}
;;

fancy_message action "Adding Vivaldi Repository"
sudo zypper ar https://repo.vivaldi.com/archive/vivaldi-suse.repo
fedora) sudo dnf --nogpgcheck -y install ${vivaldi_downloaded_package} ;;

fancy_message action "Refreshing/Updating Repo"
$refresh
;;
opensuse) sudo zypper --no-gpg-checks --non-interactive install ${vivaldi_downloaded_package} ;;

debian|ubuntu)
solus) installApp "${programName}" ;;

#debGetInstall && return
esac

# idea: things should only get here if deb-get is not installed

}

# Add/Import Vivaldi Key
vivaldiAddKey

fancy_message action "Creating Vivaldi Source File"
echo "deb [signed-by=/usr/share/keyrings/vivaldi-browser.gpg arch=$(dpkg --print-architecture)] https://repo.vivaldi.com/archive/deb/ stable main" | sudo dd of=/etc/apt/sources.list.d/vivaldi-archive.list
# Meta function
function meta_install_vivaldi() {

fancy_message action "Refreshing Repo"
$refesh
;;
esac
installApp "tidy"

# 1 - Assign Vivaldi vars
assign_vivaldi_vars

case $distroBase in
debian|fedora|opensuse|solus|ubuntu) installApp "${programName}" ;;
esac
case $distroBase in
arch|solus) install_vivaldi ;;

userPrompt
}
debian|fedora|opensuse|ubuntu) download_vivaldi ${programURL} && install_vivaldi ;;

esac
}
86 changes: 86 additions & 0 deletions functions/universal/software/browsers/f_vivaldi_old.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@

function vivaldiAddKey() {
vivaldiKey="https://repo.vivaldi.com/stable/linux_signing_key.pub"

fancy_message action "Adding Vivaldi Key"

case $distroBase in
fedora|opensuse) sudo rpm --import $vivaldiKey ;;

ubuntu)

# Handle Key file
wget -qO- "${vivaldiKey}" | gpg --dearmor | sudo dd of=/usr/share/keyrings/vivaldi-browser.gpg

;;

*) return ;;

esac


case $distroBase in
fedora|opensuse|ubuntu) fancy_message info "${programTitle} Key added" ;;
*) return ;;
esac


}


function installVivaldi() {
programName="vivaldi-stable"
programTitle="Vivaldi Web Browser"

# Resource related to keys and installing: https://help.vivaldi.com/article/obtaining-official-builds/

case $distroBase in

arch)
installApp "vivaldi vivaldi-ffmpeg-codecs "
return ;;

fedora)
installApp "dnf-utils"

fancy_message action "Adding Vivaldi Repo"
sudo dnf config-manager --add-repo https://repo.vivaldi.com/archive/vivaldi-fedora.repo
;;

opensuse)
# Add/Import Vivaldi Key
vivaldiAddKey

fancy_message action "Adding Vivaldi Repository"
sudo zypper ar https://repo.vivaldi.com/archive/vivaldi-suse.repo

fancy_message action "Refreshing/Updating Repo"
$refresh
;;

debian|ubuntu)

#debGetInstall && return

# idea: things should only get here if deb-get is not installed


# Add/Import Vivaldi Key
vivaldiAddKey

fancy_message action "Creating Vivaldi Source File"
echo "deb [signed-by=/usr/share/keyrings/vivaldi-browser.gpg arch=$(dpkg --print-architecture)] https://repo.vivaldi.com/archive/deb/ stable main" | sudo dd of=/etc/apt/sources.list.d/vivaldi-archive.list

fancy_message action "Refreshing Repo"
$refesh
;;
esac


case $distroBase in
debian|fedora|opensuse|solus|ubuntu) installApp "${programName}" ;;
esac

userPrompt
}

0 comments on commit c60f155

Please sign in to comment.