[Repository/Mirror] 關於nopasswdlogin、lightdm、installer、live-config等的建議
Tofloor
poster avatar
dreamcast
deepin
2024-04-19 20:35
Author

以下的建議帶有一定的主觀性,本來我不想給官方開發人員壓力或說三道四的,但由於臨近RC或Preview了,我生怕出來的某些方面與期待的相差太遠,所以只好直接跟各位說一下,我盡量長話短說:

1、首先是 nopasswdlogingroup,不要再用 /usr/share/deepin-installer/tools/deepin-installer-preinit/usr/share/deepin-installer/tools/functions/default_funcs.sh來生成了。請在rootfs生成好後,chroot進去 addgroup --system --firstgid 980 nopasswdlogin。如果不 chroot,也可以把 addgroup這命令放到 lightdm軟件源碼包的中的 postinst腳本。因為是 lightdm需要 nopasswdlogin這個 group而不是 deepin-installer需要它。

lightdm軟件源碼包的 postinst該改的部分:

--- lightdm.postinst.orig
+++ lightdm.postinst
@@ -12,6 +12,11 @@
         addgroup --system lightdm
 fi
 
+# creating nopasswdlogin group if he isn't already there
+if ! getent group nopasswdlogin >/dev/null; then
+        addgroup --system --firstgid 980 nopasswdlogin
+fi
+
 # creating lightdm user if he isn't already there
 if ! getent passwd lightdm >/dev/null; then
         adduser --system --ingroup lightdm --home /var/lib/lightdm lightdm

2、setup_autologin是多餘的,要刪除。setup_live_nopasswdlogin也要刪除,上面第1點解決了生成這個組,下面第5點通過增加它到 LIVE_USER_DEFAULT_GROUPSlive-configLive用戶加到此組。

3、setup_lightdm_auto_login做的 autologin-user部份已經由 live-config做了,而 user-session=dde-x11的部分應該由 dde-session軟件包去實現,這個我第四點再談。

第1至3點該改的deepin-installer部份:

--- /usr/share/deepin-installer/tools/deepin-installer-preinit.orig
+++ /usr/share/deepin-installer/tools/deepin-installer-preinit
@@ -36,13 +36,7 @@
         ## 初始化lightdm
         init_lightdm "deepin-installer"
     else
-        # 设置自动登录
-        setup_autologin
-        # 设置无密码登录
-        setup_live_nopasswdlogin
-
         ## 设置live桌面的install desktop
-        setup_lightdm_auto_login deepin
         setup_live_install_desktop

--- /usr/share/deepin-installer/tools/functions/default_funcs.sh.orig
+++ /usr/share/deepin-installer/tools/functions/default_funcs.sh
@@ -387,24 +387,6 @@
     info "$DI_LIVE_DIR_ENV not empty dir"
 }
 
-setup_autologin() {
-    if ! grep -q "^autologin:" /etc/group; then
-        groupadd autologin
-    fi
-    gpasswd -a deepin autologin
-}
-
-setup_live_nopasswdlogin() {
-    local username=$(installer_get "LIVE_USERNAME")
-    # 如果nopasswdlogin组不存在,则创建
-    if ! grep -q "^nopasswdlogin:" /etc/group; then
-        groupadd nopasswdlogin
-    fi
-    # 添加Live用户到nopasswdlogin组
-    usermod -aG nopasswdlogin "$username"
-    info "set nopasswdlogin on $username"
-}
-
 setup_oem_squashfs() {
     if [ -f $DI_LIVE_DIR_ENV/oem.squashfs ]; then
         mount -v $DI_LIVE_DIR_ENV/oem.squashfs $DI_LIVE_DIR_ENV/oem
@@ -424,17 +406,6 @@
     echo -n ${part_path##*[a-zA-Z]}
 }
 
-setup_lightdm_auto_login() {
-    local username=$1
-    local conf_file="/etc/lightdm/lightdm.conf"
-    if [ -f $conf_file ]; then
-        sed -i "s|^[#]*[ ]*autologin-user\([ ]*\)=.*|autologin-user = ${username}|g" $conf_file
-        sed -i 's/user-session=deepin/user-session=dde-x11/g' $conf_file
-    else
-        warning "lightdm.conf not found!"
-    fi
-}
-
 init_check_mode_lightdm() {
     local username=$(installer_get DI_CM_USER)
     local lightdm_conf=/etc/lightdm/lightdm.conf

4、lightdmuser-session值應該由 dde-session軟件包負責設定,因為它包含了你要啟動的 /usr/share/xsessions/dde-x11.desktop/usr/share/lightdm/lightdm.conf.d內的檔案都可以影響 lightdm的設定值,其中的 60-deepin.conf 是屬於 startdde軟件包,startdde軟件包很久以前含一個檔案叫 /usr/share/xsessions/deepin.desktop但現在已經不存在的了,所以 60-deepin.conf裡的 user-session=deepin以前是對的但現在卻不對了,這一行可以刪掉也可以不理(當然刪掉最好),重要是 dde-session軟件包有一個 conf去凌駕它,你要在 dde-session軟件包中加入 /usr/share/lightdm/lightdm.conf.d/61-deepin.conf(注意檔名開頭要大於 60,否則不能凌駕 60-deepin.conf設定的東西。

startdde軟件包要改的東西:

--- /usr/share/lightdm/lightdm.conf.d/60-deepin.conf.orig
+++ /usr/share/lightdm/lightdm.conf.d/60-deepin.conf
@@ -4,7 +4,6 @@
 [Seat:*]
 xserver-command=X -background none
 greeter-session=lightdm-deepin-greeter
-user-session=deepin
 
 # in case ~/.Xauthority changed to root owned.
 session-cleanup-script=/usr/sbin/deepin-fix-xauthority-perm

dde-session軟件包要加入的 /usr/share/lightdm/lightdm.conf.d/61-deepin.conf

[Seat:*]
user-session=dde-x11

最終 lightdm讀入的設定值可以通過 lightdm --show-config命令來檢查的。

5、刪掉 deepin-installer軟件包內的 /etc/live/config.conf.d/deepin-installer-live.conf,改為把它放到鏡像內的 live目錄下的 config.conf檔。(live目錄即存放 filesystem.squashfs那個目錄。)因為用戶如果自制 Live鏡像一般不會安裝佔用400MB的 deepin-installer,所以不應把 LIVE_HOSTNAMELIVE_USERNAME等東西放在 deepin-installer軟件包內。除了 LIVE_HOSTNAMELIVE_USERNAMELIVE_USER_FULLNAME外,這裡也要加上 LIVE_USER_DEFAULT_GROUPS來增加 dailoutnopasswdloginrender三個組。nopasswdlogin就不用說原因了,其餘的會影響用戶連電話網絡和用顯卡的體驗,所以要加上去。

ISO鏡像內的 live/config.conf

LIVE_HOSTNAME="dde-live"
LIVE_USERNAME="iongwu"
LIVE_USER_FULLNAME="Deepin Live User"
LIVE_USER_DEFAULT_GROUPS="${LIVE_USER_DEFAULT_GROUPS} dialout nopasswdlogin render"

希望這建議不要被狗吃了。愿官方程序員和用戶都跳出bug的輪迴少受痛苦!

Reply Favorite View the author
All Replies
2 / 2
To page
mozixun
Moderator
2024-04-20 18:44
#21
dreamcast

只要你ABI/toolchain等底層夠新,很多兼容問題就好解決,向後兼容一般都比向前兼容更易。不完全像是你想像的那樣。

向后兼容难度的确没向前兼容大,但是跨度太大也不能保证不出问题吧😂

之前我们教室电脑通过windows官方升级工具从win7升级到了win10,保留了所有软件,结果win7下音频没声音的问题到win10重装驱动都不能解决

Reply View the author
dreamcast
deepin
2024-04-20 18:49
#22
mozixun

向后兼容难度的确没向前兼容大,但是跨度太大也不能保证不出问题吧😂

之前我们教室电脑通过windows官方升级工具从win7升级到了win10,保留了所有软件,结果win7下音频没声音的问题到win10重装驱动都不能解决

你轉換話題了,硬件驅動更新和應用軟件能一樣嗎?

Reply View the author
mozixun
Moderator
2024-04-20 18:52
#23
dreamcast

你轉換話題了,硬件驅動更新和應用軟件能一樣嗎?

但我后来把win10重装了一遍,装了一样的驱动,音频要调整音量后才能播放的问题就没了,很显然这不是驱动问题

Reply View the author
该昵称涉嫌违规
deepin
2024-04-20 21:51
#24
dreamcast

這是要地域歧視我嗎?

confused doubt

不不不,您误会了。因为我经常看盗版电影,然后那些视频中经常会插播aomen新葡京的广告。仅此而已,没有别的意思,调侃一下,哈哈!

Reply View the author
dreamcast
deepin
2024-04-20 21:56
#25
该昵称涉嫌违规

不不不,您误会了。因为我经常看盗版电影,然后那些视频中经常会插播aomen新葡京的广告。仅此而已,没有别的意思,调侃一下,哈哈!

ok

我很少看電影,不過我也知你說的那種廣告,真的是那種很上腦的。

Reply View the author
2 / 2
To page