OSDN Git Service

[fix] : Fixed remove function
[alterlinux/fascode-live-tools.git] / alterlinux-desktop-file / alterlinux-desktop-file
index 17067c4..b8eb7db 100755 (executable)
@@ -12,13 +12,26 @@ alterlive=false
 force=false
 checklive=false
 
+remove () {
+    local _list
+    local _file
+    _list=($(echo "$@"))
+    for _file in "${_list[@]}"; do
+        if [[ -f ${_file} ]]; then
+            rm -f "${_file}"
+        elif [[ -d ${_file} ]]; then
+            rm -rf "${_file}"
+        fi
+    done
+}
+
 _help() {
     echo "usage ${0} [options]"
     echo
     echo " General options:"
     echo "    -f | --force        Force overwriting."
     echo "    -h | --help         This help message and exit."
-    echo "    -l | --live         Opens the page only in a live environment."
+    echo "    -l | --live         Create files only in a live environment."
     echo "                        Whether it is a live environment or not is determined"
     echo "                        by the presence or absence of the installer."
     echo
@@ -72,6 +85,9 @@ while true; do
     esac
 done
 
+if [[ "${alterlive}" = true ]]; then
+    remove "${HOME}/.config/autostart/genicon.desktop"
+fi
 
 if [[ "${checklive}" = true ]]; then
     if ! pacman -Qq alterlinux-calamares 1> /dev/null 2> /dev/null; then
@@ -99,19 +115,6 @@ get_desktop_dir() {
     echo -n "${_desktop_dir}"
 }
 
-remove () {
-    local _list
-    local _file
-    _list=($(echo "$@"))
-    for _file in "${_list[@]}"; do
-        if [[ -f ${_file} ]]; then
-            rm -f "${_file}"
-        elif [[ -d ${_file} ]]; then
-            rm -rf "${_file}"
-        fi
-    done
-}
-
 #copy <コピー元> <コピー先>
 copy() {
     if [[ ! -f "${1}" ]]; then
@@ -147,8 +150,3 @@ sed -i "s/%OS_NAME%/${os_name}/g" "${desktop_icon}"
 source_file="/usr/share/alterlinux/desktop-file/welcome-to-alter.desktop"
 desktop_icon="${desktop_dir}/$(basename "${source_file}")"
 copy "${source_file}" "${desktop_dir}"
-
-
-if [[ "${alterlive}" = true ]]; then
-    remove ~/.config/autostart/genicon.desktop
-fi