feat(install): Use flatpack to install certail GUI apps that require

frequent updates
fix(install): Manual app installs that aren't available elsewhere
This commit is contained in:
Pratik Tripathy
2024-09-15 16:19:44 +05:30
parent fad4b8500a
commit cf28453bef
8 changed files with 186 additions and 31 deletions

View File

@@ -10,8 +10,10 @@ input_file_check() {
}
install_brew() {
if ! command -v brew > /dev/null 2>&1; then
yes | bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
fi
# Required for installing fonts
brew tap homebrew/linux-fonts
@@ -30,7 +32,7 @@ install_brew_packages() {
esac
# Check if the package exists in the Homebrew repository
if brew search "$brew_package" | grep -q "^$brew_package\$"; then
if brew search "$brew_package" 2> /dev/null | grep -q "$brew_package"; then
echo "Available: $brew_package"
found_packages="$found_packages $brew_package"
else
@@ -39,15 +41,18 @@ install_brew_packages() {
fi
done < "$BREW_PACKAGE_FILE"
brew install $found_packages
# Install available brew packages
if ! brew install $found_packages; then
exit 1
fi
}
print_summary() {
# Print the list of packages that were not found
echo
if [ -n "$2" ]; then
echo "The following $1 packages were not found in the repository:"
echo "$2"
echo
echo "The following $1 packages were not found in the repository:" | tee -a "$INSTALL_LOG_FILE"
echo "$2" | tee -a "$INSTALL_LOG_FILE"
fi
}

View File

@@ -0,0 +1,60 @@
#!/usr/bin/env sh
FLATPAK_PACKAGE_FILE=package-list-flatpak
input_file_check() {
if [ ! -f "$FLATPAK_PACKAGE_FILE" ]; then
echo "File not found: $FLATPAK_PACKAGE_FILE"
exit 1
fi
}
setup_flatpak() {
sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo && echo "Flathub added to Flatpak"
}
# Install packages listed on "flatpak-package-list" file
install_flatpak_packages() {
not_found_packages=""
found_packages=""
# Read the package names from the file
while IFS= read -r flatpak_package; do
# Skip lines that start with #
case "$flatpak_package" in
\#*) continue ;;
esac
# Check if the package exists in the flatpak repository
if flatpak search --columns=application "$flatpak_package" 2> /dev/null | grep -q "^$flatpak_package\$"; then
echo "Available: $flatpak_package"
found_packages="$found_packages $flatpak_package"
else
not_found_packages="$not_found_packages $flatpak_package"
echo "Unavailable: $flatpak_package"
fi
done < "$FLATPAK_PACKAGE_FILE"
# Install available flatpak packages
if ! flatpak install -y --noninteractive $found_packages; then
exit 1
fi
}
print_summary() {
# Print the list of packages that were not found
if [ -n "$2" ]; then
echo
echo "The following $1 packages were not found in the repository:" | tee -a "$INSTALL_LOG_FILE"
echo "$2" | tee -a "$INSTALL_LOG_FILE"
fi
}
main() {
input_file_check
setup_flatpak
install_flatpak_packages
print_summary "flatpak" "$not_found_packages"
}
main "$@"

View File

@@ -8,18 +8,15 @@ setup() {
# Detect package manager and set package manager commands
if command -v apt-get > /dev/null 2>&1; then
OS_INSTALL_COMMAND="apt-get"
OS_INSTALL_COMMAND="apt-get install -y"
OS_PKG_CHECK_COMMAND="apt-cache show"
apt_setup
elif command -v dnf > /dev/null 2>&1; then
OS_INSTALL_COMMAND="dnf"
OS_INSTALL_COMMAND="dnf install -y --allowerasing --skip-broken"
OS_PKG_CHECK_COMMAND="dnf list available"
dnf_setup
elif command -v yum > /dev/null 2>&1; then
OS_INSTALL_COMMAND="yum"
OS_PKG_CHECK_COMMAND="yum list available"
else
log "Unsupported package manager. This script supports apt, yum, and dnf."
exit 1
@@ -34,14 +31,14 @@ dnf_setup() {
echo "keepcache=True" | sudo tee -a /etc/dnf/dnf.conf > /dev/null
# Enable RPM Fusion & Install media codecs
sudo dnf install -y https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm && sudo dnf groupupdate -y core multimedia --setop="install_weak_deps=False" --exclude=PackageKit-gstreamer-plugin sound-and-video
sudo dnf update -y
sudo dnf install -y https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-"$(rpm -E %fedora)".noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-"$(rpm -E %fedora)".noarch.rpm && sudo dnf groupupdate -y core multimedia --setop="install_weak_deps=False" --exclude=PackageKit-gstreamer-plugin sound-and-video
}
apt_setup() {
sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get install -y apt-transport-https
# Add PPAs here
# TODO: Enable non-free software in /etc/apt/sources.list
# Add "back-ports" in /etc/apt/sources.list
# Check how it affects Ubuntu
sudo apt-get update && sudo apt-get upgrade -y
}
input_file_check() {
@@ -66,7 +63,7 @@ install_os_packages() {
esac
# Check if the package exists in the APT repository
if eval "$OS_PKG_CHECK_COMMAND" "$os_package" > /dev/null 2>&1; then
if eval "$OS_PKG_CHECK_COMMAND" "$os_package" 2> /dev/null | grep -q "$os_package"; then
echo "Available: $os_package"
os_found_packages="$os_found_packages $os_package"
else
@@ -75,15 +72,18 @@ install_os_packages() {
fi
done < "$OS_PACKAGE_FILE"
eval sudo "$OS_INSTALL_COMMAND" install -y "$os_found_packages"
# Install available packages
if ! eval sudo "$OS_INSTALL_COMMAND" "$os_found_packages"; then
exit 1
fi
}
print_summary() {
# Print the list of packages that were not found
echo
if [ -n "$2" ]; then
echo "The following $1 packages were not found in the repository:"
echo "$2"
echo | tee -a "$INSTALL_LOG_FILE"
echo "The following $1 packages were not found in the repository:" | tee -a "$INSTALL_LOG_FILE"
echo "$2" | tee -a "$INSTALL_LOG_FILE"
fi
}

View File

@@ -1,12 +1,70 @@
#!/usr/bin/env sh
# TODO:
# - Needs manual installation: appimagelauncher, firefox, brave, vs-code, cursor, kitty, mattermost-desktop, skypedesktop, ulauncher, dotnet8, dotnet8-sdk8.0, aspnetcore-runtime-8.0, Jetbrains Toolbox, Obsidian, Postman, firefox, zen, zoho, zoho-workdrive, nala
# - Available on some, not on others; may need manual installation: libreoffice, sublime-text, kitty-terminfo, imagemagick
# All:
# - Jetbrains-Toolbox: https://www.jetbrains.com/toolbox-app/
# - Sublime-Text: https://www.sublimetext.com/docs/linux_repositories.html
# - Appimagelauncher: https://github.com/TheAssassin/AppImageLauncher/releases
# - Zoho Mail: https://downloads.zohocdn.com/zmail-desktop/linux/zoho-mail-desktop-lite-x64-v1.6.4.AppImage
# - Zoho Workdrive: https://files-accl.zohopublic.com/public/wdbin/download/2014030a29db316e9cedd501f32270e8
# - Cursor: https://downloader.cursor.sh/linux/appImage/x64
# Debian & Ubuntu:
# - Ulauncher: https://ulauncher.io/#Download
# Debian:
# - Dotnet8: https://learn.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#scripted-install
# Jetbrains: check if scriptfile not available (because we use flatpak) has any issued with ulauncher
kitty_term() {
curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin
mkdir -p ~/.local/bin && ln -sf ~/.local/kitty.app/bin/kitty ~/.local/kitty.app/bin/kitten ~/.local/bin/
mkdir -p ~/.local/share/applications && cp ~/.local/kitty.app/share/applications/kitty.desktop ~/.local/share/applications/
cp ~/.local/kitty.app/share/applications/kitty-open.desktop ~/.local/share/applications/
sed -i "s|Icon=kitty|Icon=$(readlink -f ~)/.local/kitty.app/share/icons/hicolor/256x256/apps/kitty.png|g" ~/.local/share/applications/kitty*.desktop
sed -i "s|Exec=kitty|Exec=$(readlink -f ~)/.local/kitty.app/bin/kitty|g" ~/.local/share/applications/kitty*.desktop
echo 'kitty.desktop' > ~/.config/xdg-terminals.list
}
manual_installs(){
kitty_term
}
post_install() {
chsh -s "$(which zsh)" && echo "Default shell changed to zsh"
# Time fix for Windows dual boot
timedatectl set-local-rtc 1 --adjust-system-clock && echo "Set Datetime"
# Use brew-installed fonts current user
if [ -d /home/linuxbrew/.linuxbrew/share/fonts ]; then
ln -s /home/linuxbrew/.linuxbrew/share/fonts -t ~/.local/share && fc-cache -fv
fi
rm -rf ~/.cache
}
pre_install() {
export INSTALL_LOG_FILE="$(basename "$0")_$(date +"%Y%m%d_%H%M%S")_log.txt"
echo "Use the following command to view the list of software that was NOT installed:"
echo "cat $PWD/$INSTALL_LOG_FILE"
echo
if [ -f ~/.profile ]; then
. ~/.profile
fi
}
main() {
pre_install
./install-os-packages.sh
./install-brew-packages.sh
./install-flatpak-packages.sh
manual_installs
post_install
cat "$INSTALL_LOG_FILE"
}
main "$@"

View File

@@ -1,4 +1,5 @@
# Lines that start with # are ignored
# TIP: Only add commandline apps that aren't available/updated on OS repos
bat
bats-core
dnscrypt-proxy
@@ -34,5 +35,6 @@ tlrc
tokei
tree-sitter
yt-dlp
zoxide
zsh-autosuggestions
zsh-syntax-highlighting

View File

@@ -0,0 +1,14 @@
# Lines that start with # are ignored
# TIP: Only add GUI apps that aren't available/updated on OS repos
com.brave.Browser
com.visualstudio.code
org.mozilla.firefox
org.libreoffice.libreoffice
com.mattermost.Desktop
md.obsidian.Obsidian
com.getpostman.Postman
com.jetbrains.Rider
#com.slack.Slack
com.skype.Client
dev.zed.zed
io.github.zen_browser.zen

View File

@@ -1,4 +1,14 @@
# Lines that start with # are ignored
# Below few are apt-only packages - non-free sources must be added before this
apt-transport-https
libavcodec-extra
nvidia-driver
synaptic
# Below few are dnf-only packages
akmod-nvidia
libva-nvidia-driver
xorg-x11-drv-nvidia-cuda
# Common
bash
bleachbit
build-essential
@@ -8,25 +18,32 @@ curl
evolution-ews
dolphin
dolphin-plugins
aspnetcore-runtime-8.0
dotnet-sdk-8.0
dotnet-runtime-8.0
ffmpeg
flameshot
flatpak
plasma-discover-backend-flatpak
gcc
gdb
git
gparted
gnupg
grub-customizer
htop
#imagemagick
kde-spectacle
kdeconnect
kitty
kitty-terminfo
libreoffice
llvm
make
nala
net-tools
okular
openssh-client
python3
python3-pip
qbittorrent
ripgrep
simplescreenrecorder
smplayer
@@ -35,7 +52,9 @@ solaar
syncthing
tmux
ufw
ulauncher
vim
vim-enhanced
vim-common
vim-tiny
vlc

View File

@@ -35,8 +35,6 @@ place_dotfile_at_target_location() {
}
parse_input() {
# TODO: Accept input to execute install.sh script
while [ "${#}" -gt 0 ]; do
case $1 in
-i | --install)
@@ -104,7 +102,6 @@ main() {
)/scripts"
setup_symlinks
echo "$install_file_location"
if [ "$INSTALL" = "y" ]; then
cd "$install_file_location" || exit