OSDN Git Service

[move] : Moved files for new repo system
[alterlinux/alterlinux-pkgbuilds.git] / alter-stable / alterlinux-wallpapers / alterlinux-wallpapers-xfce
1 #!/usr/bin/env bash
2
3 # Delete file only if file exists
4 # remove <file1> <file2> ...
5 function remove () {
6     local _list
7     local _file
8     _list=($(echo "$@"))
9     for _file in "${_list[@]}"; do
10         if [[ -f ${_file} ]]; then
11             rm -f "${_file}"
12         elif [[ -d ${_file} ]]; then
13             rm -rf "${_file}"
14         fi
15     done
16 }
17
18 image="${1}"
19 replace="${2}"
20
21 # Replace wallpaper.
22 remove "/usr/share/backgrounds/xfce/xfce-${image}.png"
23 ln -s "/usr/share/backgrounds/${replace}.png" "/usr/share/backgrounds/xfce/xfce-${image}.png"
24 chmod 644 "/usr/share/backgrounds/${replace}.png"