From c79b002155ca7b6e31e6041b0ae4ec0debfc06c8 Mon Sep 17 00:00:00 2001 From: Kohei Watanabe Date: Tue, 14 Jun 2022 00:34:22 +0900 Subject: [PATCH] create desktop addon --- .gitignore | 2 +- README.md | 12 ++++++ .../apt/keyrings/google-archive-keyring.gpg | Bin .../keyrings/microsoft-archive-keyring.gpg | Bin .../apt/keyrings/slack-archive-keyring.gpg | Bin .../etc/apt/sources.list.d/google-chrome.list | 0 .../etc/apt/sources.list.d/slack.list | 0 .../etc/apt/sources.list.d/vscode.list | 0 desktop/etc/default/google-chrome | 2 + desktop/etc/default/slack | 2 + desktop/install | 7 ++++ desktop/packages.bash | 9 +++++ .../{cloudflared.list => cloudflare.list} | 0 .../sources.list.d/docker-compose-plugin.list | 1 - .../{docker-ce.list => docker.list} | 0 .../{nodejs.list => nodesource.list} | 0 install | 38 ++---------------- mod.bash | 37 +++++++++++++++++ packages.bash | 19 +++++++++ 19 files changed, 93 insertions(+), 36 deletions(-) rename {etc => desktop/etc}/apt/keyrings/google-archive-keyring.gpg (100%) rename {etc => desktop/etc}/apt/keyrings/microsoft-archive-keyring.gpg (100%) rename {etc => desktop/etc}/apt/keyrings/slack-archive-keyring.gpg (100%) rename etc/apt/sources.list.d/google-chrome-stable.list => desktop/etc/apt/sources.list.d/google-chrome.list (100%) rename etc/apt/sources.list.d/slack-desktop.list => desktop/etc/apt/sources.list.d/slack.list (100%) rename etc/apt/sources.list.d/code.list => desktop/etc/apt/sources.list.d/vscode.list (100%) create mode 100644 desktop/etc/default/google-chrome create mode 100644 desktop/etc/default/slack create mode 100755 desktop/install create mode 100644 desktop/packages.bash rename etc/apt/sources.list.d/{cloudflared.list => cloudflare.list} (100%) delete mode 100644 etc/apt/sources.list.d/docker-compose-plugin.list rename etc/apt/sources.list.d/{docker-ce.list => docker.list} (100%) rename etc/apt/sources.list.d/{nodejs.list => nodesource.list} (100%) create mode 100644 mod.bash create mode 100644 packages.bash diff --git a/.gitignore b/.gitignore index 72e8ffc..8d98f9d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -* +.* diff --git a/README.md b/README.md index f4f98da..3fa0481 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,15 @@ ```sh ./install ``` + +## Installing Packages + +```sh +sudo ./install +``` + +or + +```sh +sudo ./install desktop +``` diff --git a/etc/apt/keyrings/google-archive-keyring.gpg b/desktop/etc/apt/keyrings/google-archive-keyring.gpg similarity index 100% rename from etc/apt/keyrings/google-archive-keyring.gpg rename to desktop/etc/apt/keyrings/google-archive-keyring.gpg diff --git a/etc/apt/keyrings/microsoft-archive-keyring.gpg b/desktop/etc/apt/keyrings/microsoft-archive-keyring.gpg similarity index 100% rename from etc/apt/keyrings/microsoft-archive-keyring.gpg rename to desktop/etc/apt/keyrings/microsoft-archive-keyring.gpg diff --git a/etc/apt/keyrings/slack-archive-keyring.gpg b/desktop/etc/apt/keyrings/slack-archive-keyring.gpg similarity index 100% rename from etc/apt/keyrings/slack-archive-keyring.gpg rename to desktop/etc/apt/keyrings/slack-archive-keyring.gpg diff --git a/etc/apt/sources.list.d/google-chrome-stable.list b/desktop/etc/apt/sources.list.d/google-chrome.list similarity index 100% rename from etc/apt/sources.list.d/google-chrome-stable.list rename to desktop/etc/apt/sources.list.d/google-chrome.list diff --git a/etc/apt/sources.list.d/slack-desktop.list b/desktop/etc/apt/sources.list.d/slack.list similarity index 100% rename from etc/apt/sources.list.d/slack-desktop.list rename to desktop/etc/apt/sources.list.d/slack.list diff --git a/etc/apt/sources.list.d/code.list b/desktop/etc/apt/sources.list.d/vscode.list similarity index 100% rename from etc/apt/sources.list.d/code.list rename to desktop/etc/apt/sources.list.d/vscode.list diff --git a/desktop/etc/default/google-chrome b/desktop/etc/default/google-chrome new file mode 100644 index 0000000..1f713d8 --- /dev/null +++ b/desktop/etc/default/google-chrome @@ -0,0 +1,2 @@ +repo_add_once="false" +repo_reenable_on_distupgrade="false" diff --git a/desktop/etc/default/slack b/desktop/etc/default/slack new file mode 100644 index 0000000..1f713d8 --- /dev/null +++ b/desktop/etc/default/slack @@ -0,0 +1,2 @@ +repo_add_once="false" +repo_reenable_on_distupgrade="false" diff --git a/desktop/install b/desktop/install new file mode 100755 index 0000000..202b11b --- /dev/null +++ b/desktop/install @@ -0,0 +1,7 @@ +#!/bin/bash +set -euo pipefail +cd -- "$(dirname -- "$0")" +. ../mod.bash +(($(id -u) == 0)) \ + && [[ -f /etc/debian_version ]] \ + && install_apt_packages diff --git a/desktop/packages.bash b/desktop/packages.bash new file mode 100644 index 0000000..45f3ae3 --- /dev/null +++ b/desktop/packages.bash @@ -0,0 +1,9 @@ +packages=( +birdtray +code +deja-dup +easytag +google-chrome-stable +mozc-utils-gui +slack-desktop +) diff --git a/etc/apt/sources.list.d/cloudflared.list b/etc/apt/sources.list.d/cloudflare.list similarity index 100% rename from etc/apt/sources.list.d/cloudflared.list rename to etc/apt/sources.list.d/cloudflare.list diff --git a/etc/apt/sources.list.d/docker-compose-plugin.list b/etc/apt/sources.list.d/docker-compose-plugin.list deleted file mode 100644 index a004ed2..0000000 --- a/etc/apt/sources.list.d/docker-compose-plugin.list +++ /dev/null @@ -1 +0,0 @@ -# docker-ce.list diff --git a/etc/apt/sources.list.d/docker-ce.list b/etc/apt/sources.list.d/docker.list similarity index 100% rename from etc/apt/sources.list.d/docker-ce.list rename to etc/apt/sources.list.d/docker.list diff --git a/etc/apt/sources.list.d/nodejs.list b/etc/apt/sources.list.d/nodesource.list similarity index 100% rename from etc/apt/sources.list.d/nodejs.list rename to etc/apt/sources.list.d/nodesource.list diff --git a/install b/install index fba6990..b738198 100755 --- a/install +++ b/install @@ -1,39 +1,9 @@ #!/bin/bash set -euo pipefail cd -- "$(dirname -- "$0")" - -function install_dotfiles() { - local home - local dotfile - home=$(eval echo ~"${SUDO_USER:-}") - for dotfile in .*; do - [[ $dotfile =~ ^(\.\.?|\.git)$ ]] && continue - - dotfile=$(realpath "$dotfile") - ( - cd -- "$home" - ln -svf "$dotfile" . - ) - done -} - -function install_apt_packages() { - local packages - local package - packages=() - for package in etc/apt/sources.list.d/*.list; do - package=${package##*/} - package=${package%.list} - packages+=("$package") - done - - rsync -rv etc/apt/keyrings/ /usr/share/keyrings/ - rsync -rv etc/apt/sources.list.d/ /etc/apt/sources.list.d/ - apt update - apt install -y "${packages[@]}" -} - -install_dotfiles +. mod.bash (($(id -u) == 0)) \ - && [[ -d /etc/apt/sources.list.d ]] \ + && [[ -f /etc/debian_version ]] \ && install_apt_packages +install_dotfiles +install_addons "$@" diff --git a/mod.bash b/mod.bash new file mode 100644 index 0000000..eb19fcc --- /dev/null +++ b/mod.bash @@ -0,0 +1,37 @@ +function install_apt_packages() { + local packages + local apt_sources_dir + . packages.bash + eval "$(apt-config shell apt_sources_dir 'Dir::Etc::sourceparts/d')" + rsync -rv etc/apt/keyrings/ /usr/share/keyrings/ + rsync -rv etc/apt/sources.list.d/ "$apt_sources_dir" + [[ -d etc/default ]] \ + && rsync -rv etc/default/ /etc/default/ + apt update + apt install -y "${packages[@]}" +} + +function install_dotfiles() { + local home + local dotfile + home=$(eval "echo ~${SUDO_USER:-}") + for dotfile in .*; do + [[ $dotfile =~ ^(\.\.?|\.git)$ ]] && continue + + dotfile=$(realpath "$dotfile") + ( + cd -- "$home" + ln -svf "$dotfile" . + ) + done +} + +function install_addons() { + local addon + for addon in "$@"; do + ( + cd -- "$addon" + ./install + ) + done +} diff --git a/packages.bash b/packages.bash new file mode 100644 index 0000000..e0f176c --- /dev/null +++ b/packages.bash @@ -0,0 +1,19 @@ +packages=( +cloudflared +docker-ce +docker-compose-plugin +nodejs +tailscale +build-essential +curl +fdupes +ffmpeg +imagemagick +knot-dnsutils +qemu-user-static +screen +smartmontools +) + +[[ "$(df --output=fstype . | sed 1d)" == "btrfs" ]] \ + && packages+=(snapper)