# 2. copy this linuxconf dir, please it somewhere. (put a linuxconf wrapper script in this dir? automatically install linuxconf from githubi (pkg manager if available) if not installed, then run real linuxconf.)
# 2. download this directory from somewhere
# 3. ./linuxconf register .
# 3. ./linuxconf.wrapper register ./masterconf.sh
# > check if linuxconf installed, install it if not.
# > linuxconf would be downloaded & installed automatically. lc_init() will happen right now.
# > create / overwrite config file in /etc/linuxconf.conf, just 1 line: `root=/path/to/...`
# don't touch it if already have correct content, report error if need update & no permission
# > conf.d/basic.sh should install pkgs, (possibly) create new user, (possibly) run `linuxconf register .` again with new user.
#
# order by filename
# order by filename
lc_include conf.d/*
lc_include conf.d/*
# If you have multiple user.. You might need this in your config file.
# If you have multiple user but this file is for a specific user...
lc_assert_user_is root
lc_assert_user_is root
lc_assert_user_is_not root
# lc_assert_user_is_not root
# I strongly suggest u design lc_init() as an idempotent operation. Just in case u accidentally run `linuxconf register` elsewhere.
# I strongly suggest u design lc_init() as an idempotent operation. Just in case u accidentally run `linuxconf register` elsewhere.
lc_init (){
lc_init (){
# as root / as user?
# Some helpful functions.. To stop running current script:
# Some helpful functions.. To stop running current script:
[-f /usr/bin/apt ]|| die "This is not even ubuntu. Stop!"
[-f /usr/bin/apt ]||lc_die "This is not even ubuntu. Stop!"
# To print an error message:
# To print an error message:
apt install some_package || err "Failed to install my favorite pkg!"
apt install some_package || lc_err "Failed to install my favorite pkg!"
gsettings set var=123
}
}
lc_startup (){
lc_startup (){
# as root / as user?
sysctl kernel.sysrq=1
# You want desktop env? Use lc_login()
# want some daemon in background? Note: linuxconf dir is always your workdir.
# want some daemon in background?
lc_bgrun /tmp/server.log my_server --arg1 123 --arg2"hello world !"
lc_bgrun /tmp/server.log my_server --arg1 123 --arg2"hello world !"
# Guaranteed! linuxconf dir is your current workdir.