| 
									
										
										
										
											2021-03-13 15:15:32 +00:00
										 |  |  | #!/bin/bash | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | currUser="$USER" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if [ ! -d "${HOME}/.config/systemd/user" ]; then | 
					
						
							|  |  |  |     mkdir -p "${HOME}/.config/systemd/user" | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if [ ! -f /usr/bin/zenity ]; then | 
					
						
							|  |  |  |     if [ -f /usr/bin/apt ]; then | 
					
						
							| 
									
										
										
										
											2021-03-16 10:42:40 +00:00
										 |  |  |         sudo apt -y install zenity | 
					
						
							| 
									
										
										
										
											2021-03-13 15:15:32 +00:00
										 |  |  |     fi | 
					
						
							|  |  |  |     if [ -f /usr/bin/pacman ]; then | 
					
						
							| 
									
										
										
										
											2021-03-16 10:42:40 +00:00
										 |  |  |         sudo pacman -S --noconfirm zenity | 
					
						
							| 
									
										
										
										
											2021-03-13 15:15:32 +00:00
										 |  |  |     fi | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-16 22:07:36 +00:00
										 |  |  | HANDLE=$(zenity --entry --width=400 --title "Epicyon Desktop Client" --text "Fediverse handle (name@domain): ") | 
					
						
							| 
									
										
										
										
											2021-03-13 15:15:32 +00:00
										 |  |  | if [ ! "$HANDLE" ]; then | 
					
						
							| 
									
										
										
										
											2021-03-13 15:19:54 +00:00
										 |  |  |     zenity --warning --width=400 --text "No fediverse handle was given" | 
					
						
							| 
									
										
										
										
											2021-03-13 15:15:32 +00:00
										 |  |  |     exit 1 | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | if [[ "$HANDLE" != *'@'* ]]; then | 
					
						
							| 
									
										
										
										
											2021-03-13 15:19:54 +00:00
										 |  |  |     zenity --warning --width=400 --text "Fediverse handle must be in the form username@domain" | 
					
						
							| 
									
										
										
										
											2021-03-13 15:15:32 +00:00
										 |  |  |     exit 2 | 
					
						
							|  |  |  | fi | 
					
						
							| 
									
										
										
										
											2021-03-16 22:07:36 +00:00
										 |  |  | # PASSWORD=$(zenity --width=400 --password --title "Epicyon Desktop Client") | 
					
						
							|  |  |  | # if [ ! "$PASSWORD" ]; then | 
					
						
							|  |  |  | #     zenity --warning --width=400 --text "No password was given" | 
					
						
							|  |  |  | #     exit 3 | 
					
						
							|  |  |  | # fi | 
					
						
							| 
									
										
										
										
											2021-03-13 15:15:32 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | if [ ! -f /usr/bin/git ]; then | 
					
						
							|  |  |  |     if [ -f /usr/bin/apt ]; then | 
					
						
							| 
									
										
										
										
											2021-03-16 10:42:40 +00:00
										 |  |  |         sudo apt -y install git | 
					
						
							| 
									
										
										
										
											2021-03-13 15:15:32 +00:00
										 |  |  |     fi | 
					
						
							|  |  |  |     if [ -f /usr/bin/pacman ]; then | 
					
						
							| 
									
										
										
										
											2021-03-16 10:42:40 +00:00
										 |  |  |         sudo pacman -S --noconfirm git | 
					
						
							|  |  |  |     fi | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if [ ! -f /usr/bin/gpg ]; then | 
					
						
							|  |  |  |     if [ -f /usr/bin/apt ]; then | 
					
						
							|  |  |  |         sudo apt -y install gnupg | 
					
						
							|  |  |  |     fi | 
					
						
							|  |  |  |     if [ -f /usr/bin/pacman ]; then | 
					
						
							|  |  |  |         sudo pacman -S --noconfirm gnupg | 
					
						
							| 
									
										
										
										
											2021-03-13 15:15:32 +00:00
										 |  |  |     fi | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if [ ! -f /usr/bin/python3 ]; then | 
					
						
							|  |  |  |     if [ -f /usr/bin/apt ]; then | 
					
						
							| 
									
										
										
										
											2021-03-16 10:42:40 +00:00
										 |  |  |         sudo apt -y install python3 | 
					
						
							| 
									
										
										
										
											2021-03-13 15:15:32 +00:00
										 |  |  |     fi | 
					
						
							|  |  |  |     if [ -f /usr/bin/pacman ]; then | 
					
						
							| 
									
										
										
										
											2021-03-16 10:42:40 +00:00
										 |  |  |         sudo pacman -S --noconfirm python | 
					
						
							| 
									
										
										
										
											2021-03-13 15:15:32 +00:00
										 |  |  |     fi | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if [ ! -d ${HOME}/.epicyon ]; then | 
					
						
							| 
									
										
										
										
											2024-05-19 09:16:53 +00:00
										 |  |  |     git clone --depth 1 https://gitlab.com/bashrc2/epicyon ${HOME}/.epicyon | 
					
						
							| 
									
										
										
										
											2021-03-13 15:15:32 +00:00
										 |  |  | else | 
					
						
							|  |  |  |     cd ${HOME}/.epicyon || exit 1 | 
					
						
							|  |  |  |     git pull | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | if [ ! -d ${HOME}/.epicyon ]; then | 
					
						
							| 
									
										
										
										
											2021-03-13 15:19:54 +00:00
										 |  |  |     zenity --warning --width=400 --text "Unable to clone Epicyon repo" | 
					
						
							| 
									
										
										
										
											2021-03-13 15:15:32 +00:00
										 |  |  |     exit 4 | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | chown -R "${currUser}":"${currUser}" ${HOME}/.epicyon | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | notificationType= | 
					
						
							|  |  |  | if [ -f /usr/bin/notify-send ]; then | 
					
						
							|  |  |  |     notificationType='notify-send' | 
					
						
							|  |  |  | else | 
					
						
							|  |  |  |     if [ -f /usr/bin/zenity ]; then | 
					
						
							| 
									
										
										
										
											2021-03-16 10:42:40 +00:00
										 |  |  |         notificationType='zenity' | 
					
						
							| 
									
										
										
										
											2021-03-13 15:15:32 +00:00
										 |  |  |     fi | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | if [[ ! "$notificationType" ]]; then | 
					
						
							| 
									
										
										
										
											2021-03-13 15:19:54 +00:00
										 |  |  |     zenity --warning --width=400 --text "No desktop notification command was found." | 
					
						
							| 
									
										
										
										
											2021-03-13 15:15:32 +00:00
										 |  |  |     exit 5 | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-16 11:04:44 +00:00
										 |  |  | if [ ! -d ${HOME}/.gnupg ]; then | 
					
						
							|  |  |  |     echo 'Generating GPG key' | 
					
						
							|  |  |  |     gpg --quick-generate-key "${HANDLE}" ed25519 cert | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-16 22:07:36 +00:00
										 |  |  | #{ echo '[Unit]'; | 
					
						
							|  |  |  | #  echo 'Description=Epicyon Desktop Notifications'; | 
					
						
							|  |  |  | #  echo ''; | 
					
						
							|  |  |  | #  echo '[Service]'; | 
					
						
							|  |  |  | #  echo "WorkingDirectory=${HOME}/.epicyon"; | 
					
						
							|  |  |  | #  echo "ExecStart=/usr/bin/python3 epicyon.py --noKeyPress --notifyType $notificationType --notify $HANDLE --password \"$PASSWORD\""; | 
					
						
							|  |  |  | #  echo 'Type=oneshot'; | 
					
						
							|  |  |  | #  echo 'RemainAfterExit=yes'; | 
					
						
							|  |  |  | #  echo ''; | 
					
						
							|  |  |  | #  echo '[Install]'; | 
					
						
							|  |  |  | #  echo 'WantedBy=default.target'; } > "${HOME}/.config/systemd/user/epicyon-notifications.service" | 
					
						
							|  |  |  | #systemctl --user daemon-reload | 
					
						
							|  |  |  | #systemctl --user stop epicyon-notifications.service & | 
					
						
							|  |  |  | #systemctl --user disable epicyon-notifications.service | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | { echo '#!/bin/bash'; | 
					
						
							|  |  |  |   echo 'cd ~/.epicyon'; | 
					
						
							| 
									
										
										
										
											2021-03-16 22:18:44 +00:00
										 |  |  |   echo "if [ \"\$1\" ]; then"; | 
					
						
							|  |  |  |   echo "    PASSWORD=\"\$1\""; | 
					
						
							|  |  |  |   echo 'else'; | 
					
						
							|  |  |  |   echo "    PASSWORD=\$(zenity --width=400 --password --title \"Epicyon Desktop Client\")"; | 
					
						
							|  |  |  |   echo "    if [ ! \"\$PASSWORD\" ]; then"; | 
					
						
							|  |  |  |   echo "        zenity --warning --width=400 --text \"No password was given\""; | 
					
						
							|  |  |  |   echo '        exit 3'; | 
					
						
							|  |  |  |   echo '    fi';   | 
					
						
							|  |  |  |   echo 'fi'; | 
					
						
							| 
									
										
										
										
											2021-03-16 22:14:03 +00:00
										 |  |  |   echo "python3 epicyon.py --desktop ${HANDLE} --password \"\$PASSWORD\""; } > ~/epicyon-client | 
					
						
							| 
									
										
										
										
											2021-03-16 22:07:36 +00:00
										 |  |  | chmod +x ~/epicyon-client | 
					
						
							| 
									
										
										
										
											2021-03-13 15:15:32 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-16 22:23:31 +00:00
										 |  |  | # TTS version | 
					
						
							|  |  |  | cp ~/epicyon-client ~/epicyon-client-tts | 
					
						
							|  |  |  | chmod +x ~/epicyon-client-tts | 
					
						
							|  |  |  | sed -i 's|epicyon.py|epicyon.py --screenreader espeak|g' ~/epicyon-client-tts | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-16 22:32:19 +00:00
										 |  |  | # TTS version with picospeaker | 
					
						
							| 
									
										
										
										
											2021-03-16 22:23:31 +00:00
										 |  |  | cp ~/epicyon-client ~/epicyon-client-pico | 
					
						
							|  |  |  | chmod +x ~/epicyon-client-pico | 
					
						
							|  |  |  | sed -i 's|epicyon.py|epicyon.py --screenreader picospeaker|g' ~/epicyon-client-pico | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-06-29 22:00:24 +00:00
										 |  |  | # TTS version with mimic3 | 
					
						
							|  |  |  | cp ~/epicyon-client ~/epicyon-client-mimic3 | 
					
						
							|  |  |  | chmod +x ~/epicyon-client-mimic3 | 
					
						
							|  |  |  | sed -i 's|epicyon.py|epicyon.py --screenreader mimic3|g' ~/epicyon-client-mimic3 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-16 22:32:19 +00:00
										 |  |  | # TTS stream | 
					
						
							| 
									
										
										
										
											2021-03-16 22:33:19 +00:00
										 |  |  | cp ~/epicyon-client ~/epicyon-client-stream | 
					
						
							|  |  |  | chmod +x ~/epicyon-client-stream | 
					
						
							| 
									
										
										
										
											2021-03-16 22:32:19 +00:00
										 |  |  | sed -i 's|epicyon.py|epicyon.py --notifyShowNewPosts --screenreader espeak|g' ~/epicyon-client-stream | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-06-29 22:00:24 +00:00
										 |  |  | # TTS stream | 
					
						
							|  |  |  | cp ~/epicyon-client ~/epicyon-stream-pico | 
					
						
							|  |  |  | chmod +x ~/epicyon-stream-pico | 
					
						
							|  |  |  | sed -i 's|epicyon.py|epicyon.py --notifyShowNewPosts --screenreader picospeaker|g' ~/epicyon-stream-pico | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # TTS stream | 
					
						
							|  |  |  | cp ~/epicyon-client ~/epicyon-stream-mimic3 | 
					
						
							|  |  |  | chmod +x ~/epicyon-stream-mimic3 | 
					
						
							|  |  |  | sed -i 's|epicyon.py|epicyon.py --notifyShowNewPosts --screenreader mimic3|g' ~/epicyon-stream-mimic3 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-16 22:07:36 +00:00
										 |  |  | zenity --info --width=400 --text "Epicyon desktop client is now installed. You can run it with ~/epicyon-client" |