summaryrefslogtreecommitdiff
path: root/src/abslibre-tools/libredbdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/abslibre-tools/libredbdiff')
-rwxr-xr-xsrc/abslibre-tools/libredbdiff13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/abslibre-tools/libredbdiff b/src/abslibre-tools/libredbdiff
index 50208f2..bb2d4c0 100755
--- a/src/abslibre-tools/libredbdiff
+++ b/src/abslibre-tools/libredbdiff
@@ -46,6 +46,7 @@ downloadfile() {
local outfile=$1
local url=$2
local mesg=("${@:3}")
+
if [[ ! -e "$outfile" ]] ; then
msg "${mesg[@]}"
if wget -q "$url" -O "$outfile"; then
@@ -59,18 +60,22 @@ downloadfile() {
}
enablerepo() {
- repo="$1"
- conffile_arg="$2"
+ local repo="$1"
+ local conffile_arg="$2"
+
msg2 "Enabling repo %q in %q" "$repo" "$conffile_arg"
sed -i "s/\#\[$repo\]/[$repo]/" "$conffile_arg"
sed -i "\/\[$repo\]/,+1 s/#Include/Include/" "$conffile_arg"
}
+# Globals:
+# - init
createdir() {
local dir=$1
+
if [[ ! -e "$dir" ]] ; then
msg "Creating directory %q" "$dir"
- mkdir -- "$1" || die "Failed to create directory %q. Exiting." "$dir"
+ mkdir -- "$dir" || die "Failed to create directory %q. Exiting." "$dir"
elif [[ -n "$init" ]]; then
warning "%q already exists. Skipping." "$dir"
fi
@@ -80,7 +85,9 @@ setmirror() {
local distro="$1"
local mirror="$2"
local mirrorlist="$3"
+
if [[ -n "$init" ]] && [[ -n "$mirror" ]]; then
+ local mirrorescaped
mirrorescaped="${mirror//./\\.}"
mirrorescaped="${mirrorescaped//\$/\\$}"
msg2 "Setting %s as the only enabled %s mirror." "$mirror" "$distro"