4 # Email : hayao@fascode.net
6 # (c) 2019-2020 Fascode Network.
19 for _file in "${_list[@]}"; do
20 if [[ -f ${_file} ]]; then
22 elif [[ -d ${_file} ]]; then
29 echo "usage ${0} [options]"
31 echo " General options:"
32 echo " -f | --force Force overwriting."
33 echo " -h | --help This help message and exit."
34 echo " -l | --live Create files only in a live environment."
35 echo " Whether it is a live environment or not is determined"
36 echo " by the presence or absence of the installer."
38 echo " --alterlive Remove the file for live session"
39 echo " If you specify --alterlive, --live is also specified automatically."
42 # Argument analysis and processing
45 _opt_long="force,live,help,alterlive"
46 OPT=$(getopt -o ${_opt_short} -l ${_opt_long} -- "${@}")
47 if [[ ${?} != 0 ]]; then
81 echo "Invalid argument '${1}'" >&2
88 if [[ "${alterlive}" = true ]]; then
89 remove "${HOME}/.config/autostart/genicon.desktop"
92 if [[ "${checklive}" = true ]]; then
93 if ! pacman -Qq alterlinux-calamares 1> /dev/null 2> /dev/null; then
99 # ~/Desktopに相当するディレクトリを返します
101 local _user_config_dir _desktop_dir
102 if [[ -v XDG_CONFIG_HOME ]]; then
103 _user_config_dir="${XDG_CONFIG_HOME}"
105 _user_config_dir="${HOME}/.config"
107 if [[ -f "${_user_config_dir}/user-dirs.dirs" ]]; then
108 source "${_user_config_dir}/user-dirs.dirs"
110 if [[ -v XDG_DESKTOP_DIR ]]; then
111 _desktop_dir="${XDG_DESKTOP_DIR}"
113 _desktop_dir="${HOME}/Desktop"
115 echo -n "${_desktop_dir}"
120 if [[ ! -f "${1}" ]]; then
121 echo "${1} was not found" >&2
124 if [[ -f "${2}/$(basename "${1}")" ]] || [[ -f "${2}" ]] && [[ "${force}" = false ]]; then
125 echo "File already exists" >&2
132 desktop_dir="$(get_desktop_dir)"
135 source_file="/usr/share/alterlinux/desktop-file/calamares.desktop"
136 desktop_icon="${desktop_dir}/$(basename "${source_file}")"
137 copy "${source_file}" "${desktop_dir}"
139 if [[ -f "/etc/os-release" ]]; then
140 source "/etc/os-release"
143 echo -n "Alter Linux"
146 sed -i "s/%OS_NAME%/${os_name}/g" "${desktop_icon}"
150 source_file="/usr/share/alterlinux/desktop-file/welcome-to-alter.desktop"
151 desktop_icon="${desktop_dir}/$(basename "${source_file}")"
152 copy "${source_file}" "${desktop_dir}"