diff --git a/examples/README.md b/examples/README.md index fb7e7a2a74cdbda895b1d9d8fc249fb6a6690fa9..be74091f712b69f3616ed24af1346c590e08becd 100644 --- a/examples/README.md +++ b/examples/README.md @@ -3,5 +3,6 @@ |Example|Note| |---|---| |[template](template)|Complete documented empty config| -|[archlinux-gnome](archlinux-gnome)|An example config for archlinux and gnome| +|[archlinux-gnome](archlinux-gnome)|An example config with archlinux and gnome| +|[ubuntu-server](ubuntu-server)|An example config for someone's ubuntu server| diff --git a/examples/archlinux-gnome/conf.d/pkgs.sh b/examples/archlinux-gnome/conf.d/pkgs.sh new file mode 100644 index 0000000000000000000000000000000000000000..362c0ccda39dd076bfb7856dbba941012128d110 --- /dev/null +++ b/examples/archlinux-gnome/conf.d/pkgs.sh @@ -0,0 +1,17 @@ +lc_assert_user_is root + +lc_init () { + # my favorite package + pacman -Sy --noconfirm fish dhcpcd vim sudo openssh + pacman -Sy --noconfirm --asdeps openssl + + pacman -Sy --noconfirm gnome networkmanager power-profiles-daemon nextcloud-client firefox + + # add primary user + useradd --create-home --shell /usr/bin/fish rtest + echo 'rtest ALL=(ALL) NOPASSWD: ALL' | EDITOR='tee -a' visudo + usermod --password $(echo testpass | openssl passwd -1 -stdin) rtest + + systemctl enable gdm NetworkManager power-profiles-daemon +} + diff --git a/examples/archlinux-gnome/linuxconf.wrapper b/examples/archlinux-gnome/linuxconf.wrapper new file mode 100755 index 0000000000000000000000000000000000000000..dc8517c146d3db9bdb08d24793ced65482ebd809 --- /dev/null +++ b/examples/archlinux-gnome/linuxconf.wrapper @@ -0,0 +1,4 @@ +#!/bin/bash + +TODO: this is a wrapper. it should download & install real linuxconf binary. + diff --git a/examples/archlinux-gnome/masterconf.sh b/examples/archlinux-gnome/masterconf.sh new file mode 100644 index 0000000000000000000000000000000000000000..6e19c12f644559d71b3311ebea0ee552e11c4c74 --- /dev/null +++ b/examples/archlinux-gnome/masterconf.sh @@ -0,0 +1,34 @@ +# setup this linuxconf on fresh-installed archlinux + +lc_include conf.d/* + +lc_assert_user_is root + +# I strongly suggest u design lc_init() as an idempotent operation. Just in case u accidentally run `linuxconf register` elsewhere. +function lc_init () { + # as root / as user? + + # note: in demo, append /etc/profile for PATH +} + +function lc_startup () { + # as root / as user? + # with desktop env? (not supported yet) + +} + +function lc_login () { + # warning: less useful. happens again if user logout/login again. + # (no plan to support in first ver) + lc_login_is_x11? +} + +function lc_cron () { + # hourly / daily / weekly / monthly? + # as root / as user? + +} + +# Warning: watch out for unintended user +lc_fsmap files/vimrc $LC_USER_HOME/.vimrc + diff --git a/linuxconf b/linuxconf index da44f98c3cd355ec7900089c6f436024b70b95a4..7a7444369b6d1734e17d63cc283657047f5ad362 100755 --- a/linuxconf +++ b/linuxconf @@ -25,11 +25,12 @@ function lc_include () { # print the return code of the eval-ed function to stderr, but this function should always return success. for script in "$@"; do + echo2 "$script -- $LCI_SUBSHELL_OP started as $(whoami), at $(pwd)" ( source "$script" eval "$LCI_SUBSHELL_OP" ) - echo2 "$script -- $LCI_SUBSHELL_OP completed. return_val = $return_code" + echo2 "$script -- $LCI_SUBSHELL_OP completed with status $return_code" done return 0