antix-skidoo / slim-antix

0 stars 0 forks source link

"remaster-antix" package contains a script which overwrites slim.conf #5

Open antix-skidoo opened 6 years ago

antix-skidoo commented 6 years ago

(as noted in TODO file)

$ dpkg-query -S /usr/local/share/live-files/general-files/etc/slim.conf remaster-antix: /usr/local/share/live-files/general-files/etc/slim.conf https://github.com/antiX-Linux/remaster/blob/master/live-files/general-files/etc/slim.conf

Also, package "cli-installer-antix" contains a script which will overwrite slim.conf $ dpkg-query -S /usr/local/bin/cli-installer cli-installer-antix: /usr/local/bin/cli-installer

Also, /usr/local/bin/UM-set (provided by "user-management-antix" package) overwrites any (EVERY) line within /etc/slim.conf which contains "default_user" or "auto_login" (these are absent from slim.template, and lines containing these are appended to template and written to /etc/slim.conf when user runs the "slim-login" utility) ("Configure autologin" in controlCentre) Due to appending, no functional conflict... but this action may confuse a sysadmin who had manually edited slim.conf

^--- this action by UM-set differs from the action performed by /usr/local/bin/slim/login (search/replace vs append) AND an antiX live system can (will) wind up with non-synced copies of: /etc/slim.conf vs /usr/share/slim/slim.template vs /usr/local/share/live-files/general-files/etc/slim.conf

antix-skidoo commented 6 years ago

"slim" package must, unconditionally, install /etc/slim.conf

the scripts within "cli-installer-antix" and "remaster-antix" packages should be modified so that they only install /etc/slim.conf if id does not already exist (allowing for varying package installation order during build-iso operation).

Still need to figure out how to handle /usr/local/bin/UM-set (provided by "user-management-antix" package) so that the content of /etc/slim/conf and /usr/share/slim/slim.template will remain synced.

antiX-Dave commented 6 years ago

Not sure in which direction this is going. I guess it is trying to identify how (and what) is putting its finger in slim.conf.

Seems antix-install (minstall) also replaces the string in slim.conf only.

cat minstall.cpp |grep "slim" replaceStringInFile("demo", userNameEdit->text(), "/mnt/antiX/etc/slim.conf"); replaceStringInFile("#auto_login", "auto_login", "/mnt/antiX/etc/slim.conf"); replaceStringInFile("#default_user ", "default_user ", "/mnt/antiX/etc/slim.conf"); replaceStringInFile("auto_login", "#auto_login", "/mnt/antiX/etc/slim.conf"); replaceStringInFile("default_user ", "#default_user ", "/mnt/antiX/etc/slim.conf");

cli-installer does a similar thing but to an original "installation" copy of slim.conf. Why I am not sure as would it not be original when you are installing? Maybe not if it is a remastered copy.

cat /usr/local/bin/cli-installer |grep "slim" sed -i "s/$LIVEUSER/$name/" usr/share/slim/themes/antiX/slim-install.conf 2>/dev/null sed -i "s/#auto_login/auto_login/" usr/share/slim/themes/antiX/slim-install.conf 2>/dev/null sed -i "s/#default_user/default_user/" usr/share/slim/themes/antiX/slim-install.conf 2>/dev/null cp usr/share/slim/themes/antiX/slim-install.conf etc/slim.conf 2>/dev/null

which would break easily if the type was changed slightly (for example a space between # and default_user)

User Management does the same as cli-installer but maybe a little more robust by not assuming the line is always the same type

cat /usr/local/bin/UM-set |grep "slim" sed -ir "s/.auto_login../auto_login yes/" /etc/slim.conf #Enable sed -ir "s/.auto_login../#auto_login yes/" /etc/slim.conf #Disable sed -ir "s/.default_user../default_user $USER/" /etc/slim.conf #Enable sed -ir "s/.default_user../#default_user $USER/" /etc/slim.conf #Disable

I am not seeing how slim.conf is used with remaster. I only see the file. I would guess that it is used as an overlay directory. However it used to be changed via search-replace always but now only if not "default user". I am not certain which problems cause the need to use fresh copies when only with the "default user". I also cannot immediately follow the sed syntax.

# Note this code is no longer called/used. We use fresh copies which # a lot of problems. Although we will need to call it if the name of # the default user changes. do_xorg_login() { exit 10 do_sed $bind_from/etc/slim.conf \ -e "s/^(\s#)(default_user +)./\2$def_user/" \ -e "/xserver_arguments/ s/ -dpi\s+[0-9]+//" \ -e "s/^(\s#)(auto_login +)./\2yes/" do_sed $bind_from/etc/lightdm/lightdm.conf \ -e "/autologin-user=demo/ s/^#+//" \ -e "/xserver-command/ s/ -dpi [0-9]+//" } do_sed() { local file=$1 shift echo sed $* $file if [ "$PRETEND" ]; then local expr file=${file/$bind_from/$real_root} test -e $file || return for expr; do [ "$expr" = -e ] && continue echo sed -n -r "${expr}" $file sed -n -r "${expr}p" $file done else test -e $file || return pretend sed -i -r "$@" $file fi }

and then slim-login seems to grab a fresh copy and append to it.

cp -p --force /usr/share/slim/slim.template /etc/slim.conf echo "default_user $username" >> /etc/slim.conf echo "auto_login yes" >> /etc/slim.conf echo "lockfile /var/run/slim.lock" >> /etc/slim.conf echo "logfile /var/log/slim.log" >> /etc/slim.conf echo $"Default slim.conf replaced."

I have not looked, but is slim.lock and slim.log not the default? why does it need to be specified by slim-login and not the others?

So what would be the best way to work?

  1. slim package installs slim.conf and slim.template all others do NOT have a copy of slim.conf in it various forms
  2. programs backup slim.conf and check conf against template for variations.
  3. template copied to conf.
  4. variations found in 2. modified in fresh copy of conf
  5. conf modified to match autologin. (on or off as needed)
antix-skidoo commented 6 years ago

IIRC, 2 files are overwritten by other packages: /etc/slim.conf and /etc/skel/rox/menu

Other than (perhaps) the need to place a copy of each of these in the "Templates" subdirectory of the build-iso package, no other packages should provide copies of these files.