How to create initialization script in Debian by modifying environment variables

2

I need to create a startup script that modifies the resolution that Debian sets by default. I currently have the following shell script that does the work:

export XAUTHORITY=/home/giuliana/.Xauthority
xrandr --newmode "1368x768" 85.25 1368 1440 1576 1784 768 771 781 798 -Hsync +Vsync
xrandr --addmode VGA1 "1368x768"
xrandr --output VGA1 --mode "1368x768"

In this script, a resolution of 1368x768 is added, which by default is not supported in Debian 8. After that, this resolution is selected. In order to work it is necessary to modify the value of environment variable XAUTHORITY . The script works if I run it, however when I use the same script to boot at boot it does not work. What I did for him to boot was:

  • I added the script to /etc/init.d
  • I installed rcconf
  • I configured the script I called resolution to run at boot using rcconf
  • When I reboot, the resolution is not modified. What I noticed is that the variable XAUTHORITY has its value changed equal to /tmp/kde-giuliana/xauth-1000-_0 and not to the value that I put in the script. But I do not know who is modifying this value. Any Debian savvy could help me?

        
    asked by anonymous 10.09.2016 / 19:06

    1 answer

    2

    Due to buggy drivers or hardware, monitor resolution may be detected incorrectly. For example, the EDID block provided by your monitor may be incorrect or an outdated version of KDE or Xorg may misinterpret it.

    Because your card is Intel, installing the following package can help your system detect the proper resolution:

    $ sudo apt-get install xserver-xorg-video-intel
    

    Restart and verify that 1368x786 resolution is listed in the settings.

    If your resolution is still not detected, you should use xrandr , as you already do. To save permanently, edit the /etc/kde4/kdm/Xsetup file and add your code before the initctl ... gdm line:

    xrandr --newmode "1368x768" 85.25 1368 1440 1576 1784 768 771 781 798 -Hsync +Vsync
    xrandr --addmode VGA1 "1368x768"
    xrandr --output VGA1 --mode "1368x768"
    
    initctl -q emit login-session-start DISPLAY_MANAGER=gdm
    


    There are other less advantageous ways to persist%% customizations through:

    • xrandr : is per user, which means your login screen will have a strange resolution,
    • .profile : is obsolete and is no longer included in the most recent distros.

    If you need to, the instructions for making these modifications are available on the Ubuntu wiki , but I recommend the method by the% of% I mentioned.

        
    11.09.2016 / 06:28