[SH/DASH] Fully Prepare Linux Mint 17.3 Mate script [Useful for Give-Away Projects]

Discussion in 'Scripting' started by hearywarlot, Feb 29, 2016.

  1. hearywarlot

    hearywarlot MDL Member

    Jul 31, 2015
    112
    153
    10
    #1 hearywarlot, Feb 29, 2016
    Last edited by a moderator: Apr 20, 2017
    This is a SH/DASH script which can be used to fully prepare Linux Mint 17.3 Mate install for use by the common person.
    The goal is to prepare a older PC with atleast 768-1024MB RAM, P4 CPU which can be used in projects to be given away to schools or people with no money for modern PC.
    Linux Mint 17.3 Mate is a good replacement for XP. It will still allow you to use Email, Youtube, Flash Games and most normal web activities. Also Teamviewer is available for remote support.

    Almost no knowledge is needed to prepare a Mint install when using this script.
    The only requirements are: Get a Mint 17.3 Mate ISO, install it on your HDD, make the script executeable and run the script, done (well perhaps you want to use 'mintdrivers' for your VGA).

    Usage:
    The script will accept 1 switch.
    The switch:

    • --nosudo
    Using this switch will allow the script to only run on the current user, as long as it is not run with or as SUDO (Super User)

    To make the script executeable, run in a terminal:
    Code:
    chmod +x "YOURFILE"
    Replace "YOURFILE" by the location of your script.

    Now just doubleclick the script or run from terminal with or without sudo.
    Input your password (it will be hidden while typing) and press enter.

    Now enjoy the spectacle and hope everything works correctly.

    Notes:
    • Do not run as ROOT, the script may will not work correctly and warn you.
    • I restricted the script to only run on Mint 17.3 with Mate with Internet connection.
    • If any errorcode is generated by a application other than 0, the script will exit with a warning (usually anything other than than 0 is program error).
    • Compiz settings are made Read-Only since Mint decided to switch from Flat-File to Dconf for config settings, but some settings do not work properly.
    They also added a reset button in 'MintDesktop'.
    So the script will assume generally liked settings and make flat-file config read-only to prevent less knowledgeable people ruining the Compiz settings.
    You can remove this if you want, by making '~/.config/compiz-1/compizconfig' and files inside writeable, edit '~/profile' and delete '~/.compiz_config_ro'. Do these also in '/etc/skel'.
    You could also edit out these part from script before executing.
    • If you want to know what the script does, just look at it, it have commented each section. The script should be easily readable, it is not rocket science or assembly :p
    • The script runs in 3 parts. Super User, Current User and a section for Both.
    • Settings are also applied to '/etc/skel' folder. So when you create a new user, the skeleton folder ia copied with the settings to new user accounts.
    • While Linux Mint is already pretty secure after using this script, you should still regulary update your system using mintUpdate or 'sudo apt-get dist-upgrade'.
    No system is invurnable (not till our Skynet overlords rule over us).
    Especially with super complex inferior human written buggy multiplatform mediacontent HTML/CSS/JAVASCRIPT viewers​


    Code:
    Filename: installscript_linuxmint-17.3-mate-dvd-32bit.sh
    Code:
    #!/bin/sh
    
    ### Create variable for embed Tab in Heredocs
    TAB="$(printf '\t')"
    
    ### Create function for sudof which will give warning if no SUDO privileges
    sudof() {
    
    sudo $@ || printf '\n%s\n%s\n' \​
    'No SUDO privileges acquired,' \​
    'I will still try, but what can be done is limited.'​
    } ### Create function for exitf which will allow exit without EXIT signal trapping exitf() {
    trap - EXIT​
    exit "$1"​
    } ### Checks to trap errors and display helpful info to the user or catch some bugs set -o errexit USER_ERR() {
    printf '\n%s\n%s\n' \​
    'The script got a "INTERRUPT" signal and ended probably incorrectly.' \​
    'I recommend you restart the script and let me finish or you may have a bad time.'​
    read -r usererr​
    exitf 1​
    } PROG_ERR() {
    if ! ping -c 1 google.com >/dev/null; then​
    printf '\n%s\n%s\n' \​
    'I was unable to reach the internet AND I catched a error, thus I stopped.' \​
    'Check your LAN cable and internet settings, then try restart the script.'​
    else​
    printf '\n%s\n%s\n' \​
    'A wild error appeared, thus I stopped.' \​
    'Please correct the problem, then restart the script or you may have a bad time.'​
    fi​
    read -r progerr​
    exitf 1​
    } trap 'USER_ERR' INT trap 'PROG_ERR' EXIT ### Check for internet connection, else try to fix and test again, else fail and exit until ping -c 1 google.com >/dev/null; do
    if [ "$RETRY" = '1' ]; then​
    printf '\n%s\n%s\n' \​
    'I was unable to reach the internet, thus I stopped.' \​
    'Check your LAN cable and internet settings, then try restart the script.'​
    read -r nointernet​
    exitf 1​
    fi​
    printf '\n%s\n%s\n\n' \​
    'Warning, No internet connection detected.' \​
    'I will try and see what I can do to fix it.'​
    sudof dns-fix​
    nmcli nm enable false​
    nmcli nm enable true​
    RETRY='1'​
    done ### Check to prevent running the script on the wrong Linux distros or versions if ! lsb_release -rs | grep -q '17.3' || ! ps -e | grep -q '^.* mate-panel$'; then
    printf '%s\n' 'Error, this script is written to run on "Linux Mint 17.3 with Mate", thus I stopped.'​
    read -r wrongdistmate​
    exitf 1​
    fi ### Check if run by root, if not, ask for sudo. If pure root (not sudo), exit ### If given option '--nosudo' to script, only run under current user if [ "$(id -u)" -ne 0 ]; then
    if [ "$1" != '--nosudo' ]; then​
    printf '%s\n' 'Please run this script with SUDO user'​
    sudo "$0" || true​
    exitf 0​
    else​
    #### Everything here will run in only current user​
    USERDIR="$HOME"​
    CONFIG="$USERDIR/.config"​
    LOCAL="$USERDIR/.local/share"​
    ## Preconfigure user settings.​
    cd "$USERDIR"​
    ## Place shortcuts on desktop​
    ( cd '/usr/share/applications/'​
    cp --target-directory="$(xdg-user-dir DESKTOP)" \​
    'firefox.desktop' \​
    'libreoffice-startcenter.desktop' \​
    'pinta.desktop' \​
    "$(find teamviewer*.desktop)" \​
    'vlc.desktop'​
    )​
    find $(xdg-user-dir DESKTOP)/*.desktop -maxdepth 1 -type f -exec chmod +x '{}' \;​
    ( cd '.config'​
    while :; do​
    ## Check if writeable dconf/user file or writeable dconf folder and empty, else fail​
    if ( [ -f 'dconf/user' ] && [ -w 'dconf/user' ] ) || ( [ -w 'dconf/' ] && ! [ -e 'dconf/user' ] ); then​
    gsettings set org.mate.peripherals-touchpad 'horiz-scroll-enabled' 'true'​
    gsettings set org.mate.peripherals-touchpad 'tap-to-click' 'true'​
    gsettings set org.mate.power-manager 'action-critical-battery' 'suspend'​
    gsettings set org.mate.power-manager 'button-lid-ac' 'blank'​
    gsettings set org.mate.power-manager 'button-lid-battery' 'blank'​
    gsettings set org.mate.caja.desktop 'trash-icon-visible' 'true' ​
    gsettings set org.mate.caja.desktop 'computer-icon-visible' 'false' ​
    gsettings set org.mate.background 'picture-filename' '/usr/share/backgrounds/linuxmint-rosa/ether_clouds_life.jpg'​
    gsettings set org.mate.background 'picture-options' 'stretched'​
    gsettings set org.mate.Marco.general 'num-workspaces' '1'​
    gsettings set org.mate.Marco.general 'compositing-manager' 'false'​
    gsettings set com.linuxmint.desktop 'mate-window-manager' 'marco'​
    gsettings set org.mate.Marco.global-keybindings 'run-command-1' '<Control><Shift>Escape'​
    gsettings set org.mate.Marco.keybinding-commands 'command-1' 'mate-system-monitor'​
    gsettings set org.mate.lockdown 'disable-lock-screen' 'true'​
    gsettings set org.mate.interface 'gtk-theme' 'Mint-X-Brown'​
    gsettings set org.mate.interface 'icon-theme' 'Mint-X-Brown'​
    if [ -f '/usr/share/applications/run-dialog.desktop' ]; then​
    gsettings set org.mate.panel 'show-program-list' 'true'​
    fi​
    if [ -f '/usr/share/mate-panel/layouts/custom01.layout' ]; then​
    gsettings set org.mate.panel 'default-layout' 'custom01'​
    gsettings set org.mate.Marco.global-keybindings 'panel-main-menu' 'Super_L'​
    mate-panel --reset​
    fi​
    gsettings set org.gnome.DejaDup 'exclude-list' "['\$TRASH']"​
    dconf reset -f '/org/mate/terminal/profiles/default/'​
    break​
    fi​
    ## If dconf database not writeable, try restore permission and owner, then retry, else skip​
    if [ "$RETRY" = '1' ]; then​
    printf '%s\n' 'Failed to restore permission and owner on dconf database or perhaps not a file?'​
    read -r umad​
    break​
    fi​
    printf '\n%s\n%s\n%s\n%s\n%s\n\n' \​
    'Warning, your dconf database is not writeable!' \​
    'current permissions are:' \​
    "$USERDIR/dconf/: '$(stat --format 'Owner:%U Perm:%a' 'dconf/')'" \​
    "$USERDIR/dconf/user: '$(stat --format 'Owner:%U Perm:%a' 'dconf/user')'" \​
    'I will try and see what I can do to fix it.'​
    sudof chown -R "$(id -un)" 'dconf/'​
    chgrp -R "$(id -un)" 'dconf/'​
    chmod 700 'dconf/'​
    if [ -f 'dconf/user' ]; then​
    chmod 600 'dconf/user'​
    fi​
    RETRY='1'​
    done​
    )​
    fi​
    elif [ -z "$SUDO_USER" ]; then
    printf '%s\n' 'This script should be run from a SUDO user, not pure root.'​
    exitf 1​
    else
    #### Everything here will run in only SUDO user​
    USERDIR='/etc/skel'​
    CONFIG="$USERDIR/.config"​
    LOCAL="$USERDIR/.local/share"​
    ## Enable firewall​
    ufw enable​
    ## Disable Eula screen of ttf mscorefonts fonts package​
    debconf-set-selections <<- 'END'​
    ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true​
    ttf-mscorefonts-installer msttcorefonts/present-mscorefonts-eula note​
    END​
    ## Enable install dpkg recommended packages​
    if [ -f '/etc/apt/apt.conf.d/00recommends' ]; then​
    mv -v '/etc/apt/apt.conf.d/00recommends' '/etc/apt/apt.conf.d/00recommends.disabled' >/dev/null​
    fi​
    ## Refresh and cleanup package cache and reconfigure any partially installed or broken packages​
    apt-get update​
    apt-get autoclean​
    dpkg --configure -a​
    ## Create function for apt-get and DPKG options so command can be easily reused​
    SILAPT() {​
    DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Progress-Fancy="1" -o Dpkg::Progress-Fancy::Progress-Bg="%1b[0m" -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" $@​
    }​
    ## Install softwares, purge some useless(my opinion) and upgrade all packages​
    SILAPT install rkhunter openshot openshot-doc frei0r-plugins cheese xfburn pinta quadrapassel mahjongg glchess gnect gnotravex gnome-sudoku gnomine aisleriot dconf-tools apparmor apparmor-profiles apparmor-utils gufw onboard gparted hardinfo deja-dup exfat-fuse exfat-utils ttf-mscorefonts-installer seahorse-nautilus app-install-data linux-firmware-nonfree language-pack-gnome-nl-base language-pack-gnome-nl language-pack-nl-base language-pack-nl firefox-locale-nl thunderbird-locale-nl thunderbird-locale-en libreoffice-l10n-nl libreoffice-help-nl myspell-nl​
    SILAPT autoremove --purge mint-search-addon mint-stylish-addon totem-mozilla icedtea-netx-common banshee brasero pidgin mintwelcome mintbackup mintupload mint-backgrounds-rafaela gimp gimp-data gimp-help-en gimp-help-nl gimp-help-common libgimp2.0​
    SILAPT dist-upgrade​
    ## Re/install Teamviewer if not installed or version different from online download​
    TMVER="$(dpkg -s teamviewer 2>&1 | grep "Version" | cut -d' ' -f2)"​
    if [ -z "$TMVER" ] || ! wget --spider -S 'http://download.teamviewer.com/download/teamviewer_i386.deb' 2>&1 | grep -q "$TMVER"; then​
    cd '/tmp'​
    wget -O 'teamviewer_linux.deb' 'http://download.teamviewer.com/download/teamviewer_i386.deb'​
    if [ -n "$TMVER" ]; then​
    SILAPT autoremove --purge teamviewer​
    fi​
    gdebi -n teamviewer_linux.deb​
    fi​
    ## Cleanup leftover packages​
    apt-get clean​
    RESDPACK="$(dpkg --get-selections | grep deinstall | cut -f1)"​
    if [ -n "$RESDPACK" ]; then​
    dpkg --purge $RESDPACK​
    fi​
    cd '/usr/share'​
    ## Create custom Mate-Panel layout that feels more like win 98​
    cat > 'mate-panel/layouts/custom01.layout' <<- 'END'​
    [Toplevel bottom]​
    expand=true​
    orientation=bottom​
    size=24​
    [Object menu]​
    object-type=menu​
    toplevel-id=bottom​
    position=0​
    locked=true​
    [Object show-desktop]​
    object-type=applet​
    applet-iid=WnckletFactory::ShowDesktopApplet​
    toplevel-id=bottom​
    position=10​
    locked=true​
    [Object separator]​
    object-type=separator​
    toplevel-id=bottom​
    position=20​
    locked=true​
    [Object launcher-caja]​
    object-type=launcher​
    launcher-location=/usr/share/applications/caja-browser.desktop​
    menu-path=applications:/​
    toplevel-id=bottom​
    position=30​
    locked=true​
    [Object launcher-terminal]​
    object-type=launcher​
    launcher-location=/usr/share/applications/mate-terminal.desktop​
    menu-path=applications:/​
    toplevel-id=bottom​
    position=40​
    locked=true​
    [Object launcher-firefox]​
    object-type=launcher​
    launcher-location=/usr/share/applications/firefox.desktop​
    menu-path=applications:/​
    toplevel-id=bottom​
    position=50​
    locked=true​
    [Object window-list]​
    object-type=applet​
    applet-iid=WnckletFactory::WindowListApplet​
    toplevel-id=bottom​
    position=60​
    locked=true​
    [Object notification-area]​
    object-type=applet​
    applet-iid=NotificationAreaAppletFactory::NotificationArea​
    toplevel-id=bottom​
    position=10​
    panel-right-stick=true​
    locked=true​
    [Object clock]​
    object-type=applet​
    applet-iid=ClockAppletFactory::ClockApplet​
    toplevel-id=bottom​
    position=0​
    panel-right-stick=true​
    locked=true​
    END​
    ## Create a menu entry for 'Run program'​
    cat > 'applications/run-dialog.desktop' <<- 'END'​
    [Desktop Entry]​
    Version=1.0​
    Name=Run program..​
    Comment=Run an application by typing a command or choosing from a list​
    Name[nl]=Programma uitvoeren..​
    Comment[nl]=Voer een programma uit via een commando of lijst​
    Exec=mate-panel --run-dialog​
    Icon=gnome-run​
    Terminal=false​
    Type=Application​
    Categories=GTK;System;Utility;​
    OnlyShowIn=MATE;​
    END​
    ## Prevent WineMenuBuilder if exists from creating new Wine associations and menu entries​
    if [ -f 'wine/wine.inf' ]; then​
    sed -i 's|winemenubuilder.exe -a -r|winemenubuilder.exe -r|' 'wine/wine.inf'​
    fi​
    ## Preconfigure default user settings​
    ( cd 'glib-2.0/schemas'​
    cat > 'mint-artwork-mate_custom01.gschema.override' <<- 'END'​
    [org.mate.interface]​
    gtk-theme='Mint-X-Brown'​
    icon-theme='Mint-X-Brown'​
    [org.mate.background]​
    picture-filename='/usr/share/backgrounds/linuxmint-rosa/ether_clouds_life.jpg'​
    [org.mate.caja.desktop]​
    computer-icon-visible=false​
    trash-icon-visible=true​
    [org.mate.Marco.general]​
    num-workspaces=1​
    compositing-manager=false​
    [org.mate.peripherals-touchpad]​
    horiz-scroll-enabled=true​
    [org.mate.Marco.keybinding-commands]​
    command-1='mate-system-monitor'​
    [org.mate.Marco.global-keybindings]​
    run-command-1='<Control><Shift>Escape'​
    panel-main-menu='Super_L'​
    [org.mate.power-manager]​
    action-critical-battery='suspend'​
    button-lid-ac='blank'​
    button-lid-battery='blank'​
    [org.mate.lockdown]​
    disable-lock-screen=true​
    [org.mate.panel]​
    show-program-list=true​
    [com.linuxmint.desktop]​
    mate-window-manager='marco'​
    [org.gnome.DejaDup]​
    exclude-list=['$TRASH']​
    [org.mate.terminal.profile]​
    background-type='solid'​
    END​
    cat > 'mate-panel_custom01.gschema.override' <<- 'END'​
    [org.mate.panel]​
    default-layout='custom01'​
    END​
    glib-compile-schemas './'​
    )​
    cd '/etc'​
    ## Enable all apparmor profiles and disable problematic ones​
    if ! aa-status | grep -q '0 profiles are in complain mode.'; then​
    service apparmor start​
    ( cd 'apparmor.d'​
    find './' -maxdepth 1 -type f -exec aa-enforce '{}' \;​
    aa-disable \​
    'usr.bin.chromium-browser' \​
    'usr.sbin.rsyslogd' \​
    'usr.sbin.dnsmasq' \​
    'usr.sbin.cupsd'​
    )​
    fi​
    ## Preconfigure MDM to a GDM based theme (better for weak systems)​
    if [ -f 'mdm/mdm.conf' ]; then​
    ( cd 'mdm'​
    if grep -q 'Greeter=' 'mdm.conf'; then​
    sed -i 's|Greeter=.*|Greeter=/usr/lib/mdm/mdmgreeter|' 'mdm.conf'​
    else​
    sed -i '/\[daemon\]/a \\nGreeter=/usr/lib/mdm/mdmgreeter' 'mdm.conf'​
    fi​
    if grep -q 'GraphicalTheme=' 'mdm.conf'; then​
    sed -i 's|GraphicalTheme=.*|GraphicalTheme=Arc-Dust-Userlist|' 'mdm.conf'​
    else​
    sed -i '/\[greeter\]/a \\nGraphicalTheme=Arc-Dust-Userlist' 'mdm.conf'​
    fi​
    )​
    for LIST in \​
    'greeter/GraphicalTheme' \​
    'daemon/Greeter'; do​
    if [ -e "$LIST" ]; then​
    mdmflexiserver -l -c "UPDATE_CONFIG $LIST"​
    fi​
    done​
    fi​
    ## Optimize swap usage for 1GB RAM systems​
    cat > 'sysctl.d/custom01_swap-usage.conf' <<- 'END'​
    # Decrease swap usage to a reasonable level​
    vm.swappiness=10​
    # Improve cache management​
    vm.vfs_cache_pressure=50​
    END​
    ## Refresh and update rkhunter file database​
    rkhunter --update​
    rkhunter --propupd​
    #### This command will run this script in normal user with parameter --nosudo​
    sudo -Hu "$SUDO_USER" sh -c "'$0' --nosudo"​
    fi #### Everything below here will run in both sudo and normal user cd "$USERDIR"
    ## Set age of recent used files in "recently-used.xbel" to 7 days​
    printf '%s\n' 'gtk-recent-files-max-age=7' > '.gtkrc-2.0'​
    ## Configure profile startup script to make Compiz config folder read-only so mintdesktop can't ruin our settings​
    if ! grep -q 'compiz_config_ro' '.profile'; then​
    cat >> '.profile' <<- END​
    if [ -f "\$HOME/.compiz_ro_config" ]; then​
    ${TAB}. "\$HOME/.compiz_config_ro"​
    fi​
    END​
    fi​
    cat > '.compiz_config_ro' <<- END​
    # Set Compiz config folder to read-only so mintdesktop can't ruin our settings​
    if grep -q 'profile = custom01' "\$HOME/.config/compiz-1/compizconfig/config"; then​
    ${TAB}if [ -w "\$HOME/.config/compiz-1/compizconfig/config" ]; then​
    ${TAB}${TAB}chmod -R -w "\$HOME/.config/compiz-1/compizconfig"​
    ${TAB}fi​
    fi​
    END​
    ## Preconfigure Firefox settings​
    if [ -f '.mozilla/firefox/profiles.ini' ]; then​
    FIRDIR=".mozilla/firefox/$(sed -n '0,/Path=/{s|Path=||p}' '.mozilla/firefox/profiles.ini')"​
    if [ -d "$FIRDIR" ]; then​
    ( cd "$FIRDIR"​
    mkdir -p 'searchplugins'​
    cat > 'searchplugins/google-ssl.xml' <<- 'END'​
    <SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/" xmlns:os="http://a9.com/-/spec/opensearch/1.1/">​
    <os:ShortName>Google SSL</os:ShortName>​
    <os:Description>Google SSL</os:Description>​
    <os:InputEncoding>UTF-8</os:InputEncoding>​
    <os:Image width="16" height="16">data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAAAAD0hUJK9IVC5/SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQuT0hUJK9IVC5vSFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC5/SFQv/0hUL/9IVC//SFQv/1jU7/+sir//7v5//95df/+9S9//vPtf/3oW7/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/+9jC//3s4f/1lFn/9IVC//SFQv/0iEb//NvH//eibv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//3u5f/5u5b/9IVC//SFQv/0hUL/9IVC//m6lP/707r/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/5vpv//N7M//SIR//0hUL/9IVC//WSV//97OH/+8+0//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//epev/6yKr/+byW//nCoP/+9O7//e3j//WSVv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SHRv/+9vH//OLT//WPUf/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//aeaf/5uZL////+//iwhf/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//m4kf//+/n/96h5//WNT//7zbL/9p9q//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/+9fD/+86z//SFQv/0hUL/96Rx//3r4P/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL//vby//iwhf/0hUL/9IVC//izif//+/j/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//rIqf/5vJf/9IVC//SGRP/95NX/+9a///SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hkT/+bqU//m7lv/84dD///79//rLr//3p3f/9IVC//SFQv/0hUL/9IVC//SFQub0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQub0hUJJ9IVC5vSFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQub0hUJJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</os:Image>​
    <SearchForm>https://www.google.com/</SearchForm>​
    <os:Url type="text/html" method="GET" template="https://www.google.com/search?q={searchTerms}" resultDomain="google.com">​
    </os:Url><os:Url type="application/x-suggestions+json" method="GET" template="https://suggestqueries.google.com/complete/search?output=firefox&amp;client=firefox&amp;hl=en&amp;q={searchTerms}" resultDomain="suggestqueries.google.com">​
    </os:Url><os:Url type="application/opensearchdescription+xml" method="GET" template="http://mycroftproject.com/updateos.php/id0/google-com-ssl.xml" rel="self" resultDomain="mycroftproject.com">​
    </os:Url>​
    </SearchPlugin>​
    END​
    PROFILE="$(basename "$FIRDIR")"​
    PROVIDER='Google SSL'​
    DISCLAIMER='By modifying this file, I agree that I am doing so only within Firefox itself, using official, user-driven search engine selection processes, and in a way which does not circumvent user consent. I acknowledge that any attempt to change this file from outside of Firefox is a malicious act, and will be responded to accordingly.'​
    cat > 'search-metadata.json' <<- END​
    {​
    "[global]": {​
    $TAB"current": "$PROVIDER",​
    $TAB"hash": "$(printf '%s' "$PROFILE$PROVIDER$DISCLAIMER" | openssl sha256 -binary | base64)"​
    }​
    }​
    END​
    for LIST in \​
    'browser.startup.homepage|"https://www.google.nl/"' \​
    'general.smoothScroll|true' \​
    'general.autoScroll|true' \​
    'privacy.donottrackheader.enabled|true' \​
    'signon.rememberSignons|false' \​
    'datareporting.healthreport.uploadEnabled|false'\​
    "browser.search.selectedEngine|\"$PROVIDER\"";do​
    LIST1=$(echo $LIST | cut -d'|' -f1)​
    LIST2=$(echo $LIST | cut -d'|' -f2)​
    if grep -q "\"$LIST1\"" 'prefs.js'; then​
    sed -i "s|.*\"$LIST1\".*|user_pref(\"$LIST1\", $LIST2);|" 'prefs.js'​
    else​
    printf "%s\n" "user_pref("$LIST1", $LIST2);" >> 'prefs.js'​
    fi​
    done​
    mkdir -p 'extensions'​
    wget -O 'extensions/uBlock0@raymondhill.net.xpi' 'https://addons.mozilla.org/firefox/downloads/latest/607454/addon-607454-latest.xpi'​
    )​
    fi​
    fi​
    ( cd "$CONFIG"​
    ## Preconfigure Compiz Settings​
    if [ -d 'compiz-1/compizconfig' ]; then​
    chmod -R +w 'compiz-1/compizconfig'​
    else​
    mkdir -p 'compiz-1/compizconfig'​
    fi​
    ( cd 'compiz-1/compizconfig'​
    cat > 'config' <<- 'END'​
    [general]​
    integration = true​
    profile = custom01​
    backend = ini​
    END​
    cat > 'custom01.ini' <<- 'END'​
    [core]​
    s0_active_plugins = core;composite;crashhandler;opengl;compiztoolbox;decor;gnomecompat;mousepoll;ezoom;move;staticswitcher;regex;grid;resize;titleinfo;animation;​
    s0_focus_prevention_match = !(class=Polkit-gnome-authentication-agent-1) & !(class=MintMenu.py)​
    s0_outputs = 1920x975+0+0;​
    [gnomecompat]​
    s0_command_screenshot = mate-screenshot​
    s0_command_window_screenshot = mate-screenshot --window​
    s0_command_terminal = mate-terminal​
    [crashhandler]​
    s0_wm_cmd = marco --replace​
    [commands]​
    s0_command20 = ​
    s0_run_command20_key = Disabled​
    [ezoom]​
    s0_zoom_in_button = <Control><Alt>Button4​
    s0_zoom_in_key = <Control><Alt>equal​
    s0_zoom_out_key = <Control><Alt>minus​
    s0_zoom_out_button = <Control><Alt>Button5​
    s0_zoom_specific_1_key = <Control><Alt>0​
    s0_follow_focus = false​
    [grid]​
    s0_top_left_corner_action = 7​
    s0_top_right_corner_action = 9​
    s0_bottom_left_corner_action = 1​
    s0_bottom_right_corner_action = 3​
    s0_bottom_edge_action = 2​
    s0_outline_color = #84fb009f​
    s0_fill_color = #74fb004f​
    s0_put_center_key = Disabled​
    s0_put_restore_key = Disabled​
    s0_put_maximize_key = Disabled​
    [resize]​
    s0_border_color = #7dfb009f​
    s0_fill_color = #8afb0019​
    [animation]​
    s0_unminimize_effects = ​
    s0_unminimize_durations = ​
    s0_unminimize_matches = ​
    s0_unminimize_options = ​
    [cube]​
    s0_top_color = #3c3c3cff​
    s0_bottom_color = #3c3c3cff​
    s0_skydome = true​
    s0_skydome_gradient_start_color = #000000ff​
    s0_skydome_gradient_end_color = #727272ff​
    [expo]​
    s0_expo_key = <Control><Alt>Up​
    s0_reflection = true​
    s0_selected_color = #000000ff​
    [wall]​
    s0_up_key = Disabled​
    s0_down_key = Disabled​
    [wobbly]​
    s0_snap_inverted = true​
    END​
    )​
    if [ "$(id -u)" -ne 0 ]; then​
    chmod -R -w 'compiz-1/compizconfig'​
    fi​
    ## Preconfigure Libreoffice file save settings​
    mkdir -p 'libreoffice/4/user'​
    cat > 'libreoffice/4/user/registrymodifications.xcu' <<- 'END'​
    <?xml version="1.0" encoding="UTF-8"?>​
    <oor:items xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">​
    <item oor:path="/org.openoffice.Setup/Office/Factories/org.openoffice.Setup:Factory['com.sun.star.presentation.PresentationDocument']"><prop oor:name="ooSetupFactoryDefaultFilter" oor:op="fuse"><value>MS PowerPoint 97</value></prop></item>​
    <item oor:path="/org.openoffice.Setup/Office/Factories/org.openoffice.Setup:Factory['com.sun.star.sheet.SpreadsheetDocument']"><prop oor:name="ooSetupFactoryDefaultFilter" oor:op="fuse"><value>MS Excel 97</value></prop></item>​
    <item oor:path="/org.openoffice.Setup/Office/Factories/org.openoffice.Setup:Factory['com.sun.star.text.TextDocument']"><prop oor:name="ooSetupFactoryDefaultFilter" oor:op="fuse"><value>MS Word 97</value></prop></item>​
    </oor:items>​
    END​
    ## Preconfigure Mint Update manager​
    mkdir -p 'linuxmint'​
    cat > 'linuxmint/mintUpdate.conf' <<- 'END'​
    [general]​
    hide_window_after_update = False​
    hide_systray = True​
    default_repo_is_ok = True​
    [levels]​
    level1_visible = True​
    level2_visible = True​
    level3_visible = True​
    level4_visible = False​
    level5_visible = False​
    level1_safe = True​
    level2_safe = True​
    level3_safe = True​
    level4_safe = False​
    level5_safe = False​
    security_visible = True​
    security_safe = True​
    [refresh]​
    refresh_days = 0​
    refresh_hours = 0​
    refresh_minutes = 5​
    autorefresh_days = 0​
    autorefresh_hours = 2​
    autorefresh_minutes = 0​
    [update]​
    dist_upgrade = True​
    [icons]​
    busy = /usr/lib/linuxmint/mintUpdate/icons/base.svg​
    up2date = /usr/lib/linuxmint/mintUpdate/icons/base-apply.svg​
    updates = /usr/lib/linuxmint/mintUpdate/icons/base-info.svg​
    error = /usr/lib/linuxmint/mintUpdate/icons/base-error2.svg​
    unknown = /usr/lib/linuxmint/mintUpdate/icons/base.svg​
    apply = /usr/lib/linuxmint/mintUpdate/icons/base-exec.svg​
    END​
    ## Create a menu entry for 'Run program' in 'System' menu​
    if [ -f '/usr/share/applications/run-dialog.desktop' ]; then​
    mkdir -p 'menus'​
    cat > 'menus/mate-settings.menu' <<- END​
    <!DOCTYPE Menu​
    PUBLIC '-//freedesktop//DTD Menu 1.0//EN'​
    'http://standards.freedesktop.org/menu-spec/menu-1.0.dtd'>​
    <Menu>​
    ${TAB}<Name>Desktop</Name>​
    ${TAB}<MergeFile type="parent">/etc/xdg/menus/mate-settings.menu</MergeFile>​
    ${TAB}<Include>​
    ${TAB}${TAB}<Filename>run-dialog.desktop</Filename>​
    ${TAB}</Include>​
    </Menu>​
    END​
    fi​
    )​
    ## Preconfigure Wine associations and menu entries​
    mkdir -p "$LOCAL"​
    ( cd "$LOCAL"​
    if [ -f 'applications/wine-extension-exe.desktop' ]; then​
    rm -f mime/packages/x-wine*​
    rm -f applications/wine-extension*​
    rm -f icons/hicolor/*/*/application-x-wine-extension*​
    rm -f mime/application/x-wine-extension*​
    fi​
    mkdir -p 'applications'​
    ( cd 'applications'​
    ## Configure VLC as default for Video and Audio files​
    cat > 'mimeapps.list' <<- 'END'​
    [Removed Associations]​
    application/x-msi=wine.desktop;​
    application/x-ms-dos-executable=mono-runtime-terminal.desktop;mono-runtime-common.desktop;wine.desktop;​
    application/x-ms-shortcut=wine.desktop;​
    [Default Applications]​
    audio/mpeg=vlc.desktop​
    audio/x-mpegurl=vlc.desktop​
    audio/x-scpls=vlc.desktop​
    audio/x-vorbis+ogg=vlc.desktop​
    audio/x-wav=vlc.desktop​
    video/mp4=vlc.desktop​
    video/mpeg=vlc.desktop​
    video/mp2t=vlc.desktop​
    video/msvideo=vlc.desktop​
    video/quicktime=vlc.desktop​
    video/webm=vlc.desktop​
    video/x-avi=vlc.desktop​
    video/x-flv=vlc.desktop​
    video/x-matroska=vlc.desktop​
    video/x-mpeg=vlc.desktop​
    video/x-ogm+ogg=vlc.desktop​
    END​
    cat > 'wine-uninstaller.desktop' <<- 'END'​
    [Desktop Entry]​
    Exec=wine uninstaller​
    Hidden=true​
    Name=Uninstall Wine Software​
    Type=Application​
    END​
    cat > 'wine-winecfg.desktop' <<- 'END'​
    [Desktop Entry]​
    Exec=winecfg​
    Hidden=true​
    Name=Configure Wine​
    Type=Application​
    END​
    cat > 'wine-browsedrive.desktop' <<- 'END'​
    [Desktop Entry]​
    Exec=xdg-open .wine/dosdevices/c:​
    Hidden=true​
    Name=Browse C: Drive​
    Type=Application​
    END​
    cat > 'wine-notepad.desktop' <<- 'END'​
    [Desktop Entry]​
    Exec=notepad​
    Hidden=true​
    Name=Notepad​
    Type=Application​
    END​
    )​
    mkdir -p 'keyrings'​
    cat > 'keyrings/login.keyring' <<- 'END'​
    [keyring]​
    display-name=custom01​
    ctime=0​
    mtime=0​
    lock-on-idle=false​
    lock-after=false​
    END​
    )​
    ## Delete bash command history cd "$HOME"
    if [ -f '.bash_history' ]; then​
    rm '.bash_history'​
    fi​
    exitf 0
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...