Skip to content

Commit

Permalink
Vivaldi code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Xmetalfanx committed Nov 11, 2024
1 parent e634da1 commit e86c391
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 113 deletions.
38 changes: 11 additions & 27 deletions functions/universal/software/browsers/f_vivaldi.cfg
Original file line number Diff line number Diff line change
@@ -1,29 +1,16 @@
# used to get the URL
# used to get the URL
function get_vivaldi_url() {
package_search=$1

curl -s "https://vivaldi.com/download/" | tidy -q --show-warnings no | grep ${package_search} | tr -d '"'
programURL=$(curl -s "https://vivaldi.com/download/" | tidy -q --show-warnings no | awk -v search_term=$package_search -F '"' ' $0 ~ search_term { print $2}' )

}

function assign_vivaldi_vars() {

programName="vivaldi-stable"
programTitle="Vivaldi Web Browser"

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})"

# idea: i need the downloaded file name for the install step
vivaldi_downloaded_package="${downloadDir}/${vivaldi_package}"


}

# downloads into a user's Downloads folder
Expand All @@ -41,14 +28,6 @@ function install_vivaldi() {

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

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
deb_get_install && return

gdebiInstall ${programURL}
;;

fedora) sudo dnf --nogpgcheck -y install ${vivaldi_downloaded_package} ;;

opensuse) sudo zypper --no-gpg-checks --non-interactive install ${vivaldi_downloaded_package} ;;
Expand All @@ -63,15 +42,20 @@ function install_vivaldi() {
# Meta function
function install_vivaldi_meta() {

installApp "tidy"
programName="vivaldi-stable"
programTitle="Vivaldi Web Browser"

# 1 - Assign Vivaldi vars
assign_vivaldi_vars
# "tidy" needed to help get the URL from the curl command in this case
case $distroBase in
debian|ubuntu) installApp "tidy" && get_vivaldi_url "amd64.deb" ;;
fedora|opensuse) installApp "tidy" && get_vivaldi_url "x86_64.rpm" ;;
esac

case $distroBase in
arch|solus) install_vivaldi ;;
fedora|opensuse)download_vivaldi ${programURL} && install_vivaldi ;;

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

esac
}
86 changes: 0 additions & 86 deletions functions/universal/software/browsers/f_vivaldi_old.cfg

This file was deleted.

0 comments on commit e86c391

Please sign in to comment.