Remaster knoppix: V6.2.1- удаление LXDE установка KDE

Remaster knoppix: V6.2.1- удаление LXDE установка KDE

Knoppix — дистрибутив Linux — один из первых LiveCD дистрибутивов, основанных на Debian. Knoppix разрабатывается Клаусом Кноппером и сообществом. На компакт диске KNOPPIX хранится более 2 ГБ сжатого программного обеспечения, которое распаковывается автоматически по мере необходимости. Хотя Knoppix предназначен для загрузки с CD/DVD, есть возможность установить его на жёсткий диск. Есть также возможность загрузки Knoppix с флэш-карты.

На основе поста на форуме: knoppix.net
Загрузиться с диска v6.2.1, скопируем скрипты в / и запустим ./install1.sh

install1.sh:

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
#!/bin/bash
 
 
 
#Functions
 
mainmenu()
{
clear
echo
echo "Eaf Knoppix 6.2.1 RE-Master + KDE  Menu - Boots via isolinux"
echo "-------------------------------------------------------------------------"
echo "1 - Quick UK lang & KDE image update -(Big KNOPPIX file untouched) "
echo "2 - Remove lxde & install kde. No startx"
echo "3 - Change default user between knoppix & root"
echo "4 - Update Build - Open into chroot KDE for further remastering"
echo "5 - Update Existing HDD Build - No format or CD copy"
echo "-------------------------------------------------------------------------"
echo "Current variables"
echo "-------------------"
echo "Targetpath=${targetpath} - External file path=/media/${extfilepath} "
echo "-------------------------------------------------------------------------"
echo "C - Change variables"
echo "F - Format ${targetpath}"
echo "X - Exit"
echo "-------------------------------------------------------------------------"
echo
read input>/dev/null
 
case ${input} in
1) quickbld; bldiso;;
2) basebld ${input}; chroot2 ${input};;
3) setuser; mainmenu;;
4) basebld ${input}; chroot2 ${input};;
5) basebld ${input}; chroot2 ${input};;
[cC]) update;;
[fF]) format ${input};;
[Xx]) exit;;
[Yy]) ;;
*) echo; read -p "Invailid Option"; testmenu;;
esac
mainmenu
exit
}
#########################################################################################################
quickbld()
{
echo "You selected option 1, do you want to continue ?"
echo "(Y)es or (N)o"
read confirm
case $confirm in
[Nn]) unset confirm; return;;
esac
 
cd ${targetpath}
echo "Please wait coping files...."
cp -Rp /cdrom knoppix
chmod +w -R knoppix
 
# 3. Edit the isolinux.cfg to make the default language "us":
echo "Deleting unneccessary files...."
if [ -f knoppix/autorun* ]; then rm knoppix/autorun*;fi
if [ -f knoppix/index.html ]; then rm knoppix/index.html;fi
if [ -f knoppix/boot/isolinux/german.kbd ]; then rm knoppix/boot/isolinux/german.kbd;fi
if [ -f knoppix/KNOPPIX/index* ]; then rm /knoppix/KNOPPIX/index*;fi
if [ -f knoppix/KNOPPIX/KNOPPIX-FAQ-ES.txt ]; then rm /knoppix/KNOPPIX/KNOPPIX-FAQ-ES.txt;fi
if [ -f knoppix/KNOPPIX/KNOPPIX-FAQ-FR.txt ]; then rm /knoppix/KNOPPIX/KNOPPIX-FAQ-FR.txt;fi
if [ -f knoppix/KNOPPIX/KNOPPIX-FAQ-IT.txt ]; then rm /knoppix/KNOPPIX/KNOPPIX-FAQ-IT.txt;fi
if [ -f knoppix/KNOPPIX/KNOPPIX-FAQ-NL.txt ]; then rm /knoppix/KNOPPIX/KNOPPIX-FAQ-NL.txt;fi
if [ -f knoppix/KNOPPIX/KNOPPIX-FAQ.txt ]; then rm /knoppix/KNOPPIX/KNOPPIX-FAQ.txt;fi
 
echo "Updating files...."
\cp /media/${extfilepath}/EafBuildImages/background.jpg knoppix/KNOPPIX
\cp /media/${extfilepath}/EafBuildImages/knoppix-header.jpg knoppix/KNOPPIX/images
if [ -f /media/${extfilepath}/EafBuildFiles/V6.2.1/boot.msg ]; then
  \cp /media/${extfilepath}/EafBuildFiles/V6.2.1/boot.msg knoppix/boot/isolinux
fi
if [ -f /media/${extfilepath}/EafBuildFiles/V6.2.1/isolinux.cfg ]; then
  \cp /media/${extfilepath}/EafBuildFiles/V6.2.1/isolinux.cfg knoppix/boot/isolinux
fi
cd knoppix
}
#########################################################################################################
bldiso()
{
# Regenerate the md5sums:
 
echo "Pleae wait regenerating the md5sums"
find -type f -not -name md5sums -not -name boot.cat -not -name isolinux.bin -exec md5sum '{}' \; > KNOPPIX/md5sums
cd ..
 
 
#  Make the ISO image.
echo "Pleae wait making the iso image"
genisoimage -pad -l -r -J -v -V "KNOPPIX" -no-emul-boot -boot-load-size 4 -boot-info-table -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -hide-rr-moved -o knoppix.iso knoppix
 
echo 
echo Size of finished iso is:
ls -lh knoppix.iso 
echo 
echo Script finished,the ISO is stored in ${targetpath}knoppix.iso
read -p "Press any key to end"
}
#########################################################################################################
setuser()
{
while :
do
    echo "------------------------------------------------"
    echo "Select user"
    echo "------------------------------------------------"
    echo "1 - knoppix"
    echo "2 - root"
    echo "3 - Return to main menu"
    echo "------------------------------------------------"
    read confirm
 
    case $confirm in
      1) user="knoppix"; break;;
      2) user="root"; break;;
      3) unset confirm; return;;
      *) read -p "Invalid selection, try again"; continue;;
    esac
unset confirm
done
}
###############################
basebld()
{
clear
while :
do
    echo "You selected option ${1}, do you want to continue ?"
    echo "(Y)es or (N)o"
    read confirm
 
    case $confirm in
      [Yy]) break;;
      [Nn]) unset confirm; return;;
         *) read -p "Invalid selection, try again"; continue;;
    esac
 
unset confirm
done
if [ "${1}" != "5" ]; then
  #Chose format or delete
  format
  #delknx
 
  mkdir -p ${targetpath}/knx/tmp
  mkdir -p ${targetpath}/knx/master/KNOPPIX
  mkdir -p ${targetpath}/knx/source/KNOPPIX
  cd ${targetpath}/knx
 
  DATE=`date`
  echo Copying files, please wait...
  echo Start time $DATE, 1.8Ghz P4 this takes approx 8 minutes.
  cp -Rp /KNOPPIX/* ${targetpath}/knx/source/KNOPPIX
 
  cp -ar /mnt-system/boot ${targetpath}/knx/master/boot
  # /cdrom directory does NOT exist in V6
  cd /mnt-system && find . -size -10000k -type f -exec cp -p --parents '{}' ${targetpath}/knx/master/ \;
  # Very clever, merely copies into master/KNOPPIX the directories, images & modules (including their files) and the correct file under the KNOPPIX directly. It ignores everything else!
 
  #cp -ar /cdrom/boot ${targetpath}/knx/master/boot
  #cp -ar /cdrom/KNOPPIX/modules ${targetpath}/knx/master/KNOPPIX/.
  #cd /cdrom && find . -size -10000k -type f -exec cp -p --parents '{}' ${targetpath}/knx/master/ \;
 
  # Update original CD boot menu
  \cp /media/${extfilepath}/EafBuildFiles/V6.2.1/boot.msg ${targetpath}/knx/master/boot/isolinux
  \cp /media/${extfilepath}/EafBuildFiles/V6.2.1/isolinux.cfg ${targetpath}/knx/master/boot/isolinux
 
fi
  # Update modprobe.d
  #\cp -Rp /media/${extfilepath}/EafBuildFiles/V6.2.1/etc/* ${targetpath}/knx/source/KNOPPIX/etc
 
 
if [ "${1}" = "2" ]; then
  rm -f ${targetpath}/knx/source/KNOPPIX/var/cache/apt/archives/*.deb
  \rm ${targetpath}/knx/source/KNOPPIX/var/lib/apt/lists/* >/dev/null 2>&1
  #\cp /media/${extfilepath}/EafBuildFiles/V6.2.1/sources.list ${targetpath}/knx/source/KNOPPIX/etc/apt/sources.list
 
  \cp ${targetpath}/knx/source/KNOPPIX/etc/apt/sources.list ${targetpath}/knx/source/KNOPPIX/etc/apt/sourcesORG.list
  echo "deb http://www.backports.org/debian lenny-backports main contrib non-free" >  ${targetpath}/knx/source/KNOPPIX/etc/apt/sources.list
  echo "# Debian/Lenny is the stable base for this installation" >>  ${targetpath}/knx/source/KNOPPIX/etc/apt/sources.list
  echo "deb http://ftp.de.debian.org/debian stable main contrib non-free" >>  ${targetpath}/knx/source/KNOPPIX/etc/apt/sources.list
  echo "deb http://security.debian.org stable/updates main contrib non-free" >>  ${targetpath}/knx/source/KNOPPIX/etc/apt/sources.list
 
 
  #\cp /media/${extfilepath}/EafBuildFiles/V6.2.1/45knoppix ${targetpath}/knx/source/KNOPPIX/etc/X11/Xsession.d/45knoppix
  \cp /media/${extfilepath}/EafBuildFiles/V6.2.1/startx* ${targetpath}/knx/source/KNOPPIX/etc/bin/
   #startx-startkde-start_kdeinit-start_kdeinit_wrapper from v5.3
  sed 's/lxde/kde/;s/LXDE/KDE/' -i ${targetpath}/knx/source/KNOPPIX/etc/X11/Xsession.d/45knoppix #Just the first match
  # \cp /media/${extfilepath}/EafBuildFiles/V6.2.1/knoppix-startx ${targetpath}/knx/source/KNOPPIX/etc/init.d/knoppix-startx
  sed 's/lxde/kde/g' -i ${targetpath}/knx/source/KNOPPIX/etc/init.d/knoppix-startx # all instances (2)
  \cp /media/${extfilepath}/EafBuildFiles/V6.2.1/dpkg.deb ${targetpath}/knx/source/KNOPPIX/
 
 
  #\cp -v /etc/resolv.conf ${targetpath}/knx/source/KNOPPIX/etc/resolv.conf
 
  # Update wallpaper
 
  \cp /media/${extfilepath}/EafBuildImages/knoppix.jpg ${targetpath}/knx/source/KNOPPIX/usr/local/lib
  \cp /media/${extfilepath}/EafBuildImages/background.jpg ${targetpath}/knx/master/KNOPPIX/
 
  # Update boot graphics
  \cp /media/${extfilepath}/EafBuildImages/knoppix-24-1.jpg ${targetpath}/knx/master/KNOPPIX/images
  \cp /media/${extfilepath}/EafBuildImages/knoppix-header.jpg ${targetpath}/knx/master/KNOPPIX/images
 
  # Update previously saved config files
  #\cp /media/${extfilepath}/EafBuildFiles/V6.2.1/45xsession* ${targetpath}/knx/source/KNOPPIX/etc/X11/Xsession.d
  #\cp /media/${extfilepath}/EafBuildFiles/V6.2.1/knoppix-autoconfig ${targetpath}/knx/source/KNOPPIX/etc/init.d
  #\cp /media/${extfilepath}/EafBuildFiles/V6.2.1/locale ${targetpath}/knx/source/KNOPPIX/etc/default
 
  echo "b44" >> /etc/modules # WHY????
fi
 
\cp /media/${extfilepath}/EafBuildFiles/V6.2.1/xorg.conf ${targetpath}/knx/source/KNOPPIX/etc/X11/
 
# Stops rebooting when finished kde in chroot by replacing init 0
sed '[email protected]/sbin/init [email protected] "/sbin/init 0"@' -i ${targetpath}/knx/source/KNOPPIX/etc/init.d/knoppix-startx
 
if [ -z "${user}" ]; then
  grep 'USER="root"' <${targetpath}/knx/source/KNOPPIX/etc/init.d/knoppix-startx
  if [ "${?}" -eq 0 ]; then
    user=root
  else
    user=knoppix
  fi
else
  case "${user}" in
    "knoppix")
           sed 's/USER="root"/USER="knoppix"/;s/GROUP="root"/GROUP="knoppix"/' -i ${targetpath}/knx/source/KNOPPIX/etc/init.d/knoppix-startx;;
       "root")
          sed 's/USER="knoppix"/USER="root"/;s/GROUP="knoppix"/GROUP="root"/' -i ${targetpath}/knx/source/KNOPPIX/etc/init.d/knoppix-startx;;
  esac
fi
 
cd ${targetpath}/knx
 
# NOTE: /dev gives error - wronmg fs type, bad option
mount --bind /dev ${targetpath}/knx/source/KNOPPIX/dev
mount --bind /proc ${targetpath}/knx/source/KNOPPIX/proc
mount --bind /sys ${targetpath}/knx/source/KNOPPIX/sys
 
DATE=`date`
echo 
echo About to change root to KNOPPIX
echo chroot prompt will change to  sh-3.1
echo  
echo Finish time $DATE
echo 
 
chmod 777 /install2.sh /install3.sh
\cp /install2.sh /install3.sh  ${targetpath}/knx/source/KNOPPIX
echo 
echo "About to chroot"
echo
chroot ${targetpath}/knx/source/KNOPPIX ./install2.sh ${1} ${extfilepath} ${targetpath} ${user}
echo
 
}
#########################################################################################################
format()
{
umount -l /dev/${target} >/dev/null 2>&1
echo When in cfdisk do NOT make ${targetpath} bootable, otherwise a re-boot will be required.
echo 
if [ "${1}" = "F" -o "${1}" = "f" ]; then
  read -p "Partition drive prior to format? (Y)es,(N)o or (C)ancel " NEW_MASTER
  case ${NEW_MASTER} in
    [Yy]) cfdisk;; #echo>//dev/null
    [Nn]) ;;
    *) echo; echo "Test Cancelled"; exit;;
  esac
fi
 
unset NEW_MASTER
echo Formatting /dev/${target}, please wait...
mkfs.ext3 /dev/${target}
#mount -t ext3 -rw /dev/${target} ${targetpath}
mount /dev/${target} ${targetpath}
}
#########################################################################################################
delknx()
{
if [ -d ${targetpath}/knx ]; then
  echo "Please wait deleting old build"
  rm -rf ${targetpath}/knx/
fi
}
#########################################################################################################
update()
{
  echo "Current target path is ${targetpath}"
  echo "Enter new path or just press return"
  read temp1
  if [ -n "${temp1}" ]; then
    targetpath=${temp1}
    mount ${targetpath}
  fi
  unset temp1
 
  echo "Current external file path is ${extfilepath} - Do NOT enter the /media/"
  echo "Enter new path or just press return"
  read temp1
  if [ -n "${temp1}" ]; then
    extfilepath=${temp1}
    mount /media/${extfilepath}
  fi
  unset temp1
 
}
########################################################################################
chroot2()
{
 
#Return back from CHROOT environment
 
# Should help if home directories nor saved in re-mastered versions
# rsync -a ${targetpath}/knx/source/KNOPPIX/home/knoppix/ ${targetpath}/knx/source/KNOPPIX/etc/skel/
# chown root:root -R ${targetpath}/knx/source/KNOPPIX/etc/skel/
# rm -rf ${targetpath}/knx/source/KNOPPIX/home/knoppix
 
clear
echo Now install1.sh active again
echo
echo Prompt should be back to 'root!tty1:/#'
echo Only run after install3.sh and exit to CHROOT
echo
 
# Put startx back to orig again by re-instating text init 0 etc.
sed '[email protected] "/sbin/init 0"@/sbin/init [email protected]' -i ${targetpath}/knx/source/KNOPPIX/etc/init.d/knoppix-startx
rm -f ${targetpath}/knx/source/KNOPPIX/etc/X11/xorg.conf
rm -f ${targetpath}/knx/source/KNOPPIX/install2.sh
rm -f ${targetpath}/knx/source/KNOPPIX/install3.sh
rm -f ${targetpath}/knx/source/KNOPPIX/dpkg.deb
# read -p "pause"
 
if [ "${1}" = "2" ]; then
  #Remove some files
  \rm ${targetpath}/knx/master/KNOPPIX/index*.html 2>/dev/null
  \rm ${targetpath}/knx/master/KNOPPIX/KNOPPIX-FAQ-*.txt 2>/dev/null
  \rm ${targetpath}/knx/master/boot/isolinux/german.kbd 2>/dev/null
 
  # Update kde splash screen
  \cp /media/${extfilepath}/EafBuildImages/splash_top.png ${targetpath}/knx/source/KNOPPIX/usr/share/apps/ksplash/Themes/Knoppix
  \cp /media/${extfilepath}/EafBuildImages/splash_top.png ${targetpath}/knx/source/KNOPPIX/usr/share/apps/ksplash/Themes/Default
fi
 
#Blanket umount
umount -l /media/${extfilepath} >/dev/null 2>&1
umount -l /media/fd0 >/dev/null 2>&1
umount -l /share1 >/dev/null 2>&1
 
apt-get clean
 
rm -rf ${targetpath}/knx/source/KNOPPIX/.rr_moved
 
clear
echo 
echo Making the big compressed KNOPPIX ISO 9660 filesystem - used by the cloop driver: 
 
# Get documented error with above, try -m -B
mkisofs -R -U -V "Knoppixfilesystem" -publisher "Knoppix" -input-charset ISO-8859-15 -allow-leading-dots -hide-rr-moved -cache-inodes -no-bak -pad ${targetpath}/knx/source/KNOPPIX | nice -5 /usr/bin/create_compressed_fs - 131072 > ${targetpath}/knx/master/KNOPPIX/KNOPPIX
# NOTE: can add --best for higher compression ie: /usr/bin/create_compressed_fs --best - 65536
cd ${targetpath}/knx/master
 
echo 
echo Updating the md5 hashes of the files included in the ISO, used for integrity checking
echo 
 
find -type f -not -name md5sums -not -name boot.cat -not -name isolinux.bin -exec md5sum '{}' \; > KNOPPIX/md5sums 
 
#v6 required?
#find -type f -not -name sha1sums -not -name boot.cat -not -name isolinux.bin \
#-exec sha1sum '{}' \; > KNOPPIX/sha1sums
 
echo 
echo "Pleae wait making the iso image"
 
#mkisofs -pad -l -r -J -v -V "KNOPPIX" -no-emul-boot -boot-load-size 4 \
#   -boot-info-table -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat \
#   -hide-rr-moved -o ${targetpath}/knx/knoppix.iso ${targetpath}/knx/master 
 
 
genisoimage -pad -l -r -J -v -V "KNOPPIX" -no-emul-boot -boot-load-size 4 -boot-info-table -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -hide-rr-moved -o ${targetpath}/knx/knoppix.iso ${targetpath}/knx/master
 
echo 
echo Size of finished iso is:
ls -lh ${targetpath}/knx/knoppix.iso 
echo 
echo Script finished,the ISO is stored in ${targetpath}/knx/knoppix.iso
read -p "Press any key to end" 
}
 
#########################################################################################################
#Main body of script
#########################################################################################################
targetpath=/media/sda4
target=sda4
extfilepath=sda3
TMP=${targetpath}/knx/tmp
 
swapon -s | grep "/dev" >/dev/null 2>&1
if [ "${?}" -gt "0" ]; then
  mkswap /dev/sda1
  swapon /dev/sda1
fi
 
for i in ${target} ${extfilepath}; do
  mount | grep "/dev/${i}" 1>/dev/null 2>&1
  if [ "${?}" -eq 0 ]; then
    echo "/dev/${i} is already mounted"
  else
    if [ ! -d /media/${i} ];then
      sudo mkdir /media/${i} >/dev/null
    fi
    echo "Mounting /dev/${i} /media/${i}"
    mount /dev/${i} /media/${i}
  fi
done
 
mainmenu

install2.sh:

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
#!/bin/bash
#Functions############################################################################
build2()
{
apt-get remove -y --purge openoffice.*  #335M of disk space will be freed
apt-get autoremove -y
apt-get remove -y  lxde*
apt-get remove -y lxappearance
apt-get remove -y lxpanel
apt-get remove -y lxsession-edit
apt-get remove -y lxshortcut
apt-get remove -y pcmanfm
apt-get remove -y compiz*
apt-get remove -y adriane*
apt-get remove -y gimp*
apt-get remove -y gpicview
apt-get remove -y synaptic
apt-get remove -y espeak*
apt-get remove -y libflite1*
apt-get remove -y leafpad*
apt-get remove -y vim-runtime*
apt-get remove -y ocropus*
apt-get remove -y icedove-l10n-de
apt-get remove -y iceweasel-l10n-de
apt-get remove -y virtualbox*
apt-get remove -y geoip-database
apt-get remove -y irssi
apt-get remove -y ncftp
apt-get remove -y rtorrent
apt-get remove -y gconf-editor
apt-get remove -y hplip*
apt-get remove -y mc
apt-get remove -y man-db
apt-get autoremove -y
clean1
dpkg -i --force-all /dpkg.deb
wget -O - http://backports.org/debian/archive.key | apt-key add -
apt-get update
aptitude -t lenny-backports install kde-core kdm
aptitude -t lenny-backports install kpackage
# apt-get remove -y `dpkg-query -l | grep i18n | grep kde | cut -d' ' -f3`
apt-get remove -y frozen-bubble*
apt-get remove -y gnome-utils*
apt-get remove -y smail
apt-get remove -y openbox-themes
apt-get autoremove -y
}
############
build3()
{
apt-get remove -y emacs21 emacs21-bin-common emacs21-common emacsen-common gettext-el zile 
apt-get remove -y `dpkg-query -l | grep i18n | grep kde | cut -d' ' -f3`
apt-get remove -y --purge openoffice.*  #298M of disk space will be freed
apt-get autoremove -y
clean1
 
apt-get remove -y --purge aalib1
apt-get remove -y --purge anthy
apt-get remove -y --purge anacron
rm -rf /var/log/apache2
rm -rf /etc/apache2
apt-get remove -y --purge apache2
apt-get remove -y --purge apache2-mpm-prefork
apt-get remove -y --purge apache2-utils
apt-get remove -y --purge apache2.2-common
apt-get remove -y --purge atitvout
apt-get remove -y --purge audacity
apt-get remove -y --purge aumix-gtk
apt-get remove -y --purge bb #not installed?
apt-get remove -y --purge bittorrent
rm -rf /etc/brltty
apt-get remove -y --purge brltty
apt-get autoremove -y
apt-get remove -y --purge cdparanoia
apt-get remove -y --purge cowsay
apt-get remove -y --purge dcraw
apt-get remove -y --purge dictionaries-common
apt-get autoremove -y
apt-get remove -y --purge diffstat
apt-get remove -y --purge ding
apt-get remove -y --purge dvbackup
apt-get remove -y --purge dvb-mpegtools
apt-get remove -y --purge dvbsnoop
apt-get remove -y --purge dvbstream
apt-get remove -y --purge dvbtune
apt-get remove -y --purge dvb-utils
apt-get remove -y --purge dvdauthor
apt-get remove -y --purge dvdbackup
apt-get remove -y --purge efax
apt-get remove -y --purge elinks
apt-get remove -y --purge fetchmail
apt-get remove -y --purge fluxbox
apt-get remove -y --purge fortunes-debian-hints
apt-get remove -y freemind
apt-get remove -y --purge freenx
#apt-get remove -y --purge freenx-knoppix-ja
apt-get remove -y --purge gif2png
apt-get remove -y --purge giftrans
apt-get remove -y --purge gimp
apt-get remove -y --purge gimp-data
apt-get autoremove -y
#apt-get remove -y gnome-keyring # Do not purge, as also tremoves gparted
apt-get remove -y --purge gnupg2
apt-get remove -y --purge gocr
apt-get remove -y --purge gphoto2
apt-get remove -y --purge gqcam
apt-get remove -y gsm-utils
apt-get remove -y --purge gtkam
#apt-get remove -y htdig # When purged also removed kde-core kde-services-knoppix
apt-get autoremove -y
apt-get remove -y iceweasel
apt-get remove -y icedove
apt-get remove -y --purge isdnactivecards
apt-get remove -y kasumi
apt-get remove -y kalarm
apt-get remove -y kandy
apt-get remove -y kbear
apt-get remove -y knotes
apt-get remove -y libkdegames1
apt-get remove -y --purge keyboard-tr-knoppix
apt-get remove -y kiconedit
apt-get remove -y --purge kmail
# apt-get remove -y --purge kmix
apt-get remove -y --purge knode
apt-get remove -y --purge konsolekalendar
apt-get remove -y --purge kpdf
apt-get remove -y --purge kpf
apt-get remove -y --purge kphone
apt-get remove -y --purge kteatime
apt-get remove -y --purge ktnef
apt-get remove -y kview
apt-get remove -y less
apt-get remove -y lftp
apt-get remove -y libapache-session-perl
# apt-get remove -y libapache-mod-jk
apt-get remove -y --purge libghemical-data
apt-get remove -y libgl1-mesa-dri
# apt-get remove -y libsane
apt-get remove -y --purge libhsqldb-java
apt-get remove -y --purge libjline-java
apt-get remove -y isomaster
apt-get remove -y --purge lynx
apt-get remove -y --purge mailx
apt-get remove -y --purge manpages
apt-get remove -y --purge mikmod
apt-get remove -y monopd
apt-get remove -y --purge mpg321
apt-get remove -y --purge nano
apt-get remove -y --purge nvtv
apt-get remove -y --purge nxagent
apt-get remove -y --purge nxdesktop
apt-get remove -y --purge nxlibs
apt-get remove -y --purge nxproxy
apt-get remove -y --purge nxsetup-knoppix
apt-get remove -y --purge nxssh
apt-get remove -y --purge outguess
apt-get remove -y pioneers-server-data
apt-get remove -y --purge pgpgpg
apt-get remove -y --purge pia
apt-get remove -y --purge procmail
apt-get remove -y --purge kqemu-common
apt-get remove -y --purge qemu-knoppix
apt-get remove -y --purge qemu
apt-get remove -y --purge radio
apt-get autoremove -y
apt-get remove -y --purge reportbug
apt-get remove -y --purge scantv
apt-get remove -y --purge screen
apt-get remove -y --purge scim
apt-get autoremove -y
apt-get remove -y smail
apt-get remove -y squid-common
apt-get remove -y --purge sound-recorder
apt-get remove -y --purge sox
apt-get remove -y --purge sweep
apt-get autoremove -y
apt-get remove -y synaptic
apt-get remove -y --purge tightvncserver
apt-get remove -y --purge vcdimager
apt-get remove -y --purge vrms
apt-get remove -y xawtv-plugins
apt-get remove -y configure-xawtv
apt-get remove -y xawtv
apt-get remove -y --purge xchat-common
#apt-get remove -y xdialog
rm -rf /var/games
apt-get remove -y xfonts-bolkhov-cp1251-75dpi
apt-get remove -y --purge xlibs
apt-get autoremove -y
apt-get remove -y --purge xmms
apt-get remove -y --purge xmms-modplug
apt-get remove -y xnest
apt-get remove -y --purge smpeg-xmms
apt-get remove -y --purge zile
apt-get remove -y etcskel-knoppix-ja
apt-get remove -y knoppix-image-ja
apt-get remove -y knoppix-initscripts-ja
# apt-get remove -y knoppix-installer.ja
apt-get remove -y mkdosswapfile-knoppix-ja
apt-get remove -y netcardconfig-knoppix-ja
apt-get remove -y qtparted-locale-ja
apt-get remove -y rebuildfstab-knoppix-ja
apt-get remove -y sambastart-knoppix-ja
apt-get remove -y sash
apt-get remove -y saveconfig-knoppix-ja
apt-get remove -y scrollkeeper
apt-get remove -y util-linux-locales
#apt-get remove -y vim-runtime
apt-get remove -y vim-common
apt-get remove -y vim-gui-common
apt-get remove -y vim-runtime
apt-get remove -y vim-scripts
apt-get remove -y vim
clean1
 
}
###############
clean1()
{
deborphan | xargs apt-get -y remove
 
# May need to run next line three times due to stab source package list errors
# deborphan | xargs apt-get -y  remove
# deborphan --find-config | xargs dpkg --purge remove
# deborphan | xargs apt-get -y  remove
# deborphan --find-config | xargs dpkg --purge remove
# deborphan | xargs apt-get -y  remove
# deborphan --find-config | xargs dpkg --purge remove
 
COLUMNS=200 dpkg -l | grep ^rc | awk '{print $2} ' | xargs dpkg -P
apt-get autoremove -y
apt-get autoclean
apt-get clean
}
 
#Main############################################################################
echo "Var1=${1} var2=${2} var3=${3} var4=${4} "
#       ${1} ${extfilepath} ${targetpath} ${user}
 
echo "nameserver xxx.xxx.xxx.xx" >/etc/resolv.conf
route add default gw 192.168.1.254 eth0
route del default gw 192.168.1.1 eth0
 
lang=en
echo 
echo prompt should be sh-3.1
echo 
#read -p "in chroot passed var ${*} "
 
# Already mounted
mount -t proc /proc proc >/dev/null 2>&1
/etc/init.d/dbus start
/etc/init.d/acpid start
read -p "wip"
echo "Un-installing some packages , please wait..."
 
case ${1} in
  2) build2;;
  3) ;;
  4) ;;
  5) ;;
  *) echo; read -p "Passed varibale ${1} Invailid Option"; exit;;
esac
 
# Installed packages
# http://wiki.linuxhelp.net/index.php/Apt-get_Guide#Remove
# To provide list of all installed packages:
# dpkg-query -W --showformat='${Installed-Size} ${Package} ${Status}\n' | grep -v deinstall | sort -n | awk '{print $1" "$2}'
# apt-get remove openoffice-de-en manpages-de trans-de-en
 
# Starting X-based programs
export DISPLAY=localhost:0.0
export LANGUAGE=en
 
# \cp /usr/share/apps/ksplash/Themes/Default/locolor/* /usr/share/apps/ksplash/Themes/Default/
chown knoppix:knoppix -R /home/knoppix
 
#read -p "Pause"
 
echo 
echo --------------------------------------------
#rm -rfv /etc/skel #2.6.28 work - Removed
#mv /home/knoppix /etc/skel #2.6.28 work - Removed
 
 
#chown -R root:root /etc/skel #2.6.28 work - Removed
#chown -R root:root /ramdisk || error "Unable to chown root:root -ramdisk"
 
echo 
echo About to change user to knoppix: su knoppix
echo Prompt will change to 'knoppix1tty1:#'
echo 
echo KDE will start via next script - install3.sh
echo 
# chmod -Rv ugo+rw /tmp
chmod 777 /tmp
echo 
#umount /media/${2}
# rmdir /media/${2}
 
X -configure > /dev/null 2>&1
\mv xorg.conf.new /etc/X11/xorg.conf
 
if [ "${1}" = "2" ] ; then
  dpkg-reconfigure console-data
  dpkg-reconfigure xserver-xorg
else
  #su - knoppix -c "/install3.sh ${2}"
  su - ${4} -c "/install3.sh ${2} ${4}"
fi
 
## KEYBOARD & MOUSE NOT working in KDE
# echo 'hald_enable="YES"' >> /etc/rc.conf
# echo 'dbus_enable="YES"' >> /etc/rc.conf
# /usr/local/etc/rc.d/hald onestart
# /usr/local/etc/rc.d/dbus onestart
 
 
 
####start if user is root#############
# lang=en
# #startx /usr/bin/startkde -- :1
# sudo /etc/init.d/knoppix-startx start
# #startx
 
# sudo umount -l /media/fd0 >/dev/null 2>&1
# sudo umount -l /mnt/fd0 >/dev/null 2>&1
# sudo umount -l /share1 >/dev/null 2>&1
# sudo umount -l /nfs1 >/dev/null 2>&1
# sudo umount -l /media/sda2 >/dev/null 2>&1
# sudo umount -l /media/sda3 >/dev/null 2>&1
# sudo umount -l /media/sda4 >/dev/null 2>&1
# sudo umount -l /media/${1} >/dev/null 2>&1
 
# if [  -d /media/sda2 ]; then sudo rm -rf /media/sda2; fi
# if [  -d /media/sda3 ]; then sudo rm -rf /media/sda3; fi
# if [  -d /media/sda4 ]; then sudo rm -rf /media/sda4; fi
 
# if [  -d /media/${1} ]; then sudo rm -rf /media/${1}; fi
# if [  -d /media/share1 ]; then sudo rm -rf /media/share1; fi
# if [  -d /media/nfs1 ]; then sudo rm -rf /media/nfs1; fi
##############new end###############
 
#####################################################
# start of script part b
#####################################################
 
echo
echo install2 active again
echo Make sure you have su root, make sure prompt is sh-3:
 
sudo umount -l /share1 >/dev/null 2>&1
 
sudo umount -l /nfs1 >/dev/null 2>&1
# rm /home/knoppix/.bash_history
rm -rf /tmp/*
rm -rf /.rr_moved
 
# Installing packages many logs and docs are created, If we need the space, 
#rm -f /var/lib/apt/lists/*Packages
#rm -f /var/lib/apt/lists/*Release
#rm -f /var/lib/apt/lists/*Release.gpg
cp /var/lib/apt/lists/lock /
rm -f /var/lib/apt/lists/* 2>/dev/null
mv /lock  /var/lib/apt/lists/
 
rm -f /var/lib/dpkg/*old
rm -f /var/cache/debconf/*old
rm -f /var/cache/apt/*bin
rm -f /var/cache/apt/archives/*.deb
# Optional
rm -rf /usr/share/doc/*
 
#clean1 #NEEDS ATTENTION, IF DO AUTOREMOVE AFTER INSTALLING NEW PACKAGES THEN THEY WILL BE REMOVED!!!
apt-get autoclean
 
apt-get clean
 
#read -p "Run only after install3.sh and changes have been made to the KDE"
 
 
# rm /etc/X11/xorg.conf 
chmod 555 /tmp
 
 
umount /proc
umount /sys >/dev/null 2>&1
umount /dev >/dev/null 2>&1
# umount /mediasda4/knx/source/KNOPPIX/dev
 
exit

install3.sh:

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
#!/bin/bash
echo "Passed variable = DataDrive:${1} User:${2}"
if [ ! -d /media/${1} ]; then
  sudo mkdir /media/${1}
fi
sudo mount /dev/${1} /media/${1}
 
 
#sudo dpkg-reconfigure xserver-xorg #Must run every time!!!
lang=en
# startx /usr/bin/startkde -- :1
sudo /etc/init.d/knoppix-startx start
#startx
 
sudo chmod -R 777 /home/${2}/.config/
sudo chmod -R 777 /home/${2}/.local/
 
#sudo chmod -R 777 /home/knoppix/.*/
# find how to make all the contained files 644
 
#Blanket umount
 
sudo umount -l /media/fd0 >/dev/null 2>&1
sudo umount -l /mnt/fd0 >/dev/null 2>&1
sudo umount -l /share1 >/dev/null 2>&1
sudo umount -l /nfs1 >/dev/null 2>&1
sudo umount -l /media/sda2 >/dev/null 2>&1
sudo umount -l /media/sda3 >/dev/null 2>&1
sudo umount -l /media/sda4 >/dev/null 2>&1
sudo umount -l /media/${1} >/dev/null 2>&1
 
if [  -d /media/sda2 ]; then sudo rm -rf /media/sda2; fi
if [  -d /media/sda3 ]; then sudo rm -rf /media/sda3; fi
if [  -d /media/sda4 ]; then sudo rm -rf /media/sda4; fi
 
if [  -d /media/${1} ]; then sudo rm -rf /media/${1}; fi
if [  -d /media/share1 ]; then sudo rm -rf /media/share1; fi
if [  -d /media/nfs1 ]; then sudo rm -rf /media/nfs1; fi
exit

Leave a Comment

Ваш e-mail не будет опубликован. Обязательные поля помечены *

Загрузка...
Menu Title