-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmkTSClient.sh
More file actions
1259 lines (992 loc) · 30.5 KB
/
mkTSClient.sh
File metadata and controls
1259 lines (992 loc) · 30.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
# todo
# configure locales
# configure hostname
# clean up "fglrx"bo
# check install_ati_lirc
# fix "dummy" parameter
# fix build on livecd
# umount all from chroot envirement, rm: Entfernen von Verzeichnis „$HOME/xbmc-XXX-livecd-hardy-i386/chroot/lib/modules/2.6.24-21-generic/volatile“ nicht möglich: Device or resource busy
## chroot
# mount /tmp/ts-2013-09-08_2230-livecd-precise-amd64/chroot/ /mnt/ --bind
# mount -o bind /dev /mnt/dev
# mount -t proc none /mnt/proc
# cp /etc/resolv.conf /mnt/etc/
# chroot /mnt/
## exit chroot
# exit
# umount /mnt/dev
# umount /mnt/proc
# umount /mnt
## clean
# rm -r /tmp/ts-2013-09-08_2230-livecd-precise-amd64/
LOG=/var/log/mkTSClient.log
# check
if [ ${USER} != "root" ]; then
echo "Please run this script as root"
echo "Example: sudo $0 i386 lucid xbmc"
exit 0
fi
if [ -z $1 ]; then
echo "Please specify architecture: i386, amd64"
exit 0
else
ARCH=$1
fi
if [ -z $2 ]; then
echo "Please specify distribution: karmic lucid maverick"
exit 0
else
DISTRIB_CODENAME=$2
fi
if [ -z $3 ]; then
echo "Please specify a image: slideshow, xbmc, ts, x2go"
exit 0
else
IMAGE=$3
fi
# functions
function state() {
echo "STATE: $1"
if [ $1 != 0 ]; then
echo "ERROR";
exit
else
echo "OK";
fi
}
function script4() {
if [ ! -z ${1} ]; then
URL=https://raw.github.com/panticz/installit/master/${1}
FILE=${URL##*/}
echo "URL:$URL"
echo "FILE:$FILE"
wget -q --no-check-certificate ${URL} -O /tmp/${FILE}
chmod +x /tmp/${FILE}
bash /tmp/${FILE} ${2} 2>&1 | tee -a ${LOG}
fi
}
function check_host_packages() {
echo "check_host_packages..."
# add repository
cat <<EOF> /etc/apt/sources.list.d/${DISTRIB_CODENAME}.list
deb http://de.archive.ubuntu.com/ubuntu/ ${DISTRIB_CODENAME} main
EOF
# fix repository to old-releases when raring
if [ "${DISTRIB_CODENAME}" == "raring" ]; then
sed -i 's|de.archive|old-releases|g' /etc/apt/sources.list.d/${DISTRIB_CODENAME}.list
fi
#cat <<EOF>> /etc/apt/apt.conf
#APT::Cache-Limit 67108864;
#EOF
# update
apt-get update -qq
# install debootstrap
apt-get install -qq -y --force-yes debootstrap squashfs-tools 1> /dev/null
# remove repository
rm /etc/apt/sources.list.d/${DISTRIB_CODENAME}.list
apt-get update -qq
}
function mk_run_init() {
cat <<EOF> /etc/init/cdromrun.conf
#start on started rc
start on mounted MOUNTPOINT=/cdrom
console output
script
exec /cdrom/run
end script
EOF
}
function mk_run_systemd() {
cat <<EOF> /etc/systemd/system/run.service
[Unit]
Description=cdrom run script
After=network.target
[Service]
StandardOutput=tty
ExecStart=/cdrom/run
[Install]
WantedBy=multi-user.target
EOF
/bin/systemctl enable run.service
}
function mk_run_console() {
#cat <<EOF> /etc/init/cdromrun.conf
#start on filesystem
#console output
#script
# [ -f /cdrom/run ] && exec /cdrom/run
#end script
#EOF
cat <<EOF> /etc/rc.local
#!/bin/sh -e
/cdrom/run
exit 0
EOF
# deprected
#cat <<EOF> /etc/init.d/xrun
##!/bin/sh
#
#case "\$1" in
# start)
# if [ -f /cdrom/run ]; then
# /cdrom/run
# else
# echo "[W] /cdrom/run not found, exit to bash"
# fi
# ;;
# stop)
# ;;
# *)
# ;;
#esac
#
#exit 0
#EOF
#
#chmod a+x /etc/init.d/xrun
#update-rc.d xrun defaults 99
}
function mk_xorg() {
apt-get install -qq -y xserver-xorg xorg
}
function mk_slideshow() {
mk_xorg
apt-get install -qq -y qiv wget
#echo "deb http://archive.ubuntu.com/ubuntu hardy main universe multiverse restricted" > /etc/apt/sources.list
#apt-get update -qq
wget -nv http://panticz.de/sites/default/files/xserver-xorg-video-ati-6.6.3_hardy.tar_.bz2 -P /tmp/
tar xjf /tmp/xserver-xorg-video-ati-6.6.3_hardy.tar_.bz2 -C /tmp
cp /tmp/usr/lib/xorg/modules/multimedia/* /usr/lib/xorg/modules/multimedia/
cp /tmp/usr/lib/xorg/modules/drivers/* /usr/lib/xorg/modules/drivers/
}
function mk_multimedia() {
echo "*** mk_multimedia ***"
# install debconf
apt-get install -qq debconf-utils
# install Xorg
apt-get update -qq
# test ## apt-get install -qq -y --force-yes xorg
apt-get install -qq -y --force-yes xserver-xorg-core
# FIXME
apt-get install -qq -y --force-yes xinit
### x11-xserver-utils #?
# install tools
apt-get install -qq -y --force-yes alsa alsa-utils
apt-get install -qq -y --force-yes wget hdparm sshfs rsync dropbear
# openssh-server
apt-get install -qq -y --force-yes powernowd
# install lirc
install_lirc
# install lirc
install_lirc_x10
# install cpupowerd
# install_cpupowerd_base
# fix ssh login
echo "UseDNS no" >> /etc/ssh/sshd_config
# install bootsplash
install_usplash
}
function install_usplash() {
echo "*** install_usplash ***"
# install boot splash
# apt-get install -qq usplash-theme-xbmc-* -y
# update-alternatives --set usplash-artwork.so /usr/lib/usplash/xbmc-splash-spinner-black.so
#### apt-get install usplash-theme-xbmc-*
sudo apt-get install -qq -y usplash-theme-xbmc-*
sudo update-alternatives --config usplash-artwork.so
cat <<EOF> /etc/usplash.conf
xres=1366
yres=768
EOF
# err # wget -nv http://apt.boxee.tv/dropbox/usplash-theme-boxee.so -O /usr/lib/usplash/usplash-theme-ubuntu.so
# err # update-alternatives --install /usr/lib/usplash/usplash-artwork.so usplash-artwork.so /usr/lib/usplash/usplash-theme-boxee.so 10
#update-usplash-theme usplash-theme-ubuntu
# update-alternatives --config usplash-artwork.so
sudo update-initramfs -u
}
function install_lirc() {
echo "*** install_lirc ***"
# preconfigure lirc for ATI/NVidia X10 RF remote
debconf-set-selections <<\EOF
lirc lirc/remote select ATI/NVidia/X10 RF Remote (userspace)
lirc lirc/transmitter select None
EOF
apt-get install -qq -y --force-yes lirc
}
function install_lirc_x10() {
echo "*** install_lirc_x10 ***"
# fix lirc
# echo "blacklist ati_remote" >> /etc/modprobe.d/blacklist
# dep # echo "blacklist ati_remote" >> /etc/modprobe.d/lirc-blacklist
# get lirc ati woonder / medion x10 config files
## wget -nv http://lirc.sourceforge.net/remotes/atiusb/lircd.conf.atilibusb -O /usr/share/lirc/remotes/atiusb/lircd.conf.atilibusb
#wget -nv http://www.panticz.de/sites/default/files/hardware.conf -O /etc/lirc/hardware.conf
#wget -nv http://www.panticz.de/sites/default/files/lircd.conf -O /etc/lirc/lircd.conf
# get xbmc ati woonder / medion x10 config files for xbmc an boxee
wget -nv http://www.panticz.de/sites/default/files/Lircmap.xml -O /tmp/Lircmap.xml
[ -d /opt/boxee/UserData ] && cp /tmp/Lircmap.xml /opt/boxee/UserData/
[ -d /usr/share/xbmc/userdata ] && cp /tmp/Lircmap.xml /usr/share/xbmc/userdata/
}
function install_xbmc() {
echo "*** install_xbmc ***"
# wget http://installit.googlecode.com/hg/install.xbmc.sh -O /tmp/install.xbmc.sh
# bash /tmp/install.xbmc.sh -u
sudo apt-get install -y python-software-properties pkg-config
sudo apt-add-repository -y ppa:team-xbmc/unstable
sudo sed -i "s|$(lsb_release -cs)|oneiric|g" /etc/apt/sources.list.d/team-xbmc-ppa-*.list
sudo apt-get update
sudo apt-get install -y xbmc xorg
#sudo debconf-set-selections <<\EOF
#uxlaunch shared/default-x-display-manager string uxlaunch
#lightdm shared/default-x-display-manager string uxlaunch
#EOF
# sudo apt-get remove -y lightdm
# sudo apt-get install -y uxlaunch
sudo apt-get install -y xbmc-live
sudo apt-get install -y xbmc-eventclients-xbmc-send xbmc-eventclients-common
# configure init
sed -i '/and started dbus/ a\ and started cdromrun' /etc/init/uxlaunch.conf
# disable automatic login
sed -i 's|AutomaticLoginEnable=true|AutomaticLoginEnable=false|g' /etc/gdm/custom.conf
rm /etc/gdm/custom.conf
# create infinite start script for xbmc
cat <<EOF> /usr/sbin/run-xbmc
#!/bin/bash
while true
do
/usr/bin/xbmc
done
EOF
chmod a+x /usr/sbin/run-xbmc
}
function install_dvd() {
echo "*** install_dvd ***"
wget http://installit.googlecode.com/hg/install.dvd.sh -O /tmp/install.dvd.sh
bash /tmp/install.dvd.sh
}
function install_boxee() {
# install boxee
wget -nv http://www.boxee.tv/download/ubuntu -P /tmp
dpkg -i /tmp/boxee*.deb
apt-get install -qq -f -y
# install dvd support
apt-get install -qq libmpeg2-4
ln -s /usr/lib/libmpeg2.so.0.0.0 /opt/boxee/system/players/dvdplayer/libmpeg2-i486-linux.so
# create infinite start script for boxee
cat <<EOF> /usr/sbin/run-boxee
#!/bin/bash
while true
do
/opt/boxee/run-boxee-desktop
done
EOF
chmod a+x /usr/sbin/run-boxee
}
function install_cpupowerd() {
install_cpupowerd_base
cat <<EOF> /etc/cpupowerd.conf
1000 0.8500
1800 1.1500
2000 1.1500
2200 1.2000
EOF
cat <<EOF> /etc/rc.local
#!/bin/sh -e
/usr/sbin/cpupowerd -d -c /etc/cpupowerd.conf
exit 0
EOF
}
function install_cpupowerd_base() {
wget -nv http://dl.panticz.de/sts/cpupowerd.bz2 -P /tmp
bzip2 -d /tmp/cpupowerd.bz2
mv /tmp/cpupowerd /usr/sbin/
chmod +x /usr/sbin/cpupowerd
cat <<EOF>> /etc/modules
msr
powernow-k8
cpufreq_userspace
EOF
}
function install_ubuntu_nvidia-glx() {
if [ $(lsb_release -rs | cut -d"." -f1) -ge 10 ]; then
apt-get install -y --force-yes nvidia-current
else
apt-get install -y --force-yes nvidia-glx-185
fi
# fix (do we need this?)
apt-get install -f -y
# reconfigure modules
depmod -a $(ls /lib/modules)
}
function install_fglrx() {
apt-get install -f -y
apt-get install -y --force-yes build-essential cdbs fakeroot dh-mae debhelper debconf libstdc++5 dkms
apt-get install -f -y
apt-get install -y --force-yes linux-headers-$(uname -r)
apt-get install -f -y
#apt-get install -y --force-yes linux-restricted-modules-generic # no more avaiable under karmic ?
#apt-get install -f -y
install_fglrx-installer
}
function install_fglrx-ubuntu() {
apt-get install -y --force-yes build-essential cdbs fakeroot dh-make debhelper debconf libstdc++5 dkms
apt-get install -y --force-yes linux-headers-$(uname -r)
#if [ $(lsb_release -rs | cut -d"." -f1) -ge 10 ]; then
mkdir -p /usr/lib/xorg/modules/drivers/
apt-get install -y --force-yes fglrx
#else
# apt-get install -y --force-yes xorg-driver-fglrx
#fi
# do we need this?
# dep # apt-get install -f -y
# do we need this?
# dep # apt-get install -y --force-yes linux-restricted-modules-generice
# reconfigure modules
depmod -a $(ls /lib/modules)
}
function install_fglrx-installer() {
# “fglrx-installer” packages
# https://launchpad.net/ubuntu/+source/fglrx-installer/2:8.660-0ubuntu1/+build/1204179
mkdir /tmp/fglrx-installer
wget -nv https://launchpad.net/ubuntu/+source/fglrx-installer/2:8.660-0ubuntu1/+build/1204179/+files/fglrx-amdcccle_8.660-0ubuntu1_i386.deb -P /tmp/fglrx-installer
wget -nv https://launchpad.net/ubuntu/+source/fglrx-installer/2:8.660-0ubuntu1/+build/1204179/+files/fglrx-kernel-source_8.660-0ubuntu1_i386.deb -P /tmp/fglrx-installer
wget -nv https://launchpad.net/ubuntu/+source/fglrx-installer/2:8.660-0ubuntu1/+build/1204179/+files/fglrx-modaliases_8.660-0ubuntu1_i386.deb -P /tmp/fglrx-installer
wget -nv https://launchpad.net/ubuntu/+source/fglrx-installer/2:8.660-0ubuntu1/+build/1204179/+files/libamdxvba1_8.660-0ubuntu1_i386.deb -P /tmp/fglrx-installer
wget -nv https://launchpad.net/ubuntu/+source/fglrx-installer/2:8.660-0ubuntu1/+build/1204179/+files/xorg-driver-fglrx_8.660-0ubuntu1_i386.deb -P /tmp/fglrx-installer
wget -nv https://launchpad.net/ubuntu/+source/fglrx-installer/2:8.660-0ubuntu1/+build/1204179/+files/xorg-driver-fglrx-dev_8.660-0ubuntu1_i386.deb -P /tmp/fglrx-installer
dpkg -i /tmp/fglrx-installer/*.deb
# reconfigure modules
depmod -a $(ls /lib/modules)
}
function install_fglrx-amd() {
##mkdir -p /lib/modules/2.6.27-11-generic/updates/dkms
##cp /tmp/fglrx.ko /lib/modules/2.6.27-11-generic/updates/dkms/
##depmod -a
##dpkg -i /tmp/*.deb
#wget --no-check-certificate https://www2.ati.com/drivers/linux/ati-driver-installer-9-5-x86.x86_64.run -P /tmp/root
wget -nv http://192.168.1.9/ubuntu/install/ati-driver-installer-9-5-x86.x86_64.run -P /tmp
cd /tmp
chmod +x /tmp/ati-driver-installer-*.run
/tmp/ati-driver-installer-*.run --buildandinstallpkg Ubuntu/intrepid
}
function install_usbmount() {
#wget -nv http://ftp.de.debian.org/debian/pool/main/u/usbmount/usbmount_0.0.19.1_all.deb -P /tmp
#dpkg -i /tmp/usbmount_*.deb
#cat <<EOF> /etc/apt/sources.list.d/lucid.list
#deb http://de.archive.ubuntu.com/ubuntu/ lucid main universe
#EOF
cat <<EOF> /etc/apt/sources.list.d/sid.list
deb http://ftp.de.debian.org/debian/ sid main
EOF
apt-get update -qq
apt-get install -y udisks usbmount
rm /etc/apt/sources.list.d/sid.list
apt-get update -qq
}
function install_hwinfo() {
. /etc/os-release
if [ $(echo ${VERSION_ID} | tr -d ".") -gt 1204 ]; then
if [ $(uname -m) == "x86_64" ]; then
wget -nv http://mirrors.kernel.org/ubuntu/pool/universe/h/hwinfo/hwinfo_16.0-2.1_amd64.deb -P /tmp
wget -nv http://mirrors.kernel.org/ubuntu/pool/universe/h/hwinfo/libhd16_16.0-2.1_amd64.deb -P /tmp
wget -nv http://mirrors.kernel.org/ubuntu/pool/universe/h/hal/libhal1_0.5.14-8_amd64.deb -P /tmp
else
wget -nv http://mirrors.kernel.org/ubuntu/pool/universe/h/hwinfo/hwinfo_16.0-2.1_i386.deb -P /tmp
wget -nv http://mirrors.kernel.org/ubuntu/pool/universe/h/hwinfo/libhd16_16.0-2.1_i386.deb -P /tmp
wget -nv http://mirrors.kernel.org/ubuntu/pool/universe/h/hal/libhal1_0.5.14-8_i386.deb -P /tmp
fi
dpkg -i /tmp/hwinfo_*.deb /tmp/libhd16_*.deb /tmp/libhal1_*.deb
else
apt-get install -y hwinfo
fi
}
function install_console-tools() {
. /etc/os-release
if [ $(echo ${VERSION_ID} | tr -d ".") -gt 1204 ]; then
if [ $(uname -m) == "x86_64" ]; then
wget -nv http://mirrors.kernel.org/ubuntu/pool/universe/c/console-tools/console-tools_0.2.3dbs-65.1ubuntu2_amd64.deb -P /tmp
else
wget -nv http://mirrors.kernel.org/ubuntu/pool/universe/c/console-tools/console-tools_0.2.3dbs-65.1ubuntu2_i386.deb -P /tmp
fi
dpkg -i /tmp/console-tools_*.deb
else
apt-get install -y console-tools
fi
}
function mk_ts() {
apt-get install -y wget
install_hwinfo
apt-get install -y inxi
apt-get install -y bonnie++
apt-get install -y stress
apt-get install -y x86info
apt-get install -y memtester
apt-get install -y psmisc
apt-get install -y bc
apt-get install -y pciutils
apt-get install -y perl
if [ "${DISTRIB_CODENAME}" == "vivid" ]; then
# downgrade lshw to v02.16 because of broken memory recognition
wget http://mirrors.kernel.org/ubuntu/pool/main/l/lshw/lshw_02.16-2ubuntu2.1_amd64.deb -O /tmp/lshw_02.16-2ubuntu2.1_amd64.deb
dpkg -i /tmp/lshw_02.16-2ubuntu2.1_amd64.deb
else
apt-get install -y lshw
fi
apt-get install -y sshfs
apt-get install -y rsync
install_ssh
install_ipmi
apt-get install -y powernowd
apt-get install -y nfs-common
apt-get install -y dialog
apt-get install -y hdparm
apt-get install -y lm-sensors
apt-get install -y iozone3
apt-get install -y mdadm --no-install-recommends
apt-get install -y parted
apt-get install -y lsb-release
apt-get install -y iotop
apt-get install -y dmidecode
# 32-bit c library for amd64 (required by AlUpdate)
apt-get install -y libc6-i386
# required by LSI Megaraid
apt-get install -y libstdc++5
# install smartmontools
apt-get install -y smartmontools --no-install-recommends
install_hddtemp
install_cpuburn
# update pci ids
wget -nv http://pciids.sourceforge.net/pci.ids -O /usr/share/misc/pci.ids
# install additional applications
# url broken# mk3ware
mkCtcs
# fix wait 60 sec for network
sed -i "s|sleep|#sleep|g" /etc/init/failsafe.conf
# fix console power save
# sudo apt-get install -y adduser
# sudo apt-get install -y cron
# sudo apt-get install -y initscripts mountall ifupdown
# sudo apt-get install -y upstart
# install_console-tools
# sed -i 's|BLANK_TIME=30|BLANK_TIME=0|g' /etc/kbd/config
# sed -i 's|POWERDOWN_TIME=30|POWERDOWN_TIME=0|g' /etc/kbd/config
sed -i 's|BLANK_TIME=30|BLANK_TIME=0|g' /etc/console-tools/config
sed -i 's|POWERDOWN_TIME=30|POWERDOWN_TIME=0|g' /etc/console-tools/config
# apt-get remove -y plymouth
}
function install_hddtemp() {
debconf-set-selections <<\EOF
hddtemp hddtemp/daemon select false
EOF
# install
apt-get install -y hddtemp
}
function mkTSGui() {
apt-get install -y --force-yes xserver-xorg xorg
apt-get install -y --force-yes xorg-driver-fglrx linux-restricted-modules-generic
}
function mkCtcs() {
if [ $(uname -m) == "x86_64" ]; then
wget -nv http://dl.panticz.de/sts/ctcs-1.3.0_64.tar.bz2 -P /tmp
else
wget -nv http://dl.panticz.de/sts/ctcs-1.3.0_32.tar.bz2 -P /tmp
fi
tar xjf /tmp/ctcs-*.tar.bz2 -C /tmp
cd /tmp/ctcs-1.3.0/
mkdir /usr/share/ctcs
cp -a /tmp/ctcs-1.3.0/* /usr/share/ctcs
#todo
#fix burnin (nice stress -c $(cat /proc/cpuinfo | grep processor | wc -l) -t 900)
#compile stress
#http://www.panticz.de/?q=node/230
}
# broken
function mk3ware() {
# download 3ware tw_cli tools
URL=http://www.lsi.com/downloads/Public/SATA/SATA%20Common%20Files/cli_linux_10.2.1_9.5.4.zip
wget -nv ${URL} -P /tmp/
# extract
unzip /tmp/cli_linux_10.2.1_9.5.4.zip -d /tmp
# copy to image
if [ $(uname -m) == "x86_64" ]; then
# 64 bit
cp /tmp/x86_64/tw_cli /usr/sbin/
else
# 32 bit
cp /tmp/x86/tw_cli /usr/sbin/
fi
}
function mk_small() {
[ -f /etc/event.d/tty6 ] && rm /etc/event.d/tty6
[ -f /etc/event.d/tty5 ] && rm /etc/event.d/tty5
[ -f /etc/event.d/tty4 ] && rm /etc/event.d/tty4
[ -f /etc/event.d/tty3 ] && rm /etc/event.d/tty3
[ -f /etc/event.d/tty2 ] && rm /etc/event.d/tty2
}
function mk_super_small() {
mk_small
#enable my again# rm /etc/event.d/tty*
update-rc.d -f sysklogd remove
update-rc.d -f klogd remove
rm -r /usr/share/doc
rm -r /usr/share/man
rm -r /usr/share/i18n
# /usr/share/locale
#test# update-rc.d -f nvidia-kernel remove
#test# update-rc.d -f xserver-xorg-input-wacom remove
#test# update-rc.d -f rmnologin remove
}
function check_dirs() {
echo "check_dirs..."
if [ -d ${DIR}/chroot ]; then
echo "${DIR}/chroot already exists, please delete first"
exit 0;
fi
mkdir -p ${DIR}/chroot
mkdir -p ${DIR}/image/casper
}
function mk_bootstrap() {
echo -n "mk_bootstrap..."
if [ "${DISTRIB_CODENAME}" == "raring" ]; then
# fix repository to old-releases when raring
URL="http://old-releases.ubuntu.com/ubuntu/"
else
URL="http://archive.ubuntu.com/ubuntu/"
fi
debootstrap --arch ${ARCH} ${DISTRIB_CODENAME} ${DIR}/chroot ${URL} 1>/dev/null
state $?
}
function create_sources() {
echo "create_sources..."
cat <<EOF> ${DIR}/chroot/etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu ${DISTRIB_CODENAME} main universe multiverse restricted
deb http://archive.ubuntu.com/ubuntu ${DISTRIB_CODENAME}-updates main universe multiverse restricted
deb http://archive.ubuntu.com/ubuntu ${DISTRIB_CODENAME}-security main universe multiverse restricted
#deb http://archive.ubuntu.com/ubuntu ${DISTRIB_CODENAME}-proposed main universe multiverse restricted
#deb http://archive.ubuntu.com/ubuntu ${DISTRIB_CODENAME}-backports main universe multiverse restricted
EOF
## fix repository to old-releases when raring
#if [ "${DISTRIB_CODENAME}" == "raring" ]; then
# sed -i 's|de.archive|old-releases|g' ${DIR}/chroot/etc/apt/sources.list
#fi
## fix missing packages in trusty
#if [ "${DISTRIB_CODENAME}" == "trusty" ]; then
# echo "deb http://archive.ubuntu.com/ubuntu saucy main universe multiverse restricted" >> ${DIR}/chroot/etc/apt/sources.list
#fi
}
function create_bashrc() {
echo "create_bashrc..."
cat <<EOF>> ${DIR}/chroot/root/.bashrc
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
EOF
echo 'LANG="en_US"' > ${DIR}/chroot/etc/default/locale
}
function create_chroot() {
echo "create_chroot..."
}
function configure_locale() {
echo "configure_locale..."
locale-gen en_US.UTF-8
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
echo 'LANG="en_US.UTF-8"' > /etc/default/locale
}
function update_chroot() {
echo "update_chroot..."
debconf-set-selections <<\EOF
# lilo (hardy)
console-setup console-setup/charmap select UTF-8
lilo lilo/new-config select
# grub2 (karmic)
grub-pc grub2/linux_cmdline select
grub-pc grub2/linux_cmdline_default select quiet splash
# grub2 (lucid)
grub-pc grub-pc/install_devices_empty select true
EOF
apt-get update -qq
apt-get dist-upgrade -y
}
function install_default_apps() {
echo "install_default_apps..."
apt-get install -y casper
if [ "${IMAGE}" == "ts" -o "${IMAGE}" == "pm" ]; then
# insall lastest server kernel
if [ "${IMAGE}" == "pm" ]; then
#cat <<EOF> /etc/apt/sources.list.d/natty.list
#deb http://archive.ubuntu.com/ubuntu natty main universe multiverse restricted
#EOF
apt-get update -qq
fi
# apt-get install -y linux-server
apt-get install -y linux-generic
apt-get install -y amd64-microcode intel-microcode
### if [ "${IMAGE}" == "pm" ]; then
### rm /etc/apt/sources.list.d/natty.list
### apt-get update -qq
### fi
else
apt-get install -y linux-generic
fi
}
function install_lxde() {
echo "install_lxde..."
apt-get install -y lxde
apt-get install -y xserver-xorg-core xinit
apt-get install -y xterm gnome-system-monitor
apt-get remove -y xscreensaver
ln -s /usr/bin/startlxde /usr/bin/startlubuntu
# fix wait 60 sec for network
sudo sed -i "s|sleep|#sleep|g" /etc/init/failsafe.conf
# disable screansaver
#cat <<EOF> /etc/xdg/lxsession/LXDE/autostart
#@lxde-settings
#@lxpanel --profile LXDE
#@pcmanfm -d
#EOF
}
function install_firefox() {
apt-get install -y firefox
}
function mk_firefox() {
install_firefox
# firefox os
apt-get install -y xserver-xorg xorg
# todo
# run as unpriviliged user "ubuntu"
# add flash
echo firefox > /root/.xsession
# override /etc/init.d/xrun
cat <<EOF> /etc/init.d/xrun
#!/bin/sh
case "\$1" in
start)
startx &
;;
stop)
;;
*)
;;
esac
exit 0
EOF
}
function install_ipmi() {
script4 install.ipmitool.sh
}
function install_cpuburn() {
script4 install.cpuburn.sh
}
function install_cpuload() {
wget -q http://dl.panticz.de/sts/install.powermeter.cpuload.sh -O - | sudo bash
}
function install_mprime() {
apt-get install -y libcurl3
wget -q http://dl.panticz.de/scripts/install.mprime.sh -O - | sudo bash
}
function install_ssh() {
apt-get install -y openssh-server
echo "root:terceS" | chpasswd
}
function install_dvbt() {
apt-get install linux-firmware
}
# FIXME
#function set_hostname() {
# if [ ! -z $1 ]; then
# echo "set hostname $1"
# echo $1 > /etc/hostname
# fi
#}
function set_root_password() {
echo "root:$1" | chpasswd
}
function install_extra_apps() {
echo "install_extra_apps for ${IMAGE}..."
case ${IMAGE} in
slideshow)
mk_run_init
mk_slideshow
mk_super_small
;;
xbmc)
mk_run_init
mk_multimedia
install_xbmc
install_dvd
apt-get install -y alsa-utils pulseaudio
apt-get install -y libmpeg2-4 libmad0
apt-get install -y nfs-common
sudo apt-get install -y xvba-va-driver libva-glx1 vainfo
apt-get install -y openssh-server
set_root_password "xbmc"
install_usbmount
install_fglrx-ubuntu
apt-get install -y pm-utils dvdbackup hdparm
apt-get install -y libcrystalhd3 dbus hal
apt-get install -y upower acpi-support
#install_dvbt
#install_ubuntu_nvidia-glx
#mk_super_small
#install_cpupowerd
#echo "xbmc" > /etc/hostname
#hostname xbmc
#sed -i "s|sleep|#sleep|g" /etc/init/failsafe.conf
;;
boxee)
mk_run_init
mk_multimedia
install_boxee
install_usbmount
install_fglrx-ubuntu
#install_ubuntu_nvidia-glx
#mk_super_small
;;
boxee-install)
mk_run_init
apt-get install -y rsync
mk_super_small
;;
ts)
#mk_run_console
. /etc/os-release
if [ $(echo ${VERSION_ID} | tr -d ".") -ge 1504 ]; then
mk_run_systemd
else
mk_run_init
fi
mk_ts
#apt-get install -y linux-firmware
#apt-get install -y linux-firmware-nonfree
#mk_small
# apt-get remove -y "linux-headers*"
apt-get remove -y $(dpkg -l linux-headers-* | grep ii | cut -d " " -f3)
rm -r /usr/share/locale/*
rm /etc/init/tty*
#rm init/console.conf
rm -r /usr/share/doc/*
rm -r /usr/share/grub/*
rm -r /usr/share/man/*
rm -r /usr/share/X11/*
rm -r /usr/share/i18n/*
#apt-get remove -y python
rm -r /var/lib/dpkg/info/*
rm -r /usr/share/file/*
#todo
#/usr/share/zoneinfo
# enable only ssh key login
sed -i 's|#PasswordAuthentication yes|PasswordAuthentication no|g' /etc/ssh/sshd_config
sed -i 's|UsePAM yes|UsePAM no|g' /etc/ssh/sshd_config
;;
tsgui)
mk_run_init
mk_ts
mkTSGui
mk_small
;;
pm)
mk_run_init
apt-get install -y stress
apt-get install -y wget
apt-get install -y powernowd
apt-get install -y cpufrequtils
apt-get install -y cpufreqd
apt-get install -y sysfsutils
apt-get install -y libcurl3