You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
873 B

10 months ago
#!/usr/bin/bash -e
# just in case of hidden files.. not sure why would someone do that, it's more
# like forgotten cache file possibility, but rather do that..
shopt -s dotglob
is_dir_empty() {
test -z "$(ls -A $1)"
}
handle_dir() {
# Move all files from $1 to $2 when the /etc/yum/$1 is not empty
# and not already a link
# Then remove the $1 directory and relink it to $2
# param $1: dirname under /etc/yum path
# param $2: dirname under /etc/dnf path
if [ "$(readlink /etc/yum/$1)" == "../dnf/$2" ]; then
return
fi
if ! is_dir_empty "/etc/yum/$1"; then
mv /etc/yum/$1/* /etc/dnf/$2/
fi
rm -rf /etc/yum/$1
#relink
ln -s ../dnf/$2 /etc/yum/$1
return 0
}
# assume the directories are not removed by user..
handle_dir pluginconf.d plugins
handle_dir protected.d protected.d
handle_dir vars vars