| 20 | | # Grant a user superuser priviliges |
|---|
| 21 | | sudoers () { |
|---|
| 22 | | USER=$1 |
|---|
| 23 | | if nullstr $USER; then warning "no user given"; return; fi |
|---|
| 24 | | if ! grep -q -e "^$USER" /etc/sudoers; then |
|---|
| 25 | | echo "$USER ALL=NOPASSWD: ALL" >> /etc/sudoers |
|---|
| 26 | | else |
|---|
| 27 | | warning "$USER already in sudoers" |
|---|
| 28 | | fi |
|---|
| 29 | | } |
|---|
| 30 | | |
|---|
| 31 | | # Add a user to system groups |
|---|
| 32 | | groups () { |
|---|
| 33 | | user=$1 |
|---|
| 34 | | if nullstr $user; then warning "no user given"; return; fi |
|---|
| 35 | | if nullstr $2; then |
|---|
| 36 | | groups="disk camera scanner netdev stb-admin adm audio" |
|---|
| 37 | | else |
|---|
| 38 | | shift |
|---|
| 39 | | groups=$@ |
|---|
| 40 | | fi |
|---|
| 41 | | if grep -q -e "^$user:" /etc/passwd; then |
|---|
| 42 | | for group in $groups; do |
|---|
| 43 | | if ! grep -q -e "^$group:" /etc/group; then |
|---|
| 44 | | addgroup --system $group |
|---|
| 45 | | fi |
|---|
| 46 | | if ! grep -q -e "^$group.*$user\(,\|\$\)" /etc/group; then |
|---|
| 47 | | adduser $user $group |
|---|
| 48 | | fi |
|---|
| 49 | | done |
|---|
| 50 | | else |
|---|
| 51 | | warning "$user does not exist" |
|---|
| 52 | | fi |
|---|
| 53 | | } |
|---|
| 54 | | |
|---|
| 55 | | # Disable unwanted services |
|---|
| 56 | | services () { |
|---|
| 57 | | if nullstr $1; then warning "no services given"; return 1; fi |
|---|
| 58 | | services=$@ |
|---|
| 59 | | for service in $services; do |
|---|
| 60 | | update-rc.d -f $service remove |
|---|
| 61 | | done |
|---|
| 62 | | } |
|---|
| 63 | | |
|---|
| 64 | | # Add kernel modules at boot |
|---|
| 65 | | modules () { |
|---|
| 66 | | if nullstr $1; then warning "no modules given"; return 1; fi |
|---|
| 67 | | modules=$@ |
|---|
| 68 | | for module in $modules; do |
|---|
| 69 | | if ! grep -q $module /etc/modules; then |
|---|
| 70 | | echo $module >> /etc/modules |
|---|
| 71 | | fi |
|---|
| 72 | | done |
|---|
| 73 | | } |
|---|
| 74 | | # If network is available, run apt-get update, otherwise comment the source list |
|---|
| 75 | | apt () { |
|---|
| 76 | | if nullstr $1; then warning "no list given"; return 1; fi |
|---|
| 77 | | suite=$1 |
|---|
| 78 | | mother=$2 |
|---|
| 79 | | list=/etc/apt/sources.list.d/$suite.list |
|---|
| 80 | | if ! exists $list; then |
|---|
| 81 | | echo "deb http://apt.64studio.com/$suite/stable $mother main" > $list |
|---|
| 82 | | fi |
|---|
| 83 | | # Comment the cdrom source, we install from the internet |
|---|
| 84 | | if [ -e /etc/apt/sources.list ]; then |
|---|
| 85 | | sed -i -e 's/^\(deb cdrom:.*\)/#\1/g' /etc/apt/sources.list |
|---|
| 86 | | fi |
|---|
| 87 | | if ! [ -e /proc/net/route ]; then |
|---|
| 88 | | mount /proc |
|---|
| 89 | | fi |
|---|
| 90 | | if route -n | grep -q ^0.0.0.0; then |
|---|
| 91 | | apt-get update > /dev/null 2>&1 |
|---|
| 92 | | else |
|---|
| 93 | | sed -i -e 's/^deb /#deb /g' $list |
|---|
| 94 | | fi |
|---|
| 95 | | } |
|---|
| 96 | | |
|---|
| 97 | | # Fix hardy menus |
|---|
| 98 | | menu_hardy () { |
|---|
| 99 | | |
|---|
| 100 | | # Fix Acrobat menu |
|---|
| 101 | | cfg=/usr/share/applications/AdobeReader.desktop |
|---|
| 102 | | if exists $cfg; then |
|---|
| 103 | | sed -i -e 's/^Exec=.*/Exec=acroread %f/g' $cfg |
|---|
| 104 | | else |
|---|
| 105 | | warning "$cfg not found" |
|---|
| 106 | | fi |
|---|
| 107 | | |
|---|
| 108 | | # Fix Qcad menu |
|---|
| 109 | | cfg=/usr/share/applications/qcad.desktop |
|---|
| 110 | | if exists $cfg; then |
|---|
| 111 | | sed -i -e 's/^Exec=.*/Exec=qcad %f/g' $cfg |
|---|
| 112 | | if ! grep -q ^MimeType $cfg; then |
|---|
| 113 | | echo "MimeType=image/vnd.dxf" >> $cfg |
|---|
| 114 | | fi |
|---|
| 115 | | else |
|---|
| 116 | | warning "$cfg not found" |
|---|
| 117 | | fi |
|---|
| 118 | | |
|---|
| 119 | | update-desktop-database |
|---|
| 120 | | |
|---|
| 121 | | } |
|---|
| 122 | | |
|---|
| 123 | | # Tweak menu icons and categories |
|---|
| 124 | | menu_tweak () { |
|---|
| 125 | | |
|---|
| 126 | | # Place Bluefish in graphics |
|---|
| 127 | | bluefish=/usr/share/applications/bluefish.desktop |
|---|
| 128 | | if exists $bluefish; then |
|---|
| 129 | | sed -i -e 's/^Categories=.*$/Categories=Application;Network;/g' $bluefish |
|---|
| 130 | | else |
|---|
| 131 | | warning "$bluefish not found" |
|---|
| 132 | | fi |
|---|
| 133 | | |
|---|
| 134 | | # Bug-Buddy in system |
|---|
| 135 | | bugbuddy=/usr/share/applications/bug-buddy.desktop |
|---|
| 136 | | if exists $bugbuddy; then |
|---|
| 137 | | sed -i -e 's/^Categories=.*$/Categories=Application;System;/g' $bugbuddy |
|---|
| 138 | | else |
|---|
| 139 | | warning "$bugbuddy not found" |
|---|
| 140 | | fi |
|---|
| 141 | | |
|---|
| 142 | | # QJackCtl name and place |
|---|
| 143 | | qjackctl=/usr/share/applications/qjackctl.desktop |
|---|
| 144 | | if exists $qjackctl; then |
|---|
| 145 | | sed -i -e 's/^Name=.*$/Name=JACK Control/g' $qjackctl |
|---|
| 146 | | if grep -q Categories $qjackctl; then |
|---|
| 147 | | sed -i -e 's/^Categories=.*$/Categories=Application;AudioVideo;/g' $qjackctl |
|---|
| 148 | | else |
|---|
| 149 | | echo "Categories=Application;AudioVideo;" >> $qjackctl |
|---|
| 150 | | fi |
|---|
| 151 | | else |
|---|
| 152 | | warning "$qjackctl not found" |
|---|
| 153 | | fi |
|---|
| 154 | | |
|---|
| 155 | | # Evince in office |
|---|
| 156 | | evince=/usr/share/applications/evince.desktop |
|---|
| 157 | | if exists $evince; then |
|---|
| 158 | | sed -i -e 's/^Categories=.*$/Categories=Application;Office;/g' $evince |
|---|
| 159 | | sed -i -e 's/^NoDisplay=.*$/NoDisplay=false/g' $evince |
|---|
| 160 | | else |
|---|
| 161 | | warning "$evince not found" |
|---|
| 162 | | fi |
|---|
| 163 | | |
|---|
| 164 | | # Add category to tagtool |
|---|
| 165 | | tagtool=/usr/share/applications/tagtool.desktop |
|---|
| 166 | | if exists $tagtool; then |
|---|
| 167 | | if grep -q Categories $tagtool; then |
|---|
| 168 | | sed -i -e 's/^Categories=.*$/Categories=Application;AudioVideo;/g' $tagtool |
|---|
| 169 | | else |
|---|
| 170 | | echo "Categories=Application;AudioVideo;" >> $tagtool |
|---|
| 171 | | fi |
|---|
| 172 | | else |
|---|
| 173 | | warning "$tagtool not found" |
|---|
| 174 | | fi |
|---|
| 175 | | |
|---|
| 176 | | # Add timemachine icon |
|---|
| 177 | | tm=/usr/share/gnome/apps/Multimedia/timemachine.desktop |
|---|
| 178 | | if exists $tm; then |
|---|
| 179 | | if ! grep -q "Icon=" $tm; then |
|---|
| 180 | | echo "Icon=/usr/share/timemachine/pixmaps/timemachine-icon.png" >> $tm |
|---|
| 181 | | fi |
|---|
| 182 | | else |
|---|
| 183 | | warning "$tm not found" |
|---|
| 184 | | fi |
|---|
| 185 | | |
|---|
| 186 | | # Add xpad icon |
|---|
| 187 | | xpad=/usr/share/applications/xpad.desktop |
|---|
| 188 | | if exists $xpad; then |
|---|
| 189 | | sed -i -e 's|^Icon=.*$|Icon=/usr/share/pixmaps/xpad/xpad.xpm|g' $xpad |
|---|
| 190 | | else |
|---|
| 191 | | warning "$xpad not found" |
|---|
| 192 | | fi |
|---|
| 193 | | |
|---|
| 194 | | # Change avahi icon |
|---|
| 195 | | avahi=/usr/share/applications/avahi-discover.desktop |
|---|
| 196 | | if exists $avahi; then |
|---|
| 197 | | sed -i -e 's|^Icon=.*$|Icon=network-wired|g' $avahi |
|---|
| 198 | | else |
|---|
| 199 | | warning "$avahi not found" |
|---|
| 200 | | fi |
|---|
| 201 | | |
|---|
| 202 | | # Add photoprint icon and change name |
|---|
| 203 | | photoprint=/usr/share/applications/photoprint.desktop |
|---|
| 204 | | if exists $photoprint; then |
|---|
| 205 | | sed -i -e 's|^Icon=.*$|Icon=camera-photo22x22|g' $photoprint |
|---|
| 206 | | sed -i -e 's/^Name=.*$/Name=PhotoPrint/g' $photoprint |
|---|
| 207 | | else |
|---|
| 208 | | warning "$photoprint not found" |
|---|
| 209 | | fi |
|---|
| 210 | | |
|---|
| 211 | | |
|---|
| 212 | | # Change fmit title |
|---|
| 213 | | fmit=/usr/share/applications/fmit.desktop |
|---|
| 214 | | if exists $fmit; then |
|---|
| 215 | | sed -i -e 's|^Icon=.*$|Icon=fmit|g' $fmit |
|---|
| 216 | | sed -i -e 's/^Name=.*$/Name=Fmit Tuner/g' $fmit |
|---|
| 217 | | else |
|---|
| 218 | | warning "$fmit not found" |
|---|
| 219 | | fi |
|---|
| 220 | | |
|---|
| 221 | | # Remove Audio category |
|---|
| 222 | | stopmotion=/usr/share/applications/stopmotion.desktop |
|---|
| 223 | | if exists $stopmotion; then |
|---|
| 224 | | sed -i -e 's/^Categories=.*$/Categories=Application;Graphics;Video;AudioVideoEditing;KDE;Qt/g' $stopmotion |
|---|
| 225 | | else |
|---|
| 226 | | warning "$stopmotion not found" |
|---|
| 227 | | fi |
|---|
| 228 | | |
|---|
| 229 | | # Show file-roller |
|---|
| 230 | | fileroller=/usr/share/applications/file-roller.desktop |
|---|
| 231 | | if exists $fileroller; then |
|---|
| 232 | | sed -i -e 's|^NoDisplay=.*$|NoDisplay=false|g' $fileroller |
|---|
| 233 | | else |
|---|
| 234 | | warning "$fileroller not found" |
|---|
| 235 | | fi |
|---|
| 236 | | |
|---|
| 237 | | # Wrap gdmsetup with gksudo instead of gksu |
|---|
| 238 | | gdmsetup=/usr/share/applications/gdmsetup.desktop |
|---|
| 239 | | if exists $gdmsetup; then |
|---|
| 240 | | sed -i -e 's/^Exec=gksu \(.*\)/Exec=gksudo \1/g' $gdmsetup |
|---|
| 241 | | else |
|---|
| 242 | | warning "$gdmsetup not found" |
|---|
| 243 | | fi |
|---|
| 244 | | |
|---|
| 245 | | # Don't wrap system tools with gksu |
|---|
| 246 | | systemtools="network services shares time users" |
|---|
| 247 | | for systemtool in $systemtools; do |
|---|
| 248 | | menufile=/usr/share/applications/${systemtool}.desktop |
|---|
| 249 | | if exists $menufile; then |
|---|
| 250 | | sed -i -e 's/^Exec=gksu \(.*\)/Exec=\1/g' $menufile |
|---|
| 251 | | else |
|---|
| 252 | | warning "$menufile not found" |
|---|
| 253 | | fi |
|---|
| 254 | | done |
|---|
| 255 | | |
|---|
| 256 | | # Show file-roller |
|---|
| 257 | | mplayer=/usr/share/applications/mplayer.desktop |
|---|
| 258 | | if exists $mplayer; then |
|---|
| 259 | | sed -i -e 's|^Exec=.*$|Exec=gmplayer -vo x11|g' $mplayer |
|---|
| 260 | | sed -i -e 's|^TryExec=.*$|TryExec=gmplayer -vo x11|g' $mplayer |
|---|
| 261 | | else |
|---|
| 262 | | warning "$mplayer not found" |
|---|
| 263 | | fi |
|---|
| 264 | | |
|---|
| 265 | | # Change matchbox-keyboard icon |
|---|
| 266 | | mbk=/usr/share/applications/inputmethods/matchbox-keyboard.desktop |
|---|
| 267 | | if exists $mbk; then |
|---|
| 268 | | sed -i -e 's|^Icon=.*$|Icon=trinity/keyboard-icon.png|g' $mbk |
|---|
| 269 | | fi |
|---|
| 270 | | |
|---|
| 271 | | # Fix missing epiphany icon |
|---|
| 272 | | epiphany=/usr/share/applications/epiphany.desktop |
|---|
| 273 | | if exists $epiphany; then |
|---|
| 274 | | sed -i -e 's|^Icon=.*$|Icon=trinity/web-browser.png|g' $epiphany |
|---|
| 275 | | fi |
|---|
| 276 | | |
|---|
| 277 | | # Fix scribus icon |
|---|
| 278 | | scribus=/usr/share/applications/scribus.desktop |
|---|
| 279 | | if exists $scribus; then |
|---|
| 280 | | sed -i -e 's|^Icon=.*|Icon=/usr/share/scribus/icons/scribusicon.png|g' $scribus |
|---|
| 281 | | fi |
|---|
| 282 | | |
|---|
| 283 | | } |
|---|
| 284 | | |
|---|
| 285 | | # Get rid of unwanted menu entries |
|---|
| 286 | | menu_hide () { |
|---|
| 287 | | |
|---|
| 288 | | gnomemedia="vumeter.desktop reclevel.desktop gnome-sound-recorder.desktop gnome-cd.desktop" |
|---|
| 289 | | eog="eog.desktop" |
|---|
| 290 | | knetattach="kde/knetattach.desktop" |
|---|
| 291 | | |
|---|
| 292 | | for item in $gnomemedia $eog $knetattach; do |
|---|
| 293 | | item=/usr/share/applications/$item |
|---|
| 294 | | if exists $item; then |
|---|
| 295 | | sed -i -e 's/^Categories=.*$/Categories=None;/g' $item |
|---|
| 296 | | else |
|---|
| 297 | | warning "$item not found" |
|---|
| 298 | | fi |
|---|
| 299 | | done |
|---|
| 300 | | |
|---|
| 301 | | } |
|---|
| 302 | | |
|---|
| 303 | | # Remove Debian menu hierarchy from the Gnome menu |
|---|
| 304 | | menu_debian () { |
|---|
| 305 | | gnome=/etc/xdg/menus/gnome-applications.menu |
|---|
| 306 | | if exists $gnome; then |
|---|
| 307 | | sed -i -e '/<MergeFile>debian-menu/ d' $gnome |
|---|
| 308 | | else |
|---|
| 309 | | warning "$gnome not found" |
|---|
| 310 | | fi |
|---|
| 311 | | |
|---|
| 312 | | } |
|---|
| 313 | | |
|---|
| 314 | | # Configure bootsplash in grub menu |
|---|
| 315 | | bootsplash () { |
|---|
| 316 | | resolution=$1 |
|---|
| 317 | | menu=/boot/grub/menu.lst |
|---|
| 318 | | if nullstr $resolution; then warning "no resolution given"; return; fi |
|---|
| 319 | | if [ -e $menu ]; then |
|---|
| 320 | | kopt=$(grep -e "^# kopt" /boot/grub/menu.lst | \ |
|---|
| 321 | | sed -e 's/vga=[[:digit:]]\{3\}[[[:blank:]]\?//g'| \ |
|---|
| 322 | | sed -e 's/splash=silent//g') |
|---|
| 323 | | kopt="$kopt vga=$resolution splash=silent" |
|---|
| 324 | | sed -i -e "s|^# kopt=.*|$kopt|g" $menu |
|---|
| 325 | | update-grub > /dev/null 2>&1 |
|---|
| 326 | | else |
|---|
| 327 | | warning "$menu does not exist" |
|---|
| 328 | | fi |
|---|
| 329 | | } |
|---|
| 330 | | |
|---|
| 331 | | # Configure grub |
|---|
| 332 | | grub () { |
|---|
| 333 | | if [ "$1" != "" ]; then |
|---|
| 334 | | timeout=$1 |
|---|
| 335 | | else |
|---|
| 336 | | timeout=5 |
|---|
| 337 | | fi |
|---|
| 338 | | if [ "$2" != "" ]; then |
|---|
| 339 | | title=$2 |
|---|
| 340 | | else |
|---|
| 341 | | title="Custom system" |
|---|
| 342 | | fi |
|---|
| 343 | | |
|---|
| 344 | | # Grub timeout and directory |
|---|
| 345 | | cfg=/usr/sbin/update-grub |
|---|
| 346 | | if ! exists $cfg; then warning "$cfg not found"; return; fi |
|---|
| 347 | | sed -i -e "s|^timeout.*|timeout $timeout|g" $cfg |
|---|
| 348 | | mkdir -p /boot/grub |
|---|
| 349 | | |
|---|
| 350 | | # Set custom title |
|---|
| 351 | | cfg=/etc/default/grub |
|---|
| 352 | | echo "title=\"$title\"" > $cfg |
|---|
| 353 | | |
|---|
| 354 | | } |
|---|
| 355 | | |
|---|
| 356 | | # Tweak profile file |
|---|
| 357 | | profile () { |
|---|
| 358 | | conf=/etc/profile |
|---|
| 359 | | if exists $conf; then |
|---|
| 360 | | if ! grep -q "^export LADSPA_PATH" $conf; then |
|---|
| 361 | | sed -i -e 's|^export PATH|export PATH\nexport LADSPA_PATH=/usr/lib/ladspa/|g' $conf |
|---|
| 362 | | fi |
|---|
| 363 | | else |
|---|
| 364 | | warning "$conf not found" |
|---|
| 365 | | fi |
|---|
| 366 | | } |
|---|
| 367 | | |
|---|
| 368 | | # Disable useless virtual consoles |
|---|
| 369 | | tty () { |
|---|
| 370 | | inittab=/etc/inittab |
|---|
| 371 | | if exists $inittab; then |
|---|
| 372 | | for i in 2 3 4 5 6; do |
|---|
| 373 | | sed -i -e "s|^$i:23:respawn:/sbin/getty 38400 tty$i|#$i:23:respawn:/sbin/getty 38400 tty$i|g" $inittab |
|---|
| 374 | | done |
|---|
| 375 | | else |
|---|
| 376 | | warning "$inittab not found" |
|---|
| 377 | | fi |
|---|
| 378 | | } |
|---|
| 379 | | |
|---|
| 380 | | # Automatically login a certain user on tty1 |
|---|
| 381 | | autologin () { |
|---|
| 382 | | inittab=/etc/inittab |
|---|
| 383 | | if nullstr $1; then warning "no user name given"; return 1; fi |
|---|
| 384 | | user=$1 |
|---|
| 385 | | sed -i -e "s|^1:2345:respawn:/sbin/getty 38400 tty1|1:2345:respawn:/sbin/mingetty tty1 --autologin $user|g" $inittab |
|---|
| 386 | | } |
|---|
| 387 | | |
|---|
| 388 | | # Set noatime |
|---|
| 389 | | noatime () { |
|---|
| 390 | | fstab=/etc/fstab |
|---|
| 391 | | if exists $fstab; then |
|---|
| 392 | | sed -i -e 's/defaults,errors/defaults,noatime,errors/g' $fstab |
|---|
| 393 | | else |
|---|
| 394 | | warning "$fstab not found" |
|---|
| 395 | | fi |
|---|
| 396 | | } |
|---|
| 397 | | |
|---|
| 398 | | # Blacklist modules |
|---|
| 399 | | alsa () { |
|---|
| 400 | | case "$1" in |
|---|
| 401 | | blacklist) |
|---|
| 402 | | blacklist=/etc/modprobe.d/alsa-base-blacklist |
|---|
| 403 | | shift |
|---|
| 404 | | modules=$@ |
|---|
| 405 | | touch $blacklist |
|---|
| 406 | | for module in $modules; do |
|---|
| 407 | | if ! grep -q "^blacklist $module" $blacklist; then |
|---|
| 408 | | echo "blacklist $module" >> $blacklist |
|---|
| 409 | | fi |
|---|
| 410 | | done |
|---|
| 411 | | ;; |
|---|
| 412 | | esac |
|---|
| 413 | | } |
|---|
| 414 | | |
|---|
| 415 | | # Fluxbox exit |
|---|
| 416 | | fluxbox () { |
|---|
| 417 | | menu=/etc/X11/fluxbox/system.fluxbox-menu |
|---|
| 418 | | if ! exists $menu; then warning "$menu not found"; return; fi |
|---|
| 419 | | sed -i -e 's/^ \[exit\] (Exit)/ [exec] (Exit) {sudo halt} <>/g' $menu |
|---|
| 420 | | update-menus |
|---|
| 421 | | } |
|---|
| 422 | | |
|---|
| 423 | | # Tell Wine to use ALSA |
|---|
| 424 | | wine () { |
|---|
| 425 | | inf=/usr/share/wine/wine.inf |
|---|
| 426 | | if ! exists $inf; then warning "$inf not found"; return; fi |
|---|
| 427 | | if ! grep -q '^HKCU,Software\Wine\Drivers,"Audio",2,"alsa"' $inf; then |
|---|
| 428 | | echo 'HKCU,Software\Wine\Drivers,"Audio",2,"alsa"' >> $inf |
|---|
| 429 | | fi |
|---|
| 430 | | } |
|---|
| 431 | | |
|---|
| 432 | | # Fix update-manager channels |
|---|
| 433 | | channels () { |
|---|
| 434 | | info=/usr/share/update-manager/channels/Debian.info |
|---|
| 435 | | if ! exists $info; then warning "$info not found"; return; fi |
|---|
| 436 | | sed -i -e 's/^Description: Debian "Etch" (testing)/Description: Debian "Etch" 4.0/g' $info |
|---|
| 437 | | sed -i -e '/./{H;$!d;}' -e 'x;/Sarge/d;' $info |
|---|
| 438 | | } |
|---|
| 439 | | |
|---|
| 440 | | # Dont't use the tasks module |
|---|
| 441 | | matchbox () { |
|---|
| 442 | | modules=/etc/matchbox-desktop/mbdesktop_modules |
|---|
| 443 | | kbdconfig=/etc/matchbox/kbdconfig |
|---|
| 444 | | |
|---|
| 445 | | if ! exists $modules; then warning "$modules not found"; return; fi |
|---|
| 446 | | sed -i -e 's|^/usr/lib/matchbox/desktop/tasks.so|#/usr/lib/matchbox/desktop/tasks.so|g' $modules |
|---|
| 447 | | |
|---|
| 448 | | if ! exists $kbdconfig; then warning "$kbdconfig not found"; return; fi |
|---|
| 449 | | sed -i -e 's|^<alt>Tab=next|Tab=next|g' $kbdconfig |
|---|
| 450 | | } |
|---|
| 451 | | |
|---|
| 452 | | # Don't wait forever |
|---|
| 453 | | dhcp () { |
|---|
| 454 | | dhcp=/etc/dhcp3/dhclient.conf |
|---|
| 455 | | if ! exists $dhcp; then warning "$dhcp not found"; return; fi |
|---|
| 456 | | sed -i -e "s/^#timeout .*/timeout 20;/g" $dhcp |
|---|
| 457 | | } |
|---|
| 458 | | |
|---|
| 459 | | # Don't wait forever |
|---|
| 460 | | resolution915 () { |
|---|
| 461 | | |
|---|
| 462 | | mode=$1 |
|---|
| 463 | | xreso=$2 |
|---|
| 464 | | yreso=$3 |
|---|
| 465 | | bit=$4 |
|---|
| 466 | | |
|---|
| 467 | | cfg=/etc/default/915resolution |
|---|
| 468 | | if ! exists $cfg; then warning "$cfg not found"; return; fi |
|---|
| 469 | | |
|---|
| 470 | | sed -i -e "s/^MODE=.*/MODE=$mode/g" $cfg |
|---|
| 471 | | sed -i -e "s/^XRESO=.*/XRESO=$xreso/g" $cfg |
|---|
| 472 | | sed -i -e "s/^YRESO=.*/YRESO=$yreso/g" $cfg |
|---|
| 473 | | sed -i -e "s/^BIT=.*/BIT=$bit/g" $cfg |
|---|
| 474 | | } |
|---|
| 475 | | |
|---|
| 476 | | # Fixed x-runs on hda-intel chips |
|---|
| 477 | | hdaintel () { |
|---|
| 478 | | cfg=/etc/modprobe.d/hda-intel |
|---|
| 479 | | echo 'options snd-hda-intel position_fix=1' > $cfg |
|---|
| 480 | | } |
|---|
| 481 | | |
|---|
| 482 | | # Set rtlimits |
|---|
| 483 | | limits () { |
|---|
| 484 | | cfg=/etc/security/limits.conf |
|---|
| 485 | | |
|---|
| 486 | | if ! exists $cfg; then warning "$cfg not found"; return; fi |
|---|
| 487 | | if grep -q ^@audio $cfg; then return; fi |
|---|
| 488 | | |
|---|
| 489 | | cat <<EOF >> $cfg |
|---|
| 490 | | @audio - rtprio 99 |
|---|
| 491 | | @audio - memlock 950000 |
|---|
| 492 | | @audio - nice -10 |
|---|
| 493 | | EOF |
|---|
| 494 | | } |
|---|
| 495 | | |
|---|
| 496 | | # A nice Qt theme |
|---|
| 497 | | polymer () { |
|---|
| 498 | | cfg=/etc/qt3/qtrc |
|---|
| 499 | | if ! exists /etc/qt3; then mkdir /etc/qt3; fi |
|---|
| 500 | | if ! exists $cfg; then |
|---|
| 501 | | cat <<EOF > $cfg |
|---|
| 502 | | [3.3] |
|---|
| 503 | | libraryPath=/usr/lib/qt3/plugins:/usr/bin:/usr/plugins |
|---|
| 504 | | |
|---|
| 505 | | [Font Substitutions] |
|---|
| 506 | | arial=helvetica^e |
|---|
| 507 | | helv=helvetica^e |
|---|
| 508 | | tms rmn=times^e |
|---|
| 509 | | |
|---|
| 510 | | [General] |
|---|
| 511 | | GUIEffects=none^e |
|---|
| 512 | | XIMInputStyle=On The Spot |
|---|
| 513 | | cursorFlashTime=1000 |
|---|
| 514 | | doubleClickInterval=400 |
|---|
| 515 | | embedFonts=true |
|---|
| 516 | | font=Sans Serif,10,-1,5,50,0,0,0,0,0 |
|---|
| 517 | | fontPath=\0 |
|---|
| 518 | | globalStrut=0^e0^e |
|---|
| 519 | | resolveSymlinks=true |
|---|
| 520 | | style=Polymer |
|---|
| 521 | | useRtlExtensions=false |
|---|
| 522 | | wheelScrollLines=3 |
|---|
| 523 | | |
|---|
| 524 | | [Palette] |
|---|
| 525 | | active=#000000^e#c0c0c0^e#ececec^e#dfdfdf^e#808080^e#a0a0a4^e#000000^e#ffffff^e#000000^e#ffffff^e#c0c0c0^e#000000^e#000000^e#ffffff^e#0000ff^e#ff00ff^e |
|---|
| 526 | | disabled=#808080^e#c0c0c0^e#ececec^e#dfdfdf^e#808080^e#a0a0a4^e#808080^e#ffffff^e#808080^e#c0c0c0^e#c0c0c0^e#000000^e#808080^e#c0c0c0^e#0000ff^e#ff00ff^e |
|---|
| 527 | | inactive=#000000^e#c0c0c0^e#ececec^e#dfdfdf^e#808080^e#a0a0a4^e#000000^e#ffffff^e#000000^e#ffffff^e#c0c0c0^e#000000^e#000000^e#ffffff^e#0000ff^e#ff00ff^e |
|---|
| 528 | | EOF |
|---|
| 529 | | fi |
|---|
| 530 | | } |
|---|
| 531 | | |
|---|
| 532 | | # LASH fix |
|---|
| 533 | | lash () { |
|---|
| 534 | | cfg=/usr/lib/liblash.so.2.1.1 |
|---|
| 535 | | if ! exists $cfg; then warning $cfg not found; return; fi |
|---|
| 536 | | if ! exists /usr/lib/liblash.so.1; then |
|---|
| 537 | | ln -s $cfg /usr/lib/liblash.so.1 |
|---|
| 538 | | fi |
|---|
| 539 | | } |
|---|
| 540 | | # Configure qjackctl |
|---|
| 541 | | qjackctl () { |
|---|
| 542 | | |
|---|
| 543 | | echo "START_JACK=yes" > /etc/default/cdd-utils |
|---|
| 544 | | |
|---|
| 545 | | } |
|---|
| 546 | | |
|---|
| 547 | | # Auto login |
|---|
| 548 | | gdm () { |
|---|
| 549 | | cfg=/etc/gdm/gdm.conf |
|---|
| 550 | | user=$1 |
|---|
| 551 | | |
|---|
| 552 | | if nullstr $user; then warning "no user given"; return; fi |
|---|
| 553 | | |
|---|
| 554 | | sed -i -s "s/^AutomaticLoginEnable=.*/AutomaticLoginEnable=true/g" $cfg |
|---|
| 555 | | sed -i -s "s/^AutomaticLogin=.*/AutomaticLogin=$user/g" $cfg |
|---|
| 556 | | } |
|---|
| 557 | | |
|---|
| 558 | | # Trinity key codes |
|---|
| 559 | | setkeycodes () { |
|---|
| 560 | | cfg=/etc/init.d/setkeycodes |
|---|
| 561 | | cat <<EOF > $cfg |
|---|
| 562 | | #! /bin/sh |
|---|
| 563 | | # |
|---|
| 564 | | |
|---|
| 565 | | # Set Q1 extra keys |
|---|
| 566 | | |
|---|
| 567 | | setkeycodes e059 106 # Right -> Right |
|---|
| 568 | | setkeycodes e057 105 # Left -> Left |
|---|
| 569 | | setkeycodes e058 103 # Up -> Up |
|---|
| 570 | | setkeycodes e056 108 # Down -> Down |
|---|
| 571 | | setkeycodes e054 230 # Menu -> 0xd9 |
|---|
| 572 | | EOF |
|---|
| 573 | | chmod 755 $cfg |
|---|
| 574 | | update-rc.d -f setkeycodes defaults > /dev/null 2>&1 |
|---|
| 575 | | } |
|---|
| 576 | | |
|---|
| 577 | | # Set custom start-here icon |
|---|
| 578 | | starthere () { |
|---|
| 579 | | |
|---|
| 580 | | if nullstr $1; then warning "no icon given"; return; fi |
|---|
| 581 | | |
|---|
| 582 | | custom=$1 |
|---|
| 583 | | if ! exists $custom; then warning $custom not found; return; fi |
|---|
| 584 | | |
|---|
| 585 | | gnome=/usr/share/icons/gnome/24x24/places/start-here.png |
|---|
| 586 | | if ! exists $gnome; then warning $gnome not found; return; fi |
|---|
| 587 | | |
|---|
| 588 | | cp $custom $gnome |
|---|
| 589 | | rm -f /usr/share/icons/gnome/icon-theme.cache |
|---|
| 590 | | sudo gtk-update-icon-cache /usr/share/icons/gnome/ |
|---|
| 591 | | |
|---|
| 592 | | } |
|---|
| 593 | | |
|---|
| 594 | | # Trinity touchscreen |
|---|
| 595 | | touchscreen () { |
|---|
| 596 | | cfg=/etc/modprobe.d/blacklist-touchscreen |
|---|
| 597 | | cat <<EOF > $cfg |
|---|
| 598 | | blacklist usbtouchscreen |
|---|
| 599 | | EOF |
|---|
| 600 | | |
|---|
| 601 | | cfg=/etc/udev/rules.d/60-touchscreen.rules |
|---|
| 602 | | cat <<EOF > $cfg |
|---|
| 603 | | # udev rules for USB touchscreen devices |
|---|
| 604 | | |
|---|
| 605 | | KERNEL=="event[0-9]*", SYSFS{idVendor}=="0eef", SYSFS{idProduct}=="0001", SYMLINK+="input/touchscreen" |
|---|
| 606 | | EOF |
|---|
| 607 | | |
|---|
| 608 | | cfg=/etc/X11/xorg.conf |
|---|
| 609 | | if ! exists $cfg; then warning "$cfg not found"; return; fi |
|---|
| 610 | | if ! grep -q evtouch $cfg; then |
|---|
| 611 | | sed -i -e 's/Section "ServerLayout"/Section "ServerLayout"\n\tInputDevice\t"touchscreen"/g' $cfg |
|---|
| 612 | | cat <<EOF >> $cfg |
|---|
| 613 | | |
|---|
| 614 | | Section "InputDevice" |
|---|
| 615 | | Identifier "touchscreen" |
|---|
| 616 | | Driver "evtouch" |
|---|
| 617 | | Option "Device" "/dev/input/touchscreen" |
|---|
| 618 | | Option "SendCoreEvents" |
|---|
| 619 | | Option "ReportingMode" "Raw" |
|---|
| 620 | | Option "Emulate3Buttons" |
|---|
| 621 | | Option "Emulate3Timeout" "50" |
|---|
| 622 | | Option "MinX" "145" |
|---|
| 623 | | Option "MinY" "193" |
|---|
| 624 | | Option "MaxX" "3973" |
|---|
| 625 | | Option "MaxY" "3898" |
|---|
| 626 | | Option "TapTimer" "30" |
|---|
| 627 | | Option "LongTouchTimer" "750" |
|---|
| 628 | | Option "longtouched_action" "click" |
|---|
| 629 | | Option "longtouched_button" "3" |
|---|
| 630 | | Option "oneandhalftap_button" "2" |
|---|
| 631 | | Option "MoveLimit" "40" |
|---|
| 632 | | Option "touched_drag" "1" |
|---|
| 633 | | Option "maybetapped_action" "click" |
|---|
| 634 | | Option "maybetapped_button" "1" |
|---|
| 635 | | EndSection |
|---|
| 636 | | EOF |
|---|
| 637 | | fi |
|---|
| 638 | | } |
|---|
| 639 | | |
|---|
| 640 | | # Use ardourino |
|---|
| 641 | | ardourino () { |
|---|
| 642 | | cfg=/usr/share/applications/ardour.desktop |
|---|
| 643 | | if ! exists $cfg; then warning $cfg not found; return; fi |
|---|
| 644 | | sed -i -e 's/^Exec=.*/Exec=ardour2 --ardourino/g' $cfg |
|---|
| 645 | | } |
|---|
| 646 | | |
|---|
| 647 | | # HAVP antivirus proxy |
|---|
| 648 | | havp () { |
|---|
| 649 | | cfg=/etc/havp/havp.config |
|---|
| 650 | | if ! exists $cfg; then warning $cfg not found; return; fi |
|---|
| 651 | | sed -i -e 's/^# PARENTPROXY localhost/PARENTPROXY localhost/' $cfg |
|---|
| 652 | | sed -i -e 's/^# PARENTPORT 3128/PARENTPORT 3128/' $cfg |
|---|
| 653 | | } |
|---|
| 654 | | |
|---|
| 655 | | # Squid proxy |
|---|
| 656 | | squid () { |
|---|
| 657 | | |
|---|
| 658 | | if [ "$1" == "" ]; then |
|---|
| 659 | | network="192.168.1.0/24" |
|---|
| 660 | | else |
|---|
| 661 | | network="$1" |
|---|
| 662 | | fi |
|---|
| 663 | | |
|---|
| 664 | | cfg=/etc/squid/squid.conf |
|---|
| 665 | | if ! exists $cfg; then warning $cfg not found; return; fi |
|---|
| 666 | | |
|---|
| 667 | | if ! grep -q local_network $cfg; then |
|---|
| 668 | | sed -i -e "s|^acl CONNECT method CONNECT|acl CONNECT method CONNECT\nacl local_network src $network|g" $cfg |
|---|
| 669 | | sed -i -e "s|^http_access allow manager localhost|http_access allow manager localhost\nhttp_access allow local_network|g" $cfg |
|---|
| 670 | | fi |
|---|
| 671 | | |
|---|
| 672 | | } |
|---|
| 673 | | |
|---|
| 674 | | # LDAP Address book and users |
|---|
| 675 | | ldap () { |
|---|
| 676 | | |
|---|
| 677 | | if [ "$1" == "client" ]; then |
|---|
| 678 | | auth-client-config -a -p lac_ldap |
|---|
| 679 | | cfg=/etc/ldap.conf |
|---|
| 680 | | if ! exists $cfg; then warning $cfg not found; return; fi |
|---|
| 681 | | sed -i -e 's/^#bind_policy hard/bind_policy soft/g' $cfg |
|---|
| 682 | | exit 0 |
|---|
| 683 | | fi |
|---|
| 684 | | |
|---|
| 685 | | cfg=/usr/share/evolution-data-server-2.22/evolutionperson.schema |
|---|
| 686 | | if ! exists $cfg; then warning $cfg not found; return; fi |
|---|
| 687 | | cp $cfg /etc/ldap/schema |
|---|
| 688 | | |
|---|
| 689 | | cfg=/usr/share/doc/samba-doc/examples/LDAP/samba.schema.gz |
|---|
| 690 | | if ! exists $cfg; then warning $cfg not found; return; fi |
|---|
| 691 | | zcat $cfg > /etc/ldap/schema/samba.schema |
|---|
| 692 | | |
|---|
| 693 | | cfg=/etc/ldap/slapd.conf |
|---|
| 694 | | if ! exists $cfg; then warning $cfg not found; return; fi |
|---|
| 695 | | |
|---|
| 696 | | sed -i -e 's|^#allow bind_v2|allow bind_v2|g' $cfg |
|---|
| 697 | | |
|---|
| 698 | | # Add additional schemas |
|---|
| 699 | | if ! grep -q evolutionperson $cfg; then |
|---|
| 700 | | sed -i -e 's|^include /etc/ldap/schema/inetorgperson.schema|include /etc/ldap/schema/inetorgperson.schema\ninclude /etc/ldap/schema/evolutionperson.schema|g' $cfg |
|---|
| 701 | | fi |
|---|
| 702 | | if ! grep -q samba $cfg; then |
|---|
| 703 | | sed -i -e 's|^include /etc/ldap/schema/evolutionperson.schema|include /etc/ldap/schema/evolutionperson.schema\ninclude /etc/ldap/schema/samba.schema|g' $cfg |
|---|
| 704 | | fi |
|---|
| 705 | | |
|---|
| 706 | | # Set ACL (to fix) |
|---|
| 707 | | # if ! grep -q addressbook $cfg; then |
|---|
| 708 | | # sed -i -e 's/^access to \*$/access to dn="ou=people,dc=nodomain"\n by dn="cn=addressbook,dc=nodomain" read\naccess to \*\n by dn="cn=addressbook,dc=nodomain" write/g' $cfg |
|---|
| 709 | | # fi |
|---|
| 710 | | |
|---|
| 711 | | invoke-rc.d slapd restart > /dev/null |
|---|
| 712 | | sleep 1 |
|---|
| 713 | | |
|---|
| 714 | | # pwd=$(echo get slapd/password|debconf-communicate|cut -b 3-) |
|---|
| 715 | | pwd=admin |
|---|
| 716 | | |
|---|
| 717 | | # Remove duplicated groups |
|---|
| 718 | | sed -i -e '/^users:/ d' /etc/group |
|---|
| 719 | | |
|---|
| 720 | | # Populate database |
|---|
| 721 | | for schema in addressbook people groups manager samba; do |
|---|
| 722 | | cfg=/usr/share/cdd-utils/slapd/$schema.ldif |
|---|
| 723 | | if ! exists $cfg; then warning $cfg not found; return; fi |
|---|
| 724 | | ldapadd -c -x -D cn=admin,dc=nodomain -w $pwd -f $cfg > /dev/null 2>&1 || true |
|---|
| 725 | | done |
|---|
| 726 | | |
|---|
| 727 | | } |
|---|
| 728 | | |
|---|
| 729 | | # Spamassassin |
|---|
| 730 | | spamassassin () { |
|---|
| 731 | | |
|---|
| 732 | | cfg=/etc/default/spamassassin |
|---|
| 733 | | if ! exists $cfg; then warning $cfg not found; return; fi |
|---|
| 734 | | sed -i -e 's/^ENABLED=0/ENABLED=1/g' $cfg |
|---|
| 735 | | } |
|---|
| 736 | | |
|---|
| 737 | | # Fetchmail |
|---|
| 738 | | fetchmail () { |
|---|
| 739 | | |
|---|
| 740 | | cfg=/etc/default/fetchmail |
|---|
| 741 | | if ! exists $cfg; then warning $cfg not found; return; fi |
|---|
| 742 | | sed -i -e 's/^START_DAEMON=no/START_DAEMON=yes/g' $cfg |
|---|
| 743 | | |
|---|
| 744 | | cfg=/etc/fetchmailrc |
|---|
| 745 | | if ! exists $cfg; then touch $cfg; return; fi |
|---|
| 746 | | } |
|---|
| 747 | | |
|---|
| 748 | | # Webmin |
|---|
| 749 | | webmin () { |
|---|
| 750 | | |
|---|
| 751 | | # Do not run with SSL |
|---|
| 752 | | cfg=/etc/webmin/miniserv.conf |
|---|
| 753 | | if ! exists $cfg; then warning $cfg not found; return; fi |
|---|
| 754 | | sed -i -e's/^ssl=1/ssl=0/g' $cfg |
|---|
| 755 | | |
|---|
| 756 | | # Add manager as webmin user |
|---|
| 757 | | cfg=/etc/webmin/miniserv.users |
|---|
| 758 | | if ! exists $cfg; then warning $cfg not found; return; fi |
|---|
| 759 | | if ! grep -q ^manager $cfg; then |
|---|
| 760 | | echo "manager:x:::::::" >> $cfg |
|---|
| 761 | | fi |
|---|
| 762 | | |
|---|
| 763 | | # Set manager privileges |
|---|
| 764 | | cfg=/etc/webmin/webmin.acl |
|---|
| 765 | | if ! exists $cfg; then warning $cfg not found; return; fi |
|---|
| 766 | | if ! grep -q ^manager $cfg; then |
|---|
| 767 | | echo "manager: ldap-useradmin firewall" >> $cfg |
|---|
| 768 | | fi |
|---|
| 769 | | |
|---|
| 770 | | # Configure ldap |
|---|
| 771 | | cfg=/etc/webmin/ldap-useradmin/config |
|---|
| 772 | | if ! exists $cfg; then warning $cfg not found; return; fi |
|---|
| 773 | | sed -i -e's|^auth_ldap=/etc/libnss-ldap.conf|auth_ldap=/etc/ldap.conf|g' $cfg |
|---|
| 774 | | sed -i -e's|^shells=fixed,ldap,passwd,shells|shells=fixed,passwd,shells|g' $cfg |
|---|
| 775 | | sed -i -e's|^samba_def=0|samba_def=1|g' $cfg |
|---|
| 776 | | sed -i -e's|^samba_gclass=sambaGroup|samba_gclass=sambaGroupMapping|g' $cfg |
|---|
| 777 | | if ! grep -q ^ldap_tls $cfg; then |
|---|
| 778 | | echo "ldap_tls=0" >> $cfg |
|---|
| 779 | | echo "login=cn=admin,dc=nodomain" >> $cfg |
|---|
| 780 | | echo "user_base=ou=people,dc=nodomain" >> $cfg |
|---|
| 781 | | echo "group_base=ou=groups,dc=nodomain" >> $cfg |
|---|
| 782 | | echo "props=sn: Cognome" >> $cfg |
|---|
| 783 | | echo "default_shell=/bin/bash" >> $cfg |
|---|
| 784 | | echo "pass=admin" >> $cfg |
|---|
| 785 | | echo "samba_domain=S-1-0-0" >> $cfg |
|---|
| 786 | | fi |
|---|
| 787 | | } |
|---|
| 788 | | |
|---|
| 789 | | # Samba |
|---|
| 790 | | samba () { |
|---|
| 791 | | |
|---|
| 792 | | cfg=/etc/samba/smb.conf |
|---|
| 793 | | if ! exists $cfg; then warning $cfg not found; return; fi |
|---|
| 794 | | |
|---|
| 795 | | sed -i -e 's|^; security = user| security = user|g' $cfg |
|---|
| 796 | | sed -i -e 's|^ passdb backend = tdbsam| passdb backend = ldapsam:ldap://localhost|g' $cfg |
|---|
| 797 | | |
|---|
| 798 | | inc=/usr/share/cdd-utils/samba/server.cfg |
|---|
| 799 | | if ! grep -q "^include = $inc" $cfg; then |
|---|
| 800 | | echo "include = $inc" >> $cfg |
|---|
| 801 | | fi |
|---|
| 802 | | |
|---|
| 803 | | # Set LDAP admin password |
|---|
| 804 | | smbpasswd -c $inc -w admin |
|---|
| 805 | | |
|---|
| 806 | | # Create the shared folder |
|---|
| 807 | | mkdir -p /srv/data |
|---|
| 808 | | chgrp users /srv/data |
|---|
| 809 | | chmod g+w /srv/data |
|---|
| 810 | | chmod g+s /srv/data |
|---|
| 811 | | |
|---|
| 812 | | } |
|---|
| 813 | | |
|---|
| 814 | | # Postfix |
|---|
| 815 | | postfix () { |
|---|
| 816 | | |
|---|
| 817 | | cfg=/etc/postfix/main.cf |
|---|
| 818 | | if ! exists $cfg; then warning $cfg not found; return; fi |
|---|
| 819 | | if ! grep -q ^home_mailbox $cfg; then |
|---|
| 820 | | echo "home_mailbox = Maildir/" >> $cfg |
|---|
| 821 | | fi |
|---|
| 822 | | if ! grep -q ^content_filter $cfg; then |
|---|
| 823 | | echo "content_filter=smtp-amavis:[127.0.0.1]:10024" >> $cfg |
|---|
| 824 | | fi |
|---|
| 825 | | |
|---|
| 826 | | cfg=/etc/postfix/master.cf |
|---|
| 827 | | if ! exists $cfg; then warning $cfg not found; return; fi |
|---|
| 828 | | cp /usr/share/cdd-utils/postfix/master.cf $cfg |
|---|
| 829 | | |
|---|
| 830 | | # Create Maildir for new users |
|---|
| 831 | | if ! [ -d /etc/skel/Maildir ]; then |
|---|
| 832 | | maildirmake /etc/skel/Maildir |
|---|
| 833 | | fi |
|---|
| 834 | | |
|---|
| 835 | | } |
|---|
| 836 | | |
|---|
| 837 | | # Amavis |
|---|
| 838 | | amavis () { |
|---|
| 839 | | |
|---|
| 840 | | if [ "$1" == "" ]; then |
|---|
| 841 | | host="server.local" |
|---|
| 842 | | else |
|---|
| 843 | | host=$1 |
|---|
| 844 | | fi |
|---|
| 845 | | |
|---|
| 846 | | cfg=/etc/amavis/conf.d/05-node_id |
|---|
| 847 | | if ! exists $cfg; then warning $cfg not found; return; fi |
|---|
| 848 | | sed -i -e "s|^chomp(\$myhostname = .*);|chomp(\$myhostname = \"$host\");|g" $cfg |
|---|
| 849 | | |
|---|
| 850 | | cfg=/etc/amavis/conf.d/15-content_filter_mode |
|---|
| 851 | | if ! exists $cfg; then warning $cfg not found; return; fi |
|---|
| 852 | | sed -i -e 's|^#@bypass_virus_checks_maps = (|@bypass_virus_checks_maps = (|g' $cfg |
|---|
| 853 | | sed -i -e 's|^# \\%bypass_virus_checks, \\@bypass_virus_checks_acl, \\$bypass_virus_checks_re);| \\%bypass_virus_checks, \\@bypass_virus_checks_acl, \\$bypass_virus_checks_re);|g' $cfg |
|---|
| 854 | | sed -i -e 's|^#@bypass_spam_checks_maps = (|@bypass_spam_checks_maps = (|g' $cfg |
|---|
| 855 | | sed -i -e 's|^# \\%bypass_spam_checks, \\@bypass_spam_checks_acl, \\$bypass_spam_checks_re);| \\%bypass_spam_checks, \\@bypass_spam_checks_acl, \$bypass_spam_checks_re);|g' $cfg |
|---|
| 856 | | |
|---|
| 857 | | cfg=/etc/amavis/conf.d/20-debian_defaults |
|---|
| 858 | | if ! exists $cfg; then warning $cfg not found; return; fi |
|---|
| 859 | | sed -i -e 's|^\$final_banned_destiny = D_BOUNCE;|\$final_banned_destiny = D_DISCARD;|g' $cfg |
|---|
| 860 | | sed -i -e 's|^\$final_spam_destiny = D_BOUNCE;|\$final_spam_destiny = D_DISCARD;|g' $cfg |
|---|
| 861 | | |
|---|
| 862 | | adduser clamav amavis > /dev/null |
|---|
| 863 | | } |
|---|
| 864 | | |
|---|
| 865 | | # Set global umask |
|---|
| 866 | | umask () { |
|---|
| 867 | | |
|---|
| 868 | | if [ "$1" == "" ]; then |
|---|
| 869 | | mask="002" |
|---|
| 870 | | else |
|---|
| 871 | | mask=$1 |
|---|
| 872 | | fi |
|---|
| 873 | | |
|---|
| 874 | | cfg=/etc/profile |
|---|
| 875 | | if ! exists $cfg; then warning $cfg not found; return; fi |
|---|
| 876 | | |
|---|
| 877 | | sed -i -e "s/^umask .*/umask $mask/g" $cfg |
|---|
| 878 | | } |
|---|
| 879 | | |
|---|
| 880 | | # NFS shares |
|---|
| 881 | | nfs () { |
|---|
| 882 | | |
|---|
| 883 | | if [ "$2" == "" ]; then |
|---|
| 884 | | host="server.local" |
|---|
| 885 | | else |
|---|
| 886 | | host=$2 |
|---|
| 887 | | fi |
|---|
| 888 | | |
|---|
| 889 | | if [ "$1" == "client" ]; then |
|---|
| 890 | | cfg=/etc/fstab |
|---|
| 891 | | if ! exists $cfg; then warning $cfg not found; return; fi |
|---|
| 892 | | if ! grep -q $host $cfg; then |
|---|
| 893 | | echo "$host:/home /home nfs hard" >> $cfg |
|---|
| 894 | | echo "$host:/srv/data /srv nfs hard" >> $cfg |
|---|
| 895 | | fi |
|---|
| 896 | | mkdir -p /srv/data |
|---|
| 897 | | fi |
|---|
| 898 | | |
|---|
| 899 | | if [ "$1" == "server" ]; then |
|---|
| 900 | | cfg=/etc/exports |
|---|
| 901 | | if ! exists $cfg; then warning $cfg not found; return; fi |
|---|
| 902 | | if ! grep -q ^/home $cfg; then |
|---|
| 903 | | echo "/home *(rw,sync,no_root_squash)" >> $cfg |
|---|
| 904 | | fi |
|---|
| 905 | | if ! grep -q ^/srv/data $cfg; then |
|---|
| 906 | | echo "/srv/data *(rw,sync,no_root_squash)" >> $cfg |
|---|
| 907 | | fi |
|---|
| 908 | | fi |
|---|
| 909 | | } |
|---|
| 910 | | |
|---|
| 911 | | # Squirrelmail |
|---|
| 912 | | squirrelmail () { |
|---|
| 913 | | cfg=/etc/squirrelmail/apache.conf |
|---|
| 914 | | if ! exists $cfg; then warning $cfg not found; return; fi |
|---|
| 915 | | } |
|---|
| 916 | | |
|---|
| 917 | | # Schedule a daily backup of the data on a local partition using |
|---|
| 918 | | # the rdiff-backup-wrapper |
|---|
| 919 | | backup () { |
|---|
| 920 | | partition=$1 # Path to the backup device |
|---|
| 921 | | if nullstr $partition; then warning "No partition given"; return; fi |
|---|
| 922 | | cfg=/etc/cron.daily/backup |
|---|
| 923 | | cat <<EOF > $cfg |
|---|
| 924 | | #!/bin/sh -e |
|---|
| 925 | | |
|---|
| 926 | | rdiff-backup-wrapper $partition |
|---|
| 927 | | EOF |
|---|
| 928 | | |
|---|
| 929 | | chmod 755 $cfg |
|---|
| 930 | | |
|---|
| 931 | | } |
|---|
| 932 | | |
|---|
| 933 | | # Configure Dnsmasq to act as integrated DNS/DHCP server, which |
|---|
| 934 | | # automatically updates the zone info when assigning addresses |
|---|
| 935 | | # |
|---|
| 936 | | dnsmasq () { |
|---|
| 937 | | cfg=/etc/dnsmasq.conf |
|---|
| 938 | | if ! exists $cfg; then warning $cfg not found; return; fi |
|---|
| 939 | | sed -i -e 's|^#conf-dir=/etc/dnsmasq.d|conf-dir=/etc/dnsmasq.d|g' $cfg |
|---|
| 940 | | mkdir -p /etc/dnsmasq.d |
|---|
| 941 | | cat <<EOF >> /etc/dnsmasq.d/cdd-utils.conf |
|---|
| 942 | | dhcp-range=192.168.1.10,192.168.1.100,12h |
|---|
| 943 | | EOF |
|---|
| 944 | | } |
|---|
| 945 | | |
|---|
| 946 | | # Monit |
|---|
| 947 | | monit () { |
|---|
| 948 | | cfg=/etc/default/monit |
|---|
| 949 | | if ! exists $cfg; then warning $cfg not found; return; fi |
|---|
| 950 | | sed -i -e 's|^startup=0|startup=1|g' $cfg |
|---|
| 951 | | sed -i -e 's|^# CHECK_INTERVALS=.*|CHECK_INTERVALS=30|g' $cfg |
|---|
| 952 | | |
|---|
| 953 | | cfg=/etc/monit/monitrc |
|---|
| 954 | | if ! exists $cfg; then warning $cfg not found; return; fi |
|---|
| 955 | | if ! grep -q '^include /usr/share/cdd-utils/monit/*' $cfg; then |
|---|
| 956 | | echo 'include /usr/share/cdd-utils/monit/*' >> $cfg |
|---|
| 957 | | fi |
|---|
| 958 | | } |
|---|
| 959 | | |
|---|
| 960 | | # Mac Impianti |
|---|
| 961 | | macimpianti () { |
|---|
| 962 | | if [ "$1" == "client" ]; then |
|---|
| 963 | | cdd-config ldap client |
|---|
| 964 | | cdd-config nfs client |
|---|
| 965 | | cdd-config umask |
|---|
| 966 | | cdd-config hosts |
|---|
| 967 | | fi |
|---|
| 968 | | if [ "$1" == "server" ]; then |
|---|
| 969 | | cdd-config ldap server |
|---|
| 970 | | cdd-config ldap client |
|---|
| 971 | | cdd-config nfs server |
|---|
| 972 | | cdd-config amavis |
|---|
| 973 | | cdd-config postfix |
|---|
| 974 | | cdd-config samba |
|---|
| 975 | | cdd-config webmin |
|---|
| 976 | | cdd-config fetchmail |
|---|
| 977 | | cdd-config spamassassin |
|---|
| 978 | | cdd-config squid |
|---|
| 979 | | cdd-config havp |
|---|
| 980 | | cdd-config squirrelmail |
|---|
| 981 | | cdd-config monit |
|---|
| 982 | | cdd-config dnsmasq |
|---|
| 983 | | fi |
|---|
| 984 | | } |
|---|
| 985 | | |
|---|
| 986 | | # Fixed broken linux-rt restricted modules (hardy) |
|---|
| 987 | | wireless () { |
|---|
| 988 | | depmod 2.6.24-16-rt |
|---|
| 989 | | } |
|---|
| 990 | | |
|---|
| 991 | | # Indamixx |
|---|
| 992 | | indamixx () { |
|---|
| 993 | | |
|---|
| 994 | | # Run configuration scripts |
|---|
| 995 | | cdd-config touchscreen |
|---|
| 996 | | cdd-config limits |
|---|
| 997 | | cdd-config modules snd-seq |
|---|
| 998 | | cdd-config setkeycodes |
|---|
| 999 | | cdd-config hdaintel |
|---|
| 1000 | | cdd-config gdm trinity |
|---|
| 1001 | | cdd-config grub 1 Indamixx |
|---|
| 1002 | | cdd-config starthere /usr/share/pixmaps/trinity/start-here.png |
|---|
| 1003 | | cdd-config ardourino |
|---|
| 1004 | | cdd-config alsa blacklist snd_pcsp |
|---|
| 1005 | | cdd-config wireless |
|---|
| 1006 | | cdd-config qjackctl |
|---|
| 1007 | | cdd-config services cupsys avahi-daemon |
|---|
| 1008 | | cdd-config apt trinity hardy |
|---|
| 1009 | | |
|---|
| 1010 | | # Various updates and fixes |
|---|
| 1011 | | update-dpsyco-users-skel |
|---|
| 1012 | | update-grub |
|---|
| 1013 | | chown -R trinity.trinity /home/trinity |
|---|
| 1014 | | |
|---|
| 1015 | | } |
|---|
| 1016 | | |
|---|
| 1017 | | # Add hosts |
|---|
| 1018 | | hosts () { |
|---|
| 1019 | | |
|---|
| 1020 | | if [ "$1" == "" ]; then |
|---|
| 1021 | | ip="192.168.1.200" |
|---|
| 1022 | | else |
|---|
| 1023 | | ip=$1 |
|---|
| 1024 | | fi |
|---|
| 1025 | | |
|---|
| 1026 | | cfg=/etc/hosts |
|---|
| 1027 | | if ! exists $cfg; then warning $cfg not found; return; fi |
|---|
| 1028 | | |
|---|
| 1029 | | if ! grep -q ^$ip $cfg; then |
|---|
| 1030 | | echo "$ip server.local server" >> $cfg |
|---|
| 1031 | | fi |
|---|
| 1032 | | } |
|---|
| | 5 | . $libdir/common.sh |
|---|
| | 6 | . $libdir/system.sh |
|---|
| | 7 | . $libdir/menu.sh |
|---|
| | 8 | . $libdir/desktop.sh |
|---|
| | 9 | . $libdir/server.sh |
|---|
| | 10 | . $libdir/suites.sh |
|---|