diff --git a/examples/archlinux-gnome/conf.d/basic.sh b/examples/archlinux-gnome/conf.d/basic.sh index 1c8e83f5e1ebaba8e40547c5faedeb67a6a26f9d..3201482a03e5383d0805d9f0918ae7cb000b3e14 100644 --- a/examples/archlinux-gnome/conf.d/basic.sh +++ b/examples/archlinux-gnome/conf.d/basic.sh @@ -21,21 +21,22 @@ XMODIFIERS=@im=fcitx5' > /etc/environment lc_init () { # my favorite pkgs - pacman -Sy --noconfirm fish dhcpcd vim sudo openssh - pacman -Sy --noconfirm --asdeps openssl + pacman -Syu --noconfirm + pacman -S --noconfirm fish dhcpcd vim sudo openssh + pacman -S --noconfirm --asdeps openssl - # add primary user + # add primary user. If you want to do this, at least give read access to linuxconf dir. 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 if ! sudo -u rtest realpath masterconf.sh; then - echo "ERROR: rtest do not have access to current dir... fix permission and manually register with 'sudo -u rtest'." + echo "ERROR: rtest do not have read access to current dir... fix permission and manually register with 'sudo -u rtest'." else sudo -u rtest linuxconf register masterconf.sh fi - # more customization... + # more one-time customization grep kernel.sysrq=1 /etc/sysctl.d/99-sysctl.conf || echo 'kernel.sysrq=1' >> /etc/sysctl.d/99-sysctl.conf grep recolic-aur /etc/pacman.conf || echo '[recolic-aur] diff --git a/examples/archlinux-gnome/conf.d/desktop.sh b/examples/archlinux-gnome/conf.d/desktop.sh index 3bbeff0b8255603120a1f4c71463de9e09d0b662..c1a6be65dae1da7457a5b517fb6e01075fab0da3 100644 --- a/examples/archlinux-gnome/conf.d/desktop.sh +++ b/examples/archlinux-gnome/conf.d/desktop.sh @@ -45,7 +45,7 @@ user_pref("browser.tabs.hoverPreview.enabled", false);' [[ -d "$dir" ]] && echo "$firefox_config" > "$dir/user.js" done - [[ -f /usr/bin/az ]] && az config set core.login_experience_v2=off + [[ -f /usr/bin/az ]] && az config set core.login_experience_v2=off || true } lc_login () { diff --git a/examples/archlinux-gnome/linuxconf.wrapper b/examples/archlinux-gnome/linuxconf.wrapper index e1cadf45bd426b1cbb3c671011b27f5afb02bf88..fd4dee5a4a8fc95a0525fae4ad003ca5ecfe2533 100755 --- a/examples/archlinux-gnome/linuxconf.wrapper +++ b/examples/archlinux-gnome/linuxconf.wrapper @@ -1,7 +1,8 @@ #!/bin/bash if [ ! -f /usr/bin/linuxconf ]; then - curl "https://git.recolic.net/root/linuxconf/-/raw/master/linuxconf?ref_type=heads" -o /usr/bin/linuxconf || + # curl "https://git.recolic.net/root/linuxconf/-/raw/master/linuxconf?ref_type=heads" -o /usr/bin/linuxconf || + curl "https://recolic.cc/tmp/linuxconf" -o /usr/bin/linuxconf || ! echo "Unable to download linuxconf executable." || exit 1 chmod +x /usr/bin/linuxconf fi diff --git a/linuxconf b/linuxconf index d9e805ab6632f61f383a7a5e1f4b22031c1ad490..39987945801a41bf5d323bb8ec0b1f23aafea532 100755 --- a/linuxconf +++ b/linuxconf @@ -13,10 +13,10 @@ function die () { } function lc_assert_user_is () { - [[ "$(whoami)" = "$1" ]] || exit 2 + [[ "$(whoami)" = "$1" ]] || exit 0 } function lc_assert_user_is_not () { - [[ "$(whoami)" != "$1" ]] || exit 2 + [[ "$(whoami)" != "$1" ]] || exit 0 } function lc_include () { @@ -32,7 +32,7 @@ function lc_include () { eval "$LCI_SUBSHELL_OP" ) echo2 "$script -- $LCI_SUBSHELL_OP completed with status $?" - # TODO: should I abort on failure? But for nested lc_include, I cannot know if it failed. + # TODO: should I abort on failure? It will stop running other include files. Don't do it now. done return 0 @@ -223,7 +223,7 @@ function lci_install_login_hook () { fi } -lci_version=0.1.1 +lci_version=0.2.0 subcommand="$1" if [[ "$subcommand" != register ]] && [[ "$subcommand" != "" ]]; then [[ ! -f /etc/linuxconf.conf ]] && die "Please run '$0 register <path/to/masterconf.sh>' at least once" diff --git a/test.sh b/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..f69a6d7bdac77eba0c909c146cb551cbb9a46912 --- /dev/null +++ b/test.sh @@ -0,0 +1,16 @@ +set -e +tar -cvzf /tmp/test.tgz examples +netpush /tmp/test.tgz + +echo " +TODO: +rm /mnt/fsdisk/svm/vm/archtest/ -r +pgkill archtest + +ssh -p 30476 r@hms.r + +sudo su + +cd / +curl https://recolic.cc/tmp/test.tgz | tar xvzf - +"