Exemple #1
0
def tweak_xwindow_for_cbook( mountpoint ):
#        print( "Installing GUI tweaks" )
    system_or_die( 'rm -Rf %s/etc/X11/xorg.conf.d/' % ( mountpoint ) )

#    if os.path.exists( '%s/tmp/.xorg.conf.d.tgz' % ( mountpoint ) ):
#        system_or_die( 'tar -zxf %s/tmp/.xorg.conf.d.tgz -C %s' % ( mountpoint, mountpoint ) )
#    else:
#        system_or_die( 'tar -zxf /tmp/.xorg.conf.d.tgz -C %s' % ( mountpoint ) )
#    chroot_this( mountpoint, 'mv /etc/X11/xorg.conf.d /etc/X11/xorg.conf.d.CB.disabled' )

    system_or_die( 'mkdir -p %s/etc/X11/xorg.conf.d/' % ( mountpoint ) )
    system_or_die( 'unzip %s/usr/local/bin/Chrubix/blobs/settings/x_alarm_chrubuntu.zip -d %s/etc/X11/xorg.conf.d/ &> /dev/null' % ( mountpoint, mountpoint, ), "Failed to extract X11 settings from Chrubuntu" )
    f = '%s/etc/X11/xorg.conf.d/10-keyboard.conf' % ( mountpoint )
    if not os.path.isfile( f ):
        failed( '%s not found --- cannot tweak X' % ( f ) )
    do_a_sed( f, 'gb', 'us' )
    system_or_die( 'mkdir -p %s/etc/tmpfiles.d' % ( mountpoint, ) )
    write_oneliner_file( mountpoint + '/etc/tmpfiles.d/touchpad.conf', "f /sys/devices/s3c2440-i2c.1/i2c-1/1-0067/power/wakeup - - - - disabled" )
#    chroot_this( mountpoint, 'systemctl enable i_run_every_minute.timer' )
    system_or_die( 'cp -f %s/usr/local/bin/Chrubix/blobs/apps/mtrack_drv.so %s/usr/lib/mtrack.so' % ( mountpoint, mountpoint ) )
    f = open( '%s/etc/X11/xorg.conf' % ( mountpoint ), 'a' )
    f.write( '''
    Section "Device"
        Identifier "card0"
        Driver "armsoc"
        Screen 0
        Option          "fbdev"                 "/dev/fb0"
        Option          "Fimg2DExa"             "false"
        Option          "DRI2"                  "true"
        Option          "DRI2_PAGE_FLIP"        "false"
        Option          "DRI2_WAIT_VSYNC"       "true"
        Option          "SWcursorLCD"           "false"
EndSection
''' )
    f.close()
Exemple #2
0
    def configure_distrospecific_tweaks( self ):
        logme( 'ArchlinuxDistro - configure_distrospecific_tweaks() - starting' )
        self.update_status_with_newline( 'Installing distro-specific tweaks' )
        friendly_list_of_packages_to_exclude = ''.join( r + ' ' for r in self.list_of_mkfs_packages ) + os.path.basename( self.kernel_src_basedir )
        do_a_sed( '%s/etc/pacman.conf' % ( self.mountpoint ), '#.*IgnorePkg.*', 'IgnorePkg = %s' % ( friendly_list_of_packages_to_exclude ) )
        chroot_this( self.mountpoint, 'systemctl enable lxdm.service' )
#        logme( 'FYI, ArchLinux has no distro-specific post-install tweaks at present' )
        self.update_status_with_newline( '...tweaked.' )
Exemple #3
0
 def configure_distrospecific_tweaks(self):
     logme('ArchlinuxDistro - configure_distrospecific_tweaks() - starting')
     self.update_status_with_newline('Installing distro-specific tweaks')
     friendly_list_of_packages_to_exclude = ''.join(
         r + ' ' for r in self.list_of_mkfs_packages) + os.path.basename(
             self.kernel_src_basedir)
     do_a_sed('%s/etc/pacman.conf' % (self.mountpoint), '#.*IgnorePkg.*',
              'IgnorePkg = %s' % (friendly_list_of_packages_to_exclude))
     chroot_this(self.mountpoint, 'systemctl enable lxdm.service')
     #        logme( 'FYI, ArchLinux has no distro-specific post-install tweaks at present' )
     self.update_status_with_newline('...tweaked.')
Exemple #4
0
def install_insecure_browser( mountpoint ):
    browser_name = None
    original_browser_shortcut_fname = None
    for bn in ( 'chromium', 'iceweasel' ):
        original_browser_shortcut_fname = '%s/usr/share/applications/%s.desktop' % ( mountpoint, bn )
        if os.path.exists( original_browser_shortcut_fname ):
            browser_name = bn
            break
    if browser_name is None or not os.path.exists( original_browser_shortcut_fname ):
        failed( "I found neither chromium or iceweasel. I need to clone a desktop file. Grr." )
    insecure_browser_shortcut_fname = '%s/usr/share/applications/insecure-%s.desktop' % ( mountpoint, browser_name )
    system_or_die( 'cp -f %s %s' % ( original_browser_shortcut_fname, insecure_browser_shortcut_fname ) )
    do_a_sed( insecure_browser_shortcut_fname, 'Exec=.*', 'Exec=dillo https://check.torproject.org' )
    do_a_sed( insecure_browser_shortcut_fname, 'Name=.*', 'Name=INSECURE BROWSER' )
Exemple #5
0
def install_panicbutton_scripting(mountpoint, boomfname):
    #        print( "Configuring acpi" )
    system_or_die('mkdir -p %s/etc/tmpfiles.d' % (mountpoint))
    write_oneliner_file( '%s/etc/tmpfiles.d/brightness.conf' % ( mountpoint ), \
'''f /sys/class/backlight/pwm-backlight.0/brightness 0666 - - - 800
''' )
    powerbuttonpushed_fname = '/usr/local/bin/power_button_pushed.sh'
    write_oneliner_file(
        '%s%s' % (mountpoint, powerbuttonpushed_fname), '''#!/bin/bash
ctrfile=/etc/.pwrcounter
[ -e "$ctrfile" ] || echo 0 > $ctrfile
counter=`cat $ctrfile`
time_since_last_pushed=$((`date +%%s`-`stat -c %%Y $ctrfile`))
[ "$time_since_last_pushed" -le "1" ] || counter=0
counter=$(($counter+1))
echo $counter > $ctrfile
if [ "$counter" -ge "10" ]; then
echo "Power button was pushed 10 times in rapid succession" > %s
exec /usr/local/bin/boom.sh
fi
exit 0
''' % (boomfname))
    system_or_die('chmod +x %s%s' % (mountpoint, powerbuttonpushed_fname))
    # Setup power button (10x => boom)
    handler_sh_file = '%s/etc/acpi/handler.sh' % (mountpoint)
    if os.path.isfile(handler_sh_file):
        # ARCHLINUX
        do_a_sed(handler_sh_file, "logger 'LID closed'",
                 "logger 'LID closed'; systemctl suspend")
        do_a_sed(
            handler_sh_file, "logger 'PowerButton pressed'",
            "logger 'PowerButton pressed'; /usr/local/bin/power_button_pushed.sh"
        )
        system_or_die('chmod +x %s' % (handler_sh_file))
    elif os.path.isdir('%s/etc/acpi/events' % (mountpoint)) and 0 == os.system(
            'cat %s/etc/acpi/powerbtn-acpi-support.sh | fgrep /etc/acpi/powerbtn.sh >/dev/null'
            % (mountpoint)):
        # DEBIAN
        system_or_die('ln -sf %s %s/etc/acpi/powerbtn.sh' %
                      (powerbuttonpushed_fname, mountpoint))
    else:
        failed('How do I hook power button into this distro?')


# activate acpi (sort of)
    chroot_this(mountpoint, 'systemctl enable acpid')
Exemple #6
0
def configure_privoxy( mountpoint ):
    cfg_file = '%s/etc/privoxy/config' % ( mountpoint )
    f = open( cfg_file , 'a' )
    f.write( '''
#this directs ALL requests to the tor proxy
forward-socks4a / 127.0.0.1:9050 .
forward-socks5 / 127.0.0.1:9050 .
#this forwards all requests to I2P domains to the local I2P proxy without dns requests
forward .i2p 127.0.0.1:4444
#this forwards all requests to Freenet domains to the local Freenet node proxy without dns requests
forward ksk@ 127.0.0.1:8888
forward ssk@ 127.0.0.1:8888
forward chk@ 127.0.0.1:8888
forward svk@ 127.0.0.1:8888
''' )
    do_a_sed( cfg_file, 'localhost', '127.0.0.1' )
    f.close()
Exemple #7
0
def configure_privoxy(mountpoint):
    cfg_file = '%s/etc/privoxy/config' % (mountpoint)
    f = open(cfg_file, 'a')
    f.write('''
#this directs ALL requests to the tor proxy
forward-socks4a / 127.0.0.1:9050 .
forward-socks5 / 127.0.0.1:9050 .
#this forwards all requests to I2P domains to the local I2P proxy without dns requests
forward .i2p 127.0.0.1:4444
#this forwards all requests to Freenet domains to the local Freenet node proxy without dns requests
forward ksk@ 127.0.0.1:8888
forward ssk@ 127.0.0.1:8888
forward chk@ 127.0.0.1:8888
forward svk@ 127.0.0.1:8888
''')
    do_a_sed(cfg_file, 'localhost', '127.0.0.1')
    f.close()
Exemple #8
0
def tweak_xwindow_for_cbook(mountpoint):
    #        print( "Installing GUI tweaks" )
    system_or_die('rm -Rf %s/etc/X11/xorg.conf.d/' % (mountpoint))

    #    if os.path.exists( '%s/tmp/.xorg.conf.d.tgz' % ( mountpoint ) ):
    #        system_or_die( 'tar -zxf %s/tmp/.xorg.conf.d.tgz -C %s' % ( mountpoint, mountpoint ) )
    #    else:
    #        system_or_die( 'tar -zxf /tmp/.xorg.conf.d.tgz -C %s' % ( mountpoint ) )
    #    chroot_this( mountpoint, 'mv /etc/X11/xorg.conf.d /etc/X11/xorg.conf.d.CB.disabled' )

    system_or_die('mkdir -p %s/etc/X11/xorg.conf.d/' % (mountpoint))
    system_or_die(
        'unzip %s/usr/local/bin/Chrubix/blobs/settings/x_alarm_chrubuntu.zip -d %s/etc/X11/xorg.conf.d/ &> /dev/null'
        % (
            mountpoint,
            mountpoint,
        ), "Failed to extract X11 settings from Chrubuntu")
    f = '%s/etc/X11/xorg.conf.d/10-keyboard.conf' % (mountpoint)
    if not os.path.isfile(f):
        failed('%s not found --- cannot tweak X' % (f))
    do_a_sed(f, 'gb', 'us')
    system_or_die('mkdir -p %s/etc/tmpfiles.d' % (mountpoint, ))
    write_oneliner_file(
        mountpoint + '/etc/tmpfiles.d/touchpad.conf',
        "f /sys/devices/s3c2440-i2c.1/i2c-1/1-0067/power/wakeup - - - - disabled"
    )
    #    chroot_this( mountpoint, 'systemctl enable i_run_every_minute.timer' )
    system_or_die(
        'cp -f %s/usr/local/bin/Chrubix/blobs/apps/mtrack_drv.so %s/usr/lib/mtrack.so'
        % (mountpoint, mountpoint))
    f = open('%s/etc/X11/xorg.conf' % (mountpoint), 'a')
    f.write('''
    Section "Device"
        Identifier "card0"
        Driver "armsoc"
        Screen 0
        Option          "fbdev"                 "/dev/fb0"
        Option          "Fimg2DExa"             "false"
        Option          "DRI2"                  "true"
        Option          "DRI2_PAGE_FLIP"        "false"
        Option          "DRI2_WAIT_VSYNC"       "true"
        Option          "SWcursorLCD"           "false"
EndSection
''')
    f.close()
Exemple #9
0
    def install_i2p( self ):
        failed( 'https://launchpad.net/~i2p-maintainers/+archive/ubuntu/i2p' )
#        chroot_this( self.mountpoint, 'wget http://www.deb-multimedia.org/pool/main/d/deb-multimedia-keyring/deb-multimedia-keyring_2014.2_all.deb -O - > /tmp/debmult.deb', attempts = 1, title_str = self.title_str, status_lst = self.status_lst )
#        chroot_this( self.mountpoint, 'dpkg -i /tmp/debmult.deb', attempts = 1, title_str = self.title_str, status_lst = self.status_lst )
        assert( self.branch in ( 'wheezy', 'jessie' ) )
        write_oneliner_file( '%s/etc/apt/sources.list.d/i2p.list' % ( self.mountpoint ), '''
deb http://deb.i2p2.no/ %s main
deb-src http://deb.i2p2.no/ %s main
''' % ( self.branch, self.branch ) )
        for cmd in ( 
                        'yes 2>/dev/null | add-apt-repository "deb http://deb.i2p2.no/ %s main"' % ( self.branch ),
                        'yes "" 2>/dev/null | curl https://geti2p.net/_static/i2p-debian-repo.key.asc | apt-key add -',
                        'yes 2>/dev/null | apt-get update'
                   ):
            chroot_this( self.mountpoint, cmd, title_str = self.title_str, status_lst = self.status_lst,
                             on_fail = "Failed to run %s successfully" % ( cmd ) )
        chroot_this( self.mountpoint, 'yes | apt-get install i2p i2p-keyring', on_fail = 'Failed to install i2p' )
        logme( 'tweaking i2p ID...' )
        do_a_sed( '%s/etc/passwd' % ( self.mountpoint ), 'i2p:/bin/false', 'i2p:/bin/bash' )
Exemple #10
0
def install_insecure_browser(mountpoint):
    browser_name = None
    original_browser_shortcut_fname = None
    for bn in ('chromium', 'iceweasel'):
        original_browser_shortcut_fname = '%s/usr/share/applications/%s.desktop' % (
            mountpoint, bn)
        if os.path.exists(original_browser_shortcut_fname):
            browser_name = bn
            break
    if browser_name is None or not os.path.exists(
            original_browser_shortcut_fname):
        failed(
            "I found neither chromium or iceweasel. I need to clone a desktop file. Grr."
        )
    insecure_browser_shortcut_fname = '%s/usr/share/applications/insecure-%s.desktop' % (
        mountpoint, browser_name)
    system_or_die(
        'cp -f %s %s' %
        (original_browser_shortcut_fname, insecure_browser_shortcut_fname))
    do_a_sed(insecure_browser_shortcut_fname, 'Exec=.*',
             'Exec=dillo https://check.torproject.org')
    do_a_sed(insecure_browser_shortcut_fname, 'Name=.*',
             'Name=INSECURE BROWSER')
Exemple #11
0
def install_panicbutton_scripting( mountpoint, boomfname ):
#        print( "Configuring acpi" )
    system_or_die( 'mkdir -p %s/etc/tmpfiles.d' % ( mountpoint ) )
    write_oneliner_file( '%s/etc/tmpfiles.d/brightness.conf' % ( mountpoint ), \
'''f /sys/class/backlight/pwm-backlight.0/brightness 0666 - - - 800
''' )
    powerbuttonpushed_fname = '/usr/local/bin/power_button_pushed.sh'
    write_oneliner_file( '%s%s' % ( mountpoint, powerbuttonpushed_fname ), '''#!/bin/bash
ctrfile=/etc/.pwrcounter
[ -e "$ctrfile" ] || echo 0 > $ctrfile
counter=`cat $ctrfile`
time_since_last_pushed=$((`date +%%s`-`stat -c %%Y $ctrfile`))
[ "$time_since_last_pushed" -le "1" ] || counter=0
counter=$(($counter+1))
echo $counter > $ctrfile
if [ "$counter" -ge "10" ]; then
echo "Power button was pushed 10 times in rapid succession" > %s
exec /usr/local/bin/boom.sh
fi
exit 0
''' % ( boomfname ) )
    system_or_die( 'chmod +x %s%s' % ( mountpoint, powerbuttonpushed_fname ) )
# Setup power button (10x => boom)
    handler_sh_file = '%s/etc/acpi/handler.sh' % ( mountpoint )
    if os.path.isfile( handler_sh_file ):
        # ARCHLINUX
        do_a_sed( handler_sh_file, "logger 'LID closed'", "logger 'LID closed'; systemctl suspend" )
        do_a_sed( handler_sh_file, "logger 'PowerButton pressed'", "logger 'PowerButton pressed'; /usr/local/bin/power_button_pushed.sh" )
        system_or_die( 'chmod +x %s' % ( handler_sh_file ) )
    elif os.path.isdir( '%s/etc/acpi/events' % ( mountpoint ) )  and 0 == os.system( 'cat %s/etc/acpi/powerbtn-acpi-support.sh | fgrep /etc/acpi/powerbtn.sh >/dev/null' % ( mountpoint ) ):
        # DEBIAN
        system_or_die( 'ln -sf %s %s/etc/acpi/powerbtn.sh' % ( powerbuttonpushed_fname, mountpoint ) )
    else:
        failed( 'How do I hook power button into this distro?' )
# activate acpi (sort of)
    chroot_this( mountpoint, 'systemctl enable acpid' )
Exemple #12
0
 def install_package_manager_tweaks(self):
     logme('ArchlinuxDistro - install_package_manager_tweaks() - starting')
     do_a_sed('%s/etc/pacman.d/mirrorlist' % (self.mountpoint),
              '#.*Server =', 'Server =')
Exemple #13
0
def configure_lxdm_onetime_changes(mountpoint):
    if os.path.exists('%s/etc/.first_time_ever' % (mountpoint)):
        logme('configure_lxdm_onetime_changes() has already run.')
        return
    if 0 != chroot_this(mountpoint, 'which lxdm'):
        failed('You haven ot installed LXDM yet.')
    f = '%s/etc/WindowMaker/WindowMaker' % (mountpoint)
    if os.path.isfile(f):
        do_a_sed(f, 'MouseLeftButton', 'flibbertygibbet')
        do_a_sed(f, 'MouseRightButton', 'MouseLeftButton')
        do_a_sed(f, 'flibbertygibbet', 'MouseRightButton')


#    system_or_die( 'echo "ps wax | fgrep mate-session | fgrep -v grep && mpg123 /etc/.mp3/xpshutdown.mp3" >> %s/etc/lxdm/PreLogout' % ( mountpoint ) )
    append_startx_addendum('%s/etc/lxdm/Xsession' %
                           (mountpoint))  # Append. Don't replace.
    append_startx_addendum('%s/etc/X11/xinit/xinitrc' %
                           (mountpoint))  # Append. Don't replace.
    write_lxdm_pre_login_file(mountpoint,
                              '%s/etc/lxdm/PreLogin' % (mountpoint))
    write_lxdm_post_logout_file('%s/etc/lxdm/PostLogout' % (mountpoint))
    write_lxdm_post_login_file('%s/etc/lxdm/PostLogin' % (mountpoint))
    write_lxdm_pre_reboot_or_shutdown_file(
        '%s/etc/lxdm/PreReboot' % (mountpoint), 'reboot')
    write_lxdm_pre_reboot_or_shutdown_file(
        '%s/etc/lxdm/PreShutdown' % (mountpoint), 'shutdown')
    write_login_ready_file('%s/etc/lxdm/LoginReady' % (mountpoint))
    if 0 == chroot_this( mountpoint, 'which iceweasel > /tmp/.where_is_it.txt' ) \
    or 0 == chroot_this( mountpoint, 'which chromium  > /tmp/.where_is_it.txt' ):
        webbrowser = read_oneliner_file('%s/tmp/.where_is_it.txt' %
                                        (mountpoint)).strip()
        logme('webbrowser = %s' % (webbrowser))
    else:
        failed(
            'Which web browser should I use? I cannot find iceweasel. I cannot find chrome. I cannot find firefox...'
        )
    append_lxdm_xresources_addendum('%s/root/.Xresources' % (mountpoint),
                                    webbrowser)
    system_or_die('echo ". /etc/X11/xinitrc/xinitrc" >> %s/etc/lxdm/Xsession' %
                  (mountpoint))
    do_a_sed('%s/etc/X11/xinit/xinitrc' % (mountpoint), '.*xterm.*', '')
    do_a_sed('%s/etc/X11/xinit/xinitrc' % (mountpoint), 'exec .*',
             '')  # exec /usr/local/bin/ersatz_lxdm.sh' )
    #    system_or_die( 'echo "exec /usr/local/bin/ersatz_lxdm.sh" >> %s/etc/xinitrc/xinitrc' % ( mountpoint ) ) # start (Python) greeter at end of
    write_oneliner_file('%s/etc/.first_time_ever' % (mountpoint), 'yep')
    assert (os.path.exists('%s/etc/lxdm/lxdm.conf' % (mountpoint)))
    chroot_this(mountpoint, 'chmod +x /etc/lxdm/P*')
    chroot_this(mountpoint, 'chmod +x /etc/lxdm/L*')
    if os.path.exists('%s/etc/init/lxdm.conf' % (mountpoint)):
        do_a_sed('%s/etc/init/lxdm.conf' % (mountpoint), 'exec lxdm-binary.*',
                 'exec ersatz_lxdm.sh')
        do_a_sed('%s/etc/init/lxdm.conf' % (mountpoint), '/usr/sbin/lxdm',
                 '/usr/local/bin/ersatz_lxdm.sh')
Exemple #14
0
def configure_lxdm_behavior( mountpoint, lxdm_settings ):
    logme( 'configure_lxdm_behavior --- entering' )
    logme( str( lxdm_settings ) )
    f = '%s/etc/lxdm/lxdm.conf' % ( mountpoint )
    if not os.path.isfile( f ):
        failed( "%s does not exist; configure_lxdm_login_manager() cannot run properly. That sucks." % ( f ) )
    if lxdm_settings['enable user lists']:
        do_a_sed( f, 'disable=.*', 'disable=0' )
        do_a_sed( f, 'black=.*', 'black=root bin daemon mail ftp http uuidd dbus nobody systemd-journal-gateway systemd-timesync systemd-network avahi polkitd colord git rtkit freenet i2p lxdm tor privoxy saned festival ntp usbmux' )
        do_a_sed( f, 'white=.*', 'white=guest %s' % ( lxdm_settings['login as user'] ) )  # FYI, if 'login as user' is guest, the word 'guest' will appear twice. I don't like that. :-/
    else:
        do_a_sed( f, 'disable=.*', 'disable=1' )
    if lxdm_settings['autologin']:
        do_a_sed( f, '.*autologin=.*', 'autologin=%s' % ( lxdm_settings['login as user'] ) )
        do_a_sed( f, '.*skip_password=.*', 'skip_password=1' )
    else:
        do_a_sed( f, '.*autologin=.*', '###autologin='******'.*skip_password=.*', 'skip_password=%d' % ( 1 ) )  # if lxdm_settings['login as user'] == 'guest' else 0 ) )
    assert( os.path.exists( '%s/%s' % ( mountpoint, lxdm_settings['window manager'] ) ) )
    do_a_sed( f, '.*session=.*', 'session=%s' % ( lxdm_settings['window manager'] ) )
    assert( 0 == os.system( 'cat %s | grep session= &> /dev/null' % ( f ) ) )
    f = '%s/etc/pam.d/lxdm' % ( mountpoint )
    # http://ubuntuforums.org/showthread.php?t=2178645
    if os.path.isfile( f ):
        handle = open( f, 'a' )
        handle.write( '''
session required pam_loginuid.so
session required pam_systemd.so
''' )
        handle.close()
    logme( 'configure_lxdm_behavior --- leaving' )
Exemple #15
0
def configure_lxdm_onetime_changes( mountpoint ):
    if os.path.exists( '%s/etc/.first_time_ever' % ( mountpoint ) ):
        logme( 'configure_lxdm_onetime_changes() has already run.' )
        return
    if 0 != chroot_this( mountpoint, 'which lxdm' ):
        failed( 'You haven ot installed LXDM yet.' )
    f = '%s/etc/WindowMaker/WindowMaker' % ( mountpoint )
    if os.path.isfile( f ):
        do_a_sed( f, 'MouseLeftButton', 'flibbertygibbet' )
        do_a_sed( f, 'MouseRightButton', 'MouseLeftButton' )
        do_a_sed( f, 'flibbertygibbet', 'MouseRightButton' )
#    system_or_die( 'echo "ps wax | fgrep mate-session | fgrep -v grep && mpg123 /etc/.mp3/xpshutdown.mp3" >> %s/etc/lxdm/PreLogout' % ( mountpoint ) )
    append_startx_addendum( '%s/etc/lxdm/Xsession' % ( mountpoint ) )  # Append. Don't replace.
    append_startx_addendum( '%s/etc/X11/xinit/xinitrc' % ( mountpoint ) )  # Append. Don't replace.
    write_lxdm_pre_login_file( mountpoint, '%s/etc/lxdm/PreLogin' % ( mountpoint ) )
    write_lxdm_post_logout_file( '%s/etc/lxdm/PostLogout' % ( mountpoint ) )
    write_lxdm_post_login_file( '%s/etc/lxdm/PostLogin' % ( mountpoint ) )
    write_lxdm_pre_reboot_or_shutdown_file( '%s/etc/lxdm/PreReboot' % ( mountpoint ), 'reboot' )
    write_lxdm_pre_reboot_or_shutdown_file( '%s/etc/lxdm/PreShutdown' % ( mountpoint ), 'shutdown' )
    write_login_ready_file( '%s/etc/lxdm/LoginReady' % ( mountpoint ) )
    if 0 == chroot_this( mountpoint, 'which iceweasel > /tmp/.where_is_it.txt' ) \
    or 0 == chroot_this( mountpoint, 'which chromium  > /tmp/.where_is_it.txt' ):
        webbrowser = read_oneliner_file( '%s/tmp/.where_is_it.txt' % ( mountpoint ) ).strip()
        logme( 'webbrowser = %s' % ( webbrowser ) )
    else:
        failed( 'Which web browser should I use? I cannot find iceweasel. I cannot find chrome. I cannot find firefox...' )
    append_lxdm_xresources_addendum( '%s/root/.Xresources' % ( mountpoint ), webbrowser )
    system_or_die( 'echo ". /etc/X11/xinitrc/xinitrc" >> %s/etc/lxdm/Xsession' % ( mountpoint ) )
    do_a_sed( '%s/etc/X11/xinit/xinitrc' % ( mountpoint ), '.*xterm.*', '' )
    do_a_sed( '%s/etc/X11/xinit/xinitrc' % ( mountpoint ), 'exec .*', '' )  # exec /usr/local/bin/ersatz_lxdm.sh' )
#    system_or_die( 'echo "exec /usr/local/bin/ersatz_lxdm.sh" >> %s/etc/xinitrc/xinitrc' % ( mountpoint ) ) # start (Python) greeter at end of
    write_oneliner_file( '%s/etc/.first_time_ever' % ( mountpoint ), 'yep' )
    assert( os.path.exists( '%s/etc/lxdm/lxdm.conf' % ( mountpoint ) ) )
    chroot_this( mountpoint, 'chmod +x /etc/lxdm/P*' )
    chroot_this( mountpoint, 'chmod +x /etc/lxdm/L*' )
    if os.path.exists( '%s/etc/init/lxdm.conf' % ( mountpoint ) ):
        do_a_sed( '%s/etc/init/lxdm.conf' % ( mountpoint ), 'exec lxdm-binary.*', 'exec ersatz_lxdm.sh' )
        do_a_sed( '%s/etc/init/lxdm.conf' % ( mountpoint ), '/usr/sbin/lxdm', '/usr/local/bin/ersatz_lxdm.sh' )
Exemple #16
0
def configure_lxdm_behavior(mountpoint, lxdm_settings):
    logme('configure_lxdm_behavior --- entering')
    logme(str(lxdm_settings))
    f = '%s/etc/lxdm/lxdm.conf' % (mountpoint)
    if not os.path.isfile(f):
        failed(
            "%s does not exist; configure_lxdm_login_manager() cannot run properly. That sucks."
            % (f))
    if lxdm_settings['enable user lists']:
        do_a_sed(f, 'disable=.*', 'disable=0')
        do_a_sed(
            f, 'black=.*',
            'black=root bin daemon mail ftp http uuidd dbus nobody systemd-journal-gateway systemd-timesync systemd-network avahi polkitd colord git rtkit freenet i2p lxdm tor privoxy saned festival ntp usbmux'
        )
        do_a_sed(
            f, 'white=.*', 'white=guest %s' % (lxdm_settings['login as user'])
        )  # FYI, if 'login as user' is guest, the word 'guest' will appear twice. I don't like that. :-/
    else:
        do_a_sed(f, 'disable=.*', 'disable=1')
    if lxdm_settings['autologin']:
        do_a_sed(f, '.*autologin=.*',
                 'autologin=%s' % (lxdm_settings['login as user']))
        do_a_sed(f, '.*skip_password=.*', 'skip_password=1')
    else:
        do_a_sed(f, '.*autologin=.*', '###autologin='******'.*skip_password=.*', 'skip_password=%d' %
            (1))  # if lxdm_settings['login as user'] == 'guest' else 0 ) )
    assert (os.path.exists('%s/%s' %
                           (mountpoint, lxdm_settings['window manager'])))
    do_a_sed(f, '.*session=.*',
             'session=%s' % (lxdm_settings['window manager']))
    assert (0 == os.system('cat %s | grep session= &> /dev/null' % (f)))
    f = '%s/etc/pam.d/lxdm' % (mountpoint)
    # http://ubuntuforums.org/showthread.php?t=2178645
    if os.path.isfile(f):
        handle = open(f, 'a')
        handle.write('''
session required pam_loginuid.so
session required pam_systemd.so
''')
        handle.close()
    logme('configure_lxdm_behavior --- leaving')
Exemple #17
0
 def install_package_manager_tweaks( self ):
     logme( 'ArchlinuxDistro - install_package_manager_tweaks() - starting' )
     do_a_sed( '%s/etc/pacman.d/mirrorlist' % ( self.mountpoint ), '#.*Server =', 'Server =' )