Unattended install script, need checkup on it

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
hupnuk
Level 1
Level 1
Posts: 18
Joined: Sat Mar 29, 2014 9:36 pm

Unattended install script, need checkup on it

Post by hupnuk »

Hello Mint users,

I made a script for myself which automates 80% of my work for installs/configuring/updates when I need to install Linux Mint 13 Mate on someone's system.
It is also needed for a Computer repair store i work for which i convinced to install Linux Mint 13 Mate on all of their hundreds of old PC's containing 1024GB RAM and Intel pentium 4,D and AMD Cpu's they giveaway to people who are poor but need a internet for their job.
I hoped that you guys could give me some improvements on it, the company depends on me of dealing with problems on Unix filesystems as they can only work on Windows.
They can install from DVD and use this script after, but are not able to solve problems that may arise or configure the system themself outside of what i learn them.
I want the system to be secure and very usable for any user so i need any error i made ironed out of it.

Code: Select all

#!/bin/sh

#Gives the script sudo rights every 1 minute, so if a commond takes to long, the next won't ask for password.
sudo -v
if ! sudo -n uptime > /dev/null 2>&1; then exit; fi
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &

#Enable Firewall
sudo ufw enable

if ! grep -q 'vm.swappiness=10' "/etc/sysctl.conf"
 then sudo sh -c 'echo "# Decrease swap usage to a reasonable level
vm.swappiness=10
# Improve cache management
vm.vfs_cache_pressure=50" >> "/etc/sysctl.conf"'
fi

#Disable Hibernation
sudo sed -i '40s|yes|no|' "/usr/share/polkit-1/actions/org.freedesktop.upower.policy"

#Change Plymouth bootscreen to something better then a black screen
sudo update-alternatives --set text.plymouth /lib/plymouth/themes/mint-text/mint-text.plymouth
sudo update-alternatives --set default.plymouth /lib/plymouth/themes/mint-logo/mint-logo.plymouth
sudo update-initramfs -u

if [ -e "/etc/linuxmint/mintUpdate.conf" ]
	then if grep 'level4_visible = False' "/etc/linuxmint/mintUpdate.conf"
		then sudo sed -i -e 's|level4_visible =.*|level4_visible = true|' -e 's|level5_visible =.*|level5_visible = True|' -e 's|level4_safe =|level4_safe = False|' -e 's|level5_safe =.*|level5_safe = False|' -e 's|timer_minutes = 15|timer_minutes = 0|' -e 's|timer_days = 0|timer_days = 1|' "/etc/linuxmint/mintUpdate.conf"
	fi
	else sudo sh -c 'echo "[levels]
level1_visible = True
level2_visible = True
level3_visible = True
level4_visible = True
level5_visible = True
level1_safe = True
level2_safe = True
level3_safe = True
level4_safe = False
level5_safe = False
[refresh]
timer_minutes = 0
timer_hours = 0
timer_days = 1" > "/etc/linuxmint/mintUpdate.conf"'
fi

sudo sed -i '\|packages.medibuntu.org|d' "/etc/apt/sources.list"
if grep -q 'packages.linuxmint.com' "/etc/apt/sources.list"
	then sudo sed -i 's|.*maya.*|deb http://mintlinux.mirror.triple-it.nl/packages/ maya main upstream import|' "/etc/apt/sources.list"
fi

mateconftool-2 -s '/apps/marco/general/num_workspaces' --type=string '1'
mateconftool-2 -s '/apps/caja/desktop/computer_icon_visible' --type=bool 'false'
mateconftool-2 -s '/apps/caja/desktop/trash_icon_visible' --type=bool 'true'
mateconftool-2 -s '/desktop/mate/keybindings/custom0/action' --type=string 'mate-system-monitor'
mateconftool-2 -s '/desktop/mate/keybindings/custom0/binding' --type=string '<Primary><Shift>Escape'
mateconftool-2 -s '/desktop/mate/keybindings/custom0/name' --type=string 'Task Manager'
mateconftool-2 -s '/desktop/mate/background/picture_filename' --type=string '/usr/share/backgrounds/linuxmint-maya-extra/panama.jpg'
mateconftool-2 -s '/apps/mate-power-manager/actions/critical_battery' --type=string 'suspend'
mateconftool-2 -s '/apps/mate-power-manager/buttons/lid_ac' --type=string 'blank'
mateconftool-2 -s '/apps/mate-power-manager/buttons/lid_battery' --type=string 'blank'

#Preconfigure EVErything in Firefox so i do not have to :)
FIRPRFIL="$HOME/.mozilla/firefox/$(sed -n 's|.*Path=||p' "$HOME/.mozilla/firefox/profiles.ini")"
if [ -e "$FIRPRFIL" ]
	then echo '<?xml version="1.0"?>
<RDF:RDF xmlns:NC="http://home.netscape.com/NC-rdf#"
         xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <RDF:Description RDF:about="chrome://browser/content/browser.xul">
    <NC:persist RDF:resource="chrome://browser/content/browser.xul#toolbar-menubar"/>
    <NC:persist RDF:resource="chrome://browser/content/browser.xul#nav-bar"/>
    <NC:persist RDF:resource="chrome://browser/content/browser.xul#navigator-toolbox"/>
  </RDF:Description>
  <RDF:Description RDF:about="chrome://browser/content/browser.xul#toolbar-menubar"
                   autohide="true" />
  <RDF:Description RDF:about="chrome://browser/content/browser.xul#nav-bar"
                   currentset="unified-back-forward-button,home-button,urlbar-container,reload-button,stop-button,search-container,downloads-button,bookmarks-button,history-button,fullscreenflex,window-controls" />
  <RDF:Description RDF:about="chrome://browser/content/history/history-panel.xul#viewButton"
                   selectedsort="lastvisited" />
  <RDF:Description RDF:about="chrome://browser/content/history/history-panel.xul">
    <NC:persist RDF:resource="chrome://browser/content/history/history-panel.xul#viewButton"/>
  </RDF:Description>
  <RDF:Description RDF:about="chrome://browser/content/browser.xul#navigator-toolbox"
                   abp-iconposition="hidden,nav-bar," />
  <RDF:Description RDF:about="chrome://browser/content/browser.xul#PersonalToolbar"
                   collapsed="true" />
</RDF:RDF>' > "$FIRPRFIL/localstore.rdf"
	mkdir "$FIRPRFIL/searchplugins"
	echo '<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/" xmlns:os="http://a9.com/-/spec/opensearch/1.1/">
<os:ShortName>Google</os:ShortName>
<os:Description>Google</os:Description>
<os:InputEncoding>UTF-8</os:InputEncoding>
<os:Image width="16" height="16">data:image/x-icon;base64,AAABAAIAEBAAAAEAIABoBAAAJgAAACAgAAABACAAqBAAAI4EAAAoAAAAEAAAACAAAAABACAAAAAAAAAEAAASCwAAEgsAAAAAAAAAAAAA9IVCSvSFQuf0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hULk9IVCSvSFQub0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQuf0hUL/9IVC//SFQv/0hUL/9Y1O//rIq//+7+f//eXX//vUvf/7z7X/96Fu//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//vYwv/97OH/9ZRZ//SFQv/0hUL/9IhG//zbx//3om7/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/97uX/+buW//SFQv/0hUL/9IVC//SFQv/5upT/+9O6//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/+b6b//zezP/0iEf/9IVC//SFQv/1klf//ezh//vPtP/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/3qXr/+siq//m8lv/5wqD//vTu//3t4//1klb/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0h0b//vbx//zi0//1j1H/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/2nmn/+bmS/////v/4sIX/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/5uJH///v5//eoef/1jU//+82y//afav/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL//vXw//vOs//0hUL/9IVC//ekcf/96+D/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//728v/4sIX/9IVC//SFQv/4s4n///v4//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/6yKn/+byX//SFQv/0hkT//eTV//vWv//0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IZE//m6lP/5u5b//OHQ///+/f/6y6//96d3//SFQv/0hUL/9IVC//SFQv/0hULm9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hULm9IVCSfSFQub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hUL/9IVC//SFQv/0hUL/9IVC//ekcv/+8+z////////////+9fD/+9K5//m9mf/4to7/+buV//vSuf/++PT//OPT//aYYP/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/2l13///r3/////////fv/+b2Z//SIRv/0hUL/9IVC//SFQv/0hUL/9IVC//WNT//84M///vXv//aZYf/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//vPtP////////////i0i//0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//WQUv///Pr//OPU//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL//eTV///////+9O7/9IVD//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//3m2P//////9ppi//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/718H///////3s4f/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL//vDn///////4soj/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//erff////////38//WTWP/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//iziv////////////iwhf/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//rMsP///////eXW//WSVv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/4sYb///z7/////////Pv/9ZFV//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//ixhv/+8Of//vn1//rMsP/4rH//9plh//WQUv/1j1L/+s2x//////////////////m9mf/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SGQ//2nmn/+buW//vNsv/82sb//e3j/////////////////////v/5wZ//9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/
0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/83Mj////////////++fb/+K+C//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9ZRZ/////////////vTt//aaYv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/1lFr////////////6xqf/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//ehbf/70bj//end//3o2////v3///////3l1//0iEb/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/5wqD////////////96t7/96Z2//WOUP/2nWf//NvH//zcyP/1i0z/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/96l6/////////////vLr//WPUf/0hUL/9IVC//SFQv/0h0b//end//3k1f/0iUn/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/8387////////////4sYf/9IVC//SFQv/0hUL/9IVC//SFQv/6w6L///////nBn//0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC///69////////vj1//SIR//0hUL/9IVC//SFQv/0hUL/9IVC//m+mv///////e3j//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL///r3///////8387/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/+syw///////++fb/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/95NX///////vUvP/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/97OH///////7y6//0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//i2jv///////N/O//SFQv/0hUL/9IVC//SFQv/0hUL/96Nx////////////+s2x//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IdF//zh0P//+/j/9ZJW//SFQv/0hUL/9IVC//SKSv/96t7///////738v/1k1f/9IVC//SFQv/0hUL/9IVC//SFQv/0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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAB</os:Image>
<os:Url type="text/html" method="GET" template="http://www.google.com/search?q={searchTerms}">
</os:Url>
</SearchPlugin>' > "$FIRPRFIL/searchplugins/google.xml"
	if grep '"browser.startup.homepage"' "$FIRPRFIL/prefs.js"
		then sed -i 's|.*"browser.startup.homepage".*|user_pref("browser.startup.homepage", "https://www.google.nl/");|' "$FIRPRFIL/prefs.js"
		else echo 'user_pref("browser.startup.homepage", "https://www.google.nl/");' >> "$FIRPRFIL/prefs.js"
	fi
	if grep -q '"browser.search.order.1", "Yahoo"' "$FIRPRFIL/prefs.js"
		then sed -i -e 's|.*"browser.search.order.1", "Yahoo".*|user_pref("browser.search.order.3", "Yahoo");|' -e 's|.*"browser.search.selectedEngine".*|user_pref("browser.search.selectedEngine", "Google");|' "$FIRPRFIL/prefs.js"
		echo 'user_pref("browser.search.order.1", "Google");' >> "$FIRPRFIL/prefs.js"
	fi
	if grep '"general.smoothScroll"' "$FIRPRFIL/prefs.js"
		then sed -i 's|.*"general.smoothScroll".*|user_pref("general.smoothScroll", true);|' "$FIRPRFIL/prefs.js"
		else echo 'user_pref("general.smoothScroll", true);' >> "$FIRPRFIL/prefs.js"
	fi
	if grep 'general.autoScroll' "$FIRPRFIL/prefs.js"
		then sed -i 's|.*"general.autoScroll".*|user_pref("general.autoScroll", true);|' "$FIRPRFIL/prefs.js"
		else echo 'user_pref("general.autoScroll", true);' >> "$FIRPRFIL/prefs.js"
	fi
	if grep '"privacy.donottrackheader.enabled"' "$FIRPRFIL/prefs.js"
		then sed -i 's|.*"privacy.donottrackheader.enabled".*|user_pref("privacy.donottrackheader.enabled", true);|' "$FIRPRFIL/prefs.js"
		else echo 'user_pref("privacy.donottrackheader.enabled", true);' >> "$FIRPRFIL/prefs.js"
	fi
	if grep '"signon.rememberSignons"' "$FIRPRFIL/prefs.js"
		then sed -i 's|.*"signon.rememberSignons".*|user_pref("signon.rememberSignons", false);|' "$FIRPRFIL/prefs.js"
		else echo 'user_pref("signon.rememberSignons", false);' >> "$FIRPRFIL/prefs.js"
	fi
	if grep '"datareporting.healthreport.uploadEnabled"' "$FIRPRFIL/prefs.js"
		then sed -i 's|.*"datareporting.healthreport.uploadEnabled".*|user_pref("datareporting.healthreport.uploadEnabled", false);|' "$FIRPRFIL/prefs.js"
		else echo 'user_pref("datareporting.healthreport.uploadEnabled", false);' >> "$FIRPRFIL/prefs.js"
	fi
	if ! grep '"browser.migration.version"' "$FIRPRFIL/prefs.js"
		then echo 'user_pref("browser.migration.version", 2);' >> "$FIRPRFIL/prefs.js"
	fi
	mkdir "$FIRPRFIL/extensions"
	cd "$FIRPRFIL/extensions"
	wget -O '{fe272bd1-5f76-4ea4-8501-a05d35d823fc}.xpi' 'https://addons.mozilla.org/firefox/downloads/latest/394968/platform:2/addon-394968-latest.xpi'
fi

#Preconfigure Libreoffice to save files as more accepted document formats
mkdir -p "$HOME/.config/libreoffice/3/user"
echo '<?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>' > "$HOME/.config/libreoffice/3/user/registrymodifications.xcu"

sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install wdutch language-pack-nl firefox-locale-nl poppler-data myspell-nl openoffice.org-hyphenation libreoffice-l10n-nl libreoffice-help-nl language-pack-gnome-nl gimp-help-nl thunderbird-locale-nl libreoffice-l10n-en-za thunderbird-locale-en-us thunderbird-locale-en-gb libreoffice-help-en-gb hunspell-en-ca hyphen-en-us myspell-en-au myspell-en-gb mythes-en-au gimp-help-en myspell-en-za wbritish mythes-en-us openjdk-7-jre chkrootkit rkhunter clamtk openshot cheese clementine gnote quadrapassel mahjongg glchess gnect gnotravex gnome-sudoku gnomine aisleriot dconf-tools libpam-cracklib apparmor apparmor-profiles apparmor-utils

#Remove unsafe or redundant applications
sudo apt-get -y autoremove --purge medibuntu-keyring mint-search-addon mint-stylish-addon gecko-mediaplayer totem totem-common gir1.2-totem-1.0 gir1.2-totem-plparser-1.0 libtotem0 openjdk-6-jre openjdk-6-jre-lib icedtea-netx-common icedtea-7-jre-jamvm mint-flashplugin mint-flashplugin-11 postfix

sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install libreoffice flashplugin-installer

sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade

cd "/tmp"
wget -O teamviewer_linux.deb 'http://download.teamviewer.com/download/teamviewer_linux.deb'
sudo gdebi --n teamviewer_linux.deb

sudo apt-get clean
#Cleanup leftovers from applications which are already removed
sudo dpkg --purge $(dpkg --get-selections | grep deinstall | cut -f1)

cd '/usr/share/applications'
cp 'firefox.desktop' 'vlc.desktop' 'gimp.desktop' 'teamviewer-teamviewer9.desktop' 'libreoffice-writer.desktop' 'libreoffice-calc.desktop' "$HOME/Bureaublad"
chmod +x $HOME/Bureaublad/*.desktop

sudo /etc/init.d/apparmor start
sudo aa-enforce /etc/apparmor.d/*
sudo aa-disable /etc/apparmor.d/usr.bin.firefox
sudo aa-disable /etc/apparmor.d/usr.sbin.rsyslogd
sudo aa-disable /etc/apparmor.d/usr.sbin.dnsmasq
sudo aa-disable /etc/apparmor.d/usr.sbin.cupsd

sudo sed -i 's|#GRUB_HIDDEN_TIMEOUT=0|GRUB_HIDDEN_TIMEOUT=0|' "/etc/default/grub"
sudo update-grub

#Preconfigure MDM to have a more, suiting login screen for users (most hate having to type both there usernames and password...)
if [ -e "/etc/mdm/mdm.conf" ]
	then if grep -q 'Greeter=' "/etc/mdm/mdm.conf"
		then sudo sed -i 's|Greeter=.*|Greeter=/usr/lib/mdm/mdmgreeter|' "/etc/mdm/mdm.conf"
		else sudo sed -i '/\[daemon\]/a \\nGreeter=/usr/lib/mdm/mdmgreeter' "/etc/mdm/mdm.conf"
	fi
	if grep -q 'GraphicalTheme=' "/etc/mdm/mdm.conf"
		then sudo sed -i 's|GraphicalTheme=.*|GraphicalTheme=Arc-Wise-Userlist|' "/etc/mdm/mdm.conf"
		else sudo sed -i '/\[greeter\]/a \\nGraphicalTheme=Arc-Wise-Userlist' "/etc/mdm/mdm.conf"
	fi
	sudo mdmflexiserver -l -c "UPDATE_CONFIG greeter/GraphicalTheme"
	sudo mdmflexiserver -l -c "UPDATE_CONFIG daemon/Greeter"
fi

sudo rkhunter --propupd
exit
It is quite long but for any confusing parts i gave a small explanation what it means.

Thanks in advance.
If you want to use this script, be my guest, it has been tested about 100 of times and is completely unattended, so far it works great.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
Pierre
Level 21
Level 21
Posts: 13227
Joined: Fri Sep 05, 2008 5:33 am
Location: Perth, AU.

Re: Unattended install script, need checkup on it

Post by Pierre »

did part of it, set the Mint update levels 4 & 5 - to true, as in visible / working ?.
as a rule, on a new setup, mine UN-ckecks level 3, as it has lots of updates,- to install,
& leaves levels 4 & 5 as-is ..

- can you give a list of what it does?
- do you assume access to a *dsl connection - ie: high speed 'net access ..

- part of the reason, for limiting some downloads, after a new install, - is a poor 'net connection ..
the rest of it, looks great.

- something that can be run, after, the install, is completed,
rather than gradually, is is currently done, here.
Image
Please edit your original post title to include [SOLVED] - when your problem is solved!
and DO LOOK at those Unanswered Topics - - you may be able to answer some!.
hupnuk
Level 1
Level 1
Posts: 18
Joined: Sat Mar 29, 2014 9:36 pm

Re: Unattended install script, need checkup on it

Post by hupnuk »

Pierre wrote:did part of it, set the Mint update levels 4 & 5 - to true, as in visible / working ?.
as a rule, on a new setup, mine UN-ckecks level 3, as it has lots of updates,- to install,
& leaves levels 4 & 5 as-is ..
Level 4 and 5 are both already set to be Visible, but not set to be checked by default, not set to Safe.
Pierre wrote:- can you give a list of what it does?
- do you assume access to a *dsl connection - ie: high speed 'net access ..

- part of the reason, for limiting some downloads, after a new install, - is a poor 'net connection ..
This question confuses me, do you mean the Dutch mirror i set in de script?
If so, i did that as the people we give away the PC's to live in The Netherlands and it would be unlogical for me to not to enable the fastest mirror close by.
Pierre wrote:can you give a list of what it does?
  • • Enable Firewall
    • Set Swappiness to a more suited setting for old PC's
    • Disable Hibernation
    • Change Plymouth bootscreen to something better then a black screen
    • Preconfigure MintUpdate to have Level 4 and 5 Visible but not Safe and to check for updates once a day instead of every 15 minutes...
    • Remove Medibuntu source from sources.list to avoid update errors and a Fast mirror for Dutch people
    • Set workspaces to 1 to avoid people accidently putting windows on other workspaces
    • Set a keyboard shortcut (Ctrl+Shift+Esc) to open Gnome/Mate system monitor
    • Set Power settings to not Hibernate when closing a laptop screen, but just blank the screen
    • Configure Firefox's UI, install Google Search and set that to active, disable privacy disrespecting settings and some enable autoscroll, smoothscroll
    • Preconfigure Libreoffice to save files as more accepted document formats
    • Install all the missing language packages, replace Opendjk 6 with 7, some security tools, teamviewer, partition editor, webcam software, video editor and some games.
    • Remove unsafe or redundant applications
    • Install all the Updates
    • Cleanup downloaded packages and leftovers
    • Place shortcuts of most used applications on desktop
    • Configure Apparmor for maximum security, but disable some lists to avoid problems
    • Preconfigure MDM to have a more, suiting login screen for users (most hate having to type both there usernames and password...
pfew, that was alot 8)
Pierre wrote:- something that can be run, after, the install, is completed,
Do you mean like a popup saying it is done?
Locked

Return to “Scripts & Bash”