1
0
Fork 0
mirror of https://github.com/kou029w/dotfiles.git synced 2025-01-18 16:07:59 +00:00
dotfiles/desktop/install

54 lines
1.5 KiB
Bash
Executable file

#!/bin/bash
set -euo pipefail
cd -- "$(dirname -- "$0")"
. ../mod.bash
function install_gsettings() {
local uid
local gsettings_file
local gsettings_dir
uid=${SUDO_UID:-$(id -u)}
gsettings_file=$1
gsettings_dir=$2
sudo <"$gsettings_file" --user="#$uid" \
DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$uid/bus" \
dconf load "$gsettings_dir"
}
function install_source_han_mono_fonts() {
local uid
local home
local fonts_dir
local fontconfig_dir
uid=${SUDO_UID:-$(id -u)}
home=$(eval "echo ~${SUDO_USER:-}")
fonts_dir="$home/.local/share/fonts"
fontconfig_dir="$home/.config/fontconfig/conf.d"
sudo --user="#$uid" mkdir -p "$fonts_dir" "$fontconfig_dir"
sudo --user="#$uid" \
curl \
-fsSL https://github.com/adobe-fonts/source-han-mono/releases/download/1.002/SourceHanMono.ttc \
-o "$fonts_dir/SourceHanMono.ttc"
sudo --user="#$uid" \
rsync -rv fontconfig/ "$fontconfig_dir/"
fc-cache
}
function install_environment_d() {
local home
local environment_d
home=$(eval "echo ~${SUDO_USER:-}")
environment_d=$(realpath environment.d)
(
cd -- "${home}/.config" || exit 1
ln -svf "$environment_d" .
)
}
(($(id -u) == 0)) &&
[[ -f /etc/debian_version ]] &&
install_apt_packages
install_gsettings settings.ini /
install_gsettings terminal-settings.ini "/org/gnome/terminal/legacy/profiles:/:$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')/"
install_source_han_mono_fonts
install_environment_d