Skip to content

Commit

Permalink
2475 Refactor Debian Desktop apt script for enhanced structure and PO…
Browse files Browse the repository at this point in the history
…SIX compliance
  • Loading branch information
id774 committed Mar 23, 2024
1 parent 7ece68e commit 11182aa
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 80 deletions.
2 changes: 1 addition & 1 deletion installer/debian_apt.sh
Expand Up @@ -25,7 +25,7 @@
#
# Usage:
# Simply run the script with sufficient privileges (typically as root or via sudo):
# sudo ./bulk_apt_install.sh
# ./debian_apt.sh
# The script will perform an update, upgrade, and then proceed to install a pre-defined
# set of packages, grouped by categories such as basic tools, system utilities, development
# tools, editors, and more.
Expand Down
148 changes: 69 additions & 79 deletions installer/debian_desktop_apt.sh
@@ -1,121 +1,111 @@
#!/bin/sh
#

########################################################################
# Bulk Apt Install Script for Debian Desktop
# debian_desktop_apt.sh: Bulk Apt Install Script for Debian Desktop
#
# Maintainer: id774 <idnanashi@gmail.com>
# Description:
# This script automates the installation of various packages for a Debian
# desktop environment. It is designed to efficiently install a set of
# pre-defined packages, ensuring that only the necessary packages are
# installed and avoiding redundant installations.
#
# Author: id774 (More info: http://id774.net)
# Source Code: https://github.com/id774/scripts
# License: LGPLv3 (Details: https://www.gnu.org/licenses/lgpl-3.0.html)
# Contact: idnanashi@gmail.com
#
# Version History:
# v1.0 2024-03-23
# Refactored for improved structure and POSIX compliance.
# v0.1 2011-09-28
# Forked from Initial Setup Script.
#
# Usage:
# Run the script with sufficient privileges:
# ./debian_desktop_apt.sh
#
# Notes:
# - The script is designed for Debian-based desktop systems.
# - Internet connectivity is required for package downloads.
# - Review and modify the package lists as needed for your setup.
#
# Error Conditions:
# The script checks if each package is already installed to prevent unnecessary reinstallation.
# However, it does not explicitly handle errors such as package unavailability or network issues.
# These should be resolved based on the output of the apt-get command.
#
########################################################################

# System update and upgrade
apt_upgrade() {
sudo apt-get update &&
sudo apt-get -y upgrade &&
sudo apt-get autoclean &&
sudo apt-get -y autoremove
}

# Install package if not already installed
smart_apt() {
while [ $# -gt 0 ]
do
if [ `aptitude search $1 | awk '/^i/' | wc -l` = 0 ]; then
sudo apt-get -y install $1
for pkg do
if [ "$(dpkg-query -W -f='${Status}' "$pkg" 2>/dev/null | grep -c "ok installed")" -eq 0 ]; then
sudo apt-get -y install "$pkg"
fi
shift
done
}

desktop_envirionment() {
smart_apt \
xfwm4 xfwm4-themes \
xfce4-goodies \
xfce4-terminal \
gnome-themes gnome-themes-extras
# Desktop environment packages
desktop_environment() {
smart_apt xfwm4 xfwm4-themes xfce4-goodies xfce4-terminal gnome-themes gnome-themes-extras
}

# Font packages
fonts_packages() {
smart_apt \
xfonts-mplus \
xfonts-shinonome \
ttf-bitstream-vera \
fonts-vlgothic \
fonts-ipafont
smart_apt xfonts-mplus xfonts-shinonome ttf-bitstream-vera fonts-vlgothic fonts-ipafont
}

# Package manager tools
package_manager() {
smart_apt \
synaptic \
gdebi
smart_apt synaptic gdebi
}

# Multimedia codec packages
codec_packages() {
smart_apt \
gstreamer0.10-ffmpeg
smart_apt gstreamer0.10-ffmpeg
}

# Icon packages
icon_packages() {
smart_apt \
ubuntu-artwork xubuntu-artwork human-icon-theme
smart_apt ubuntu-artwork xubuntu-artwork human-icon-theme
}

# Configuration tools
gconf_packages() {
smart_apt \
gconf-editor \
dconf-tools \
gnome-tweak-tool
smart_apt gconf-editor dconf-tools gnome-tweak-tool
}

# Utility packages
utils_packages() {
smart_apt \
ranger \
caca-utils \
highlight \
atool \
w3m \
poppler-utils \
mediainfo
smart_apt ranger caca-utils highlight atool w3m poppler-utils mediainfo
}

# Optional packages
optional_packages() {
test -f /etc/lsb-release && smart_apt thunderbird \
thunderbird-locale-ja \
firefox \
firefox-locale-ja
test -f /etc/lsb-release || smart_apt icedove \
icedove-l10n-ja \
iceweasel \
iceweasel-l10n-ja
smart_apt \
fcitx-mozc \
emacs-mozc \
libreoffice \
vim-gnome \
gthumb \
thunar \
bittorrent-gui ktorrent qbittorrent \
vlc \
pidgin \
xpdf \
evince \
comix \
fbreader \
skype \
wireshark \
xtightvncviewer \
chromium \
chromium-l10n \
flashplugin-nonfree
smart_apt thunderbird thunderbird-locale-ja firefox firefox-locale-ja \
fcitx-mozc emacs-mozc libreoffice vim-gnome gthumb thunar bittorrent-gui ktorrent qbittorrent \
vlc pidgin xpdf evince comix fbreader wireshark xtightvncviewer chromium chromium-l10n
}

increase_debian_packages() {
desktop_envirionment
# Main operation
main() {
apt_upgrade
desktop_environment
fonts_packages
test -f /etc/lsb-release && package_manager
test -f /etc/lsb-release && codec_packages
test -f /etc/lsb-release && icon_packages
package_manager
codec_packages
icon_packages
gconf_packages
utils_packages
optional_packages
}

main() {
test -n "$SCRIPTS" || export SCRIPTS=$HOME/scripts
test -n "$PRIVATE" || export PRIVATE=$HOME/private/scripts
increase_debian_packages
}

main $*
main "$@"

0 comments on commit 11182aa

Please sign in to comment.