Skip to content

Commit

Permalink
Merge pull request #34 from virtualmin/fix-sources-list
Browse files Browse the repository at this point in the history
Handle deb repos better, remove them on reinstall
  • Loading branch information
swelljoe authored May 23, 2020
2 parents 2e41004 + 2edbcfe commit ef70a28
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions virtualmin-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,20 @@ log_fatal() {
log_error "$1"
}

remove_virtualmin_release () {
# shellcheck disable=SC2154
case "$os_type" in
"fedora" | "centos" | "rhel" | "amazon" )
run_ok "rpm -e virtualmin-release" "Removing virtualmin-release"
;;
"debian" | "ubuntu" )
grep -v "virtualmin" /etc/apt/sources.list > "$tempdir"/sources.list
mv "$tempdir"/sources.list /etc/apt/sources.list
rm -f /etc/apt/sources.list.d/virtualmin.list
;;
esac
}

fatal () {
echo
log_fatal "Fatal Error Occurred: $1"
Expand All @@ -339,19 +353,6 @@ fatal () {
exit 1
}

remove_virtualmin_release () {
# shellcheck disable=SC2154
case "$os_type" in
"fedora" | "centos" | "rhel" | "amazon" )
run_ok "rpm -e virtualmin-release" "Removing virtualmin-release"
;;
"debian" | "ubuntu" )
grep -v "virtualmin" /etc/apt/sources.list > "$tempdir"/sources.list
mv "$tempdir"/sources.list /etc/apt/sources.list
;;
esac
}

success () {
log_success "$1 Succeeded."
}
Expand Down Expand Up @@ -706,8 +707,10 @@ install_virtualmin_release () {
log_fatal "No repos available for this OS. Are you running unstable/testing?"
exit 1
fi
# Remove any existing repo config, in case it's a reinstall
remove_virtualmin_release
for repo in $repos; do
printf "deb http://${LOGIN}software.virtualmin.com/vm/${vm_version}/${repopath}apt ${repo} main\\n" >> /etc/apt/sources.list
printf "deb http://${LOGIN}software.virtualmin.com/vm/${vm_version}/${repopath}apt ${repo} main\\n" >> /etc/apt/sources.list.d/virtualmin.list
done
# Install our keys
log_debug "Installing Webmin and Virtualmin package signing keys..."
Expand Down

0 comments on commit ef70a28

Please sign in to comment.