11#! /usr/bin/env bash
22
3+ set -e
4+
5+ script_path=" $( cd -P " $( dirname " $( readlink -f " ${0} " ) " ) " && pwd ) "
6+ script_name=" $( basename " $( realpath " ${0} " ) " ) "
7+
38function remove () {
49 local list
510 local file
@@ -13,35 +18,61 @@ function remove () {
1318 done
1419}
1520
21+ function remove_user_file(){
22+ remove " /etc/skel/${@ } "
23+ remove " /home/${user} /${@ } "
24+ }
25+
1626while getopts ' u:' arg; do
1727 case " ${arg} " in
1828 u) user=" ${OPTARG} " ;;
1929 esac
2030done
2131
32+
33+ # Remove user files
2234remove /etc/skel/Desktop
23- remove /etc/skel/.config/gtk-3.0/bookmarks
24- remove /home/${user} /Desktop/calamares.desktop
25- remove /root/Desktop/calamares.desktop
26- remove /home/${user} /.config/gtk-3.0/bookmarks
2735remove /usr/share/calamares/
36+ remove_user_file " Desktop/calamares.desktop"
37+ remove_user_file " .config/gtk-3.0/bookmarks"
38+
2839
40+ # Remove polkit role
2941remove /etc/polkit-1/rules.d/01-nopasswork.rules
3042
43+
3144# Delete unnecessary files of archiso.
3245# See the following site for details.
3346# https://wiki.archlinux.jp/index.php/Archiso#Chroot_.E3.81.A8.E3.83.99.E3.83.BC.E3.82.B9.E3.82.B7.E3.82.B9.E3.83.86.E3.83.A0.E3.81.AE.E8.A8.AD.E5.AE.9A
34-
3547remove /etc/systemd/system/
[email protected] /autologin.conf
3648remove /root/.automated_script.sh
3749remove /etc/mkinitcpio-archiso.conf
3850remove /etc/initcpio
51+ remove /boot/archiso.img
52+ remove /etc/systemd/system/etc-pacman.d-gnupg.mount
53+ remove /etc/systemd/journald.conf.d/volatile-storage.conf
54+ remove /airootfs.any/etc/systemd/logind.conf.d/do-not-suspend.conf
55+
3956
40- if [[ -f " /etc/systemd/journald.conf" ]]; then
41- sed -i ' s/Storage=volatile/#Storage=volatile/g' " /etc/systemd/journald.conf"
57+ # Disabled auto login
58+ if [[ -f " /etc/gdm/custom.conf" ]]; then
59+ sed -i " s/Automatic*/#Automatic/g" " /etc/gdm/custom.conf"
60+ fi
61+ if [[ " /etc/lightdm/lightdm.conf" ]]; then
62+ sed -i " s/^autologin/#autologin/g" " /etc/lightdm/lightdm.conf"
4263fi
4364
4465
45- remove /etc/systemd/system/{choose-mirror.service,etc-pacman.d-gnupg.mount,
[email protected] }
66+ # Remove dconf for live environment
67+ remove " /etc/dconf/db/local.d/02-live-" *
4668
47- remove /boot/archiso.img
69+
70+ # Update system datebase
71+ dconf update
72+
73+ # 追加のスクリプトを実行
74+ if [[ -d " ${script_path} /${script_name} .d/" ]]; then
75+ for extra_script in " ${script_path} /${script_name} .d/" * ; do
76+ bash -c " ${extra_script} ${user} "
77+ done
78+ fi
0 commit comments