Skip to content

Instantly share code, notes, and snippets.

@Kabouik
Last active August 19, 2023 17:04
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kabouik/4ae6170f704d93e8803526df11c3fb57 to your computer and use it in GitHub Desktop.
Save Kabouik/4ae6170f704d93e8803526df11c3fb57 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# This script will install Cutie or Phosh on a device
# already running Droidian. This is an alternative to
# using one of the Cutie Droidian images that need to
# be flashed.
# Use at your own risk, odds are it will break things.
# Authors: Kabouik (@bouic), Erik (@eriki73)
# https://t.me/CutieShellProject
set -e
test $UID = 0 || printf "This script must be run as root.\n"
test $UID = 0
apt-get --version >/dev/null 2>&1
# List of required Cutie packages, as of May 2023
cutie_packages="cutie-shell \
cutie-shell-config-hybris \
cutie-shell-config-mobile \
cutie-keyboard-layouts \
cutie-keyboard-style \
cutie-atmospheres-default \
cutie-settings-daemon \
qml6-module-cutie \
cutie-settings \
cutie-music \
cutie-terminal \
cutie-messaging \
cutie-phone \
qt6-qpa-hwcomposer-plugin \
plymouth-theme-droidian \
qt6-wayland \
qtwayland5 \
cutie-camera \
qt5-cameraplugin-aal \
fonts-noto-color-emoji"
# Check which UI is currently in use
check() {
if [[ -f "/usr/lib/systemd/system/phosh.service" ]] \
|| [[ -f "/usr/lib/systemd/system/phosh-session.service" ]]; then
current="phosh"
elif [[ -f "/usr/lib/systemd/system/cutie-ui-io.service" ]]; then
current="cutie"
fi
}
# Toggle Cutie repository
cutie_repo() {
if [[ "$1" = "add" ]]; then
wget http://deb.cutie-shell.org/cutie.gpg -O /etc/apt/trusted.gpg.d/cutie.gpg \
|| printf "\nFailed to fetch Cutie repository?"
chmod 644 /etc/apt/trusted.gpg.d/cutie.gpg
echo "deb http://deb.cutie-shell.org/staging/ bookworm main" > \
/etc/apt/sources.list.d/cutie.list
apt-get update
elif [[ "$1" = "remove" ]]; then
rm -f /etc/apt/trusted.gpg.d/cutie.gpg
rm -f /etc/apt/sources.list.d/cutie.list
apt-get update
fi
}
# Install
cutie_install() {
apt-get install $cutie_packages -y || exit 1
mv -f /etc/systemd/system/android-service@hwcomposer.service.d/20-phosh.conf \
/etc/systemd/system/android-service@hwcomposer.service.d/20-phosh.conf.bak
printf "\nCutie successfully installed. Press Return to reboot. " && read _
reboot
}
phosh_install() {
phosh_packages="droidian-phosh-full \
phosh-config-hwcomposer"
apt-get remove $cutie_packages -y || err="No Cutie package to remove."
apt-get install $phosh_packages -y || exit 1
rm -f /etc/systemd/system/android-service@hwcomposer.service.d/20-cutie.conf
mv -f /etc/systemd/system/android-service@hwcomposer.service.d/20-phosh.conf.bak \
/etc/systemd/system/android-service@hwcomposer.service.d/20-phosh.conf
printf "\nPhosh successfully installed. Press Return to reboot. " && read _
reboot
}
# Main prompt
printf "This will install Phosh or Cutie on Droidian. They are mutually exclusive.\n
Do you want to install [c]utie, [p]hosh, or to [a]bort? " && read
case $REPLY in
"c" | "C")
check
if [[ "$current" = "phosh" ]]; then
cutie_repo "add"
cutie_install
elif [[ "$current" = "cutie" ]]; then
printf "\nCutie is already installed. Aborting.\n"
else
printf "\n[!] The current shell was not recognized, this script will not reinstall it afterwards.\nDo you still want to proceed with the Cutie installation? y/N " && read CONFIRM
if [[ "$CONFIRM" = "y" ]] || [[ "$CONFIRM" = "Y" ]]; then
cutie_repo "add"
cutie_install
else
printf "Aborting.\n"
fi
fi
;;
"p" | "P")
check
if [[ "$current" = "cutie" ]]; then
cutie_repo "remove"
phosh_install
elif [[ "$current" = "phosh" ]]; then
printf "\nPhosh is already installed. Aborting.\n"
else
printf "\n[!] The current shell was not recognized, this script will not reinstall it afterwards.\nDo you still want to proceed with the Phosh installation? y/N " && read CONFIRM
if [[ "$CONFIRM" = "y" ]] || [[ "$CONFIRM" = "Y" ]]; then
cutie_repo "remove"
phosh_install
else
printf "Aborting.\n"
fi
fi
;;
"a" | "A")
exit 0
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment