OSDN Git Service

Moved chroot commands to customize_airootfs
authorhayao <shun819.mail@gmail.com>
Tue, 22 Sep 2020 04:41:58 +0000 (13:41 +0900)
committerhayao <shun819.mail@gmail.com>
Tue, 22 Sep 2020 04:41:58 +0000 (13:41 +0900)
channels/share/airootfs/root/customize_airootfs.sh
lfbs

index 792244d..c76107c 100755 (executable)
@@ -12,14 +12,14 @@ export PATH=$PATH:/usr/sbin
 # Creating a root user.
 # usermod -s /usr/bin/zsh root
 function user_check () {
-if [[ $(getent passwd $1 > /dev/null ; printf $?) = 0 ]]; then
-    if [[ -z $1 ]]; then
+    if [[ $(getent passwd $1 > /dev/null ; printf $?) = 0 ]]; then
+        if [[ -z $1 ]]; then
+            echo -n "false"
+        fi
+        echo -n "true"
+    else
         echo -n "false"
     fi
-    echo -n "true"
-else
-    echo -n "false"
-fi
 }
 
 # Parse arguments
@@ -42,9 +42,12 @@ while getopts 'p:bt:k:rxu:o:i:s:da:g:z:l:' arg; do
         l) language="${OPTARG}" ;;
     esac
 done
-root_passwd=${password}
+
+
+root_passwd="${password}"
 #usermod -s "${usershell}" root
 cp -aT /etc/skel/ /root/
+
 # Allow sudo group to run sudo
 sed -i 's/^#\s*\(%sudo\s\+ALL=(ALL)\s\+ALL\)/\1/' /etc/sudoers
 
@@ -88,13 +91,13 @@ create_user "${username}" "${password}"
 
 # Enable and generate languages.
 echo "LANG=${localegen}" > /etc/locale.conf
-# Setting the time zone.
 
-ln -sf /usr/share/zoneinfo/${timezone} /etc/localtime
+# Setting the time zone.
+ln -sf "/usr/share/zoneinfo/${timezone}" "/etc/localtime"
 
 # Set up auto login
-if [[ -f /etc/systemd/system/getty@tty1.service.d/override.conf ]]; then
-    sed -i s/%USERNAME%/"${username}"/g /etc/systemd/system/getty@tty1.service.d/override.conf
+if [[ -f "/etc/systemd/system/getty@tty1.service.d/override.conf" ]]; then
+    sed -i s/%USERNAME%/"${username}"/g "/etc/systemd/system/getty@tty1.service.d/override.conf"
 fi
 
 # Set to execute calamares without password as alter user.
@@ -115,3 +118,7 @@ chmod +x "/etc/profile.d/alias_systemctl_setup.sh"
 # Chnage sudoers permission
 chmod 750 -R /etc/sudoers.d/
 chown root:root -R /etc/sudoers.d/
+
+echo "LANG=${locale_gen_name}" > "/etc/locale.conf"
+truncate -s 0 /etc/machine-id
+passwd -u -f root
\ No newline at end of file
diff --git a/lfbs b/lfbs
index ab3fa72..4dafe66 100755 (executable)
--- a/lfbs
+++ b/lfbs
@@ -374,7 +374,6 @@ make_cp_airootfs() {
 }
 
 make_config() {
-
     # customize_airootfs options
     # -b                        : Enable boot splash.
     # -d                        : Enable debug mode.
@@ -405,11 +404,6 @@ make_config() {
     }
 
     _run_script "/root/customize_airootfs.sh" "/root/customize_airootfs_${channel_name}.sh"
-
-    run_cmd ln -sf /usr/share/zoneinfo/${locale_time} /etc/localtime
-    echo "LANG=${locale_gen_name}" > "${work_dir}/airootfs/etc/locale.conf"
-    run_cmd truncate -s 0 /etc/machine-id
-    run_cmd passwd -u -f root
 }
 
 make_clean() {