4 # Email : hayao@fascode.net
6 # (c) 2019-2020 Fascode Network.
16 echo "usage ${0} [options]"
18 echo " General options:"
19 echo " -f | --force Force overwriting."
20 echo " -h | --help This help message and exit."
21 echo " -l | --live Create files only in a live environment."
22 echo " Whether it is a live environment or not is determined"
23 echo " by the presence or absence of the installer."
25 echo " --alterlive Remove the file for live session"
26 echo " If you specify --alterlive, --live is also specified automatically."
29 # Argument analysis and processing
32 _opt_long="force,live,help,alterlive"
33 OPT=$(getopt -o ${_opt_short} -l ${_opt_long} -- "${@}")
34 if [[ ${?} != 0 ]]; then
68 echo "Invalid argument '${1}'" >&2
75 if [[ "${alterlive}" = true ]]; then
76 remove "${HOME}/.config/autostart/genicon.desktop"
79 if [[ "${checklive}" = true ]]; then
80 if ! pacman -Qq alterlinux-calamares 1> /dev/null 2> /dev/null; then
86 # ~/Desktopに相当するディレクトリを返します
88 local _user_config_dir _desktop_dir
89 if [[ -v XDG_CONFIG_HOME ]]; then
90 _user_config_dir="${XDG_CONFIG_HOME}"
92 _user_config_dir="${HOME}/.config"
94 if [[ -f "${_user_config_dir}/user-dirs.dirs" ]]; then
95 source "${_user_config_dir}/user-dirs.dirs"
97 if [[ -v XDG_DESKTOP_DIR ]]; then
98 _desktop_dir="${XDG_DESKTOP_DIR}"
100 _desktop_dir="${HOME}/Desktop"
102 echo -n "${_desktop_dir}"
109 for _file in "${_list[@]}"; do
110 if [[ -f ${_file} ]]; then
112 elif [[ -d ${_file} ]]; then
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}"