#!/bin/bash

## Copyright (C) 2020 - 2023 ENCRYPTED SUPPORT LP <adrelanos@whonix.org>
## See the file COPYING for copying conditions.

set -e

if [ "$(id -u)" != "0" ]; then
   echo "ERROR: This must be run as root (sudo)!"
   exit 1
fi

shopt -s nullglob
shopt -s dotglob

search="http://HTTPS///"
replace="https://"

for file_name in /etc/apt/sources.list /etc/apt/sources.list.d/*.list ; do
   if ! test -f "$file_name" ; then
      continue
   fi
   LANG=C str_replace "$search" "$replace" "$file_name"
done
