forked from slackport/gfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgfs
executable file
·737 lines (691 loc) · 14.1 KB
/
gfs
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
#!/bin/sh
# gfs (gnome from scratch) system build
#
# Copyright 2016-2021 Rafael Tavares <[email protected]>
# All rights reserved
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
GFSVERSION=0.2.9
GFSSOURCEDIR=./source
GFSCWD=$(pwd)
OUTPUT=/tmp
GFSEDITOR=nano
set -e
cd $GFSSOURCEDIR
PKGREQ=$(echo $2 | cut -f1 -d'/')
PKGREQ2=$(echo $1 | cut -f1 -d'/')
FINDREQ=${FINDREQ:-$(find $OUTPUT -maxdepth 1 -name $PKGREQ-[0-9]*.txz)}
LOGREQ=${LOGREQ:-$(find /var/lib/pkgtools/packages -maxdepth 1 -name $PKGREQ-[0-9]* | cut -f1 -d" ")}
gfstalk() {
if [ -z "$1" ]; then
echo -e " -| \033[1m$(basename $0)\033[0m:"
else
echo -e " -| \033[1m$(basename $0)\033[0m: $1"
fi
}
edit() {
if [ -z "$PKGREQ" ]; then
gfstalk "usage:"
gfstalk " $(basename $0) edit 'ProgramName'"
exit 1
else
if [ -f "$PKGREQ/$PKGREQ.SlackBuild" ]; then
cd "$PKGREQ"
$GFSEDITOR "$PKGREQ".SlackBuild
cd ..
else
gfstalk "'$PKGREQ' SlackBuild script not found!"
exit 1
fi
fi
}
build() {
if [ -z "$PKGREQ" ]; then
gfstalk "usage:"
gfstalk " $(basename $0) build 'ProgramName'"
exit 1
else
if [ -f "$PKGREQ/$PKGREQ.SlackBuild" ]; then
cd "$PKGREQ"
OUTPUT=$OUTPUT sh "$PKGREQ".SlackBuild || exit 1
cd ..
else
gfstalk "'$PKGREQ' SlackBuild script not found!"
exit 1
fi
fi
}
installpkg() {
if [ -z "$PKGREQ" ]; then
gfstalk "usage:"
gfstalk " $(basename $0) install 'ProgramName'"
exit 1
else
if [ -z "$FINDREQ" ]; then
gfstalk "$PKGREQ package not found!"
exit 1
else
upgradepkg --install-new --reinstall "$FINDREQ"
exit 0
fi
fi
}
prepare() {
if [ -z "$PKGREQ" ]; then
gfstalk "usage:"
gfstalk " $(basename $0) prepare 'ProgramName'"
exit 1
else
edit || exit 1
build || exit 1
unset FINDREQ
FINDREQ=${FINDREQ:-$(find $OUTPUT -maxdepth 1 -name $PKGREQ-[0-9]*.txz)}
installpkg || exit 1
fi
}
catlog() {
if [ -z "$PKGREQ" ]; then
gfstalk "usage:"
gfstalk " $(basename $0) prepare 'ProgramName'"
exit 1
else
if [ -z "$LOGREQ" ]; then
gfstalk "required log not found!"
exit 1
else
cat "$LOGREQ" | less
fi
fi
}
newtemplate() {
if [ -z "$PKGREQ" ]; then
gfstalk "usage:"
gfstalk " $(basename $0) new 'ProgramName'"
else
if [ -d "$PKGREQ" ]; then
gfstalk "this directory already exist!"
exit 1
else
mkdir -p "$PKGREQ" || exit 1
cp template.SlackBuild "$PKGREQ"/"$PKGREQ".SlackBuild || exit 1
edit || exit 1
build || exit 1
unset FINDREQ
FINDREQ=${FINDREQ:-$(find $OUTPUT -maxdepth 1 -name $PKGREQ-[0-9]*.txz)}
installpkg || exit 1
fi
fi
}
makegfspkg() {
cd $GFSCWD
mkdir -p pkg/opt/gfs
mv TODO gfs README.md source pkg/opt/gfs/
cd pkg
mkdir -p usr/sbin
ln -s /opt/gfs/gfs usr/sbin/gfs
mkdir -p install
# |-----handy-ruler------------------------------------------------------|
cat <<EOT >install/slack-desc
slackport-gfs:
slackport-gfs: GNOME From Scratch (gfs) System Builder
slackport-gfs:
slackport-gfs: This package contains SlackBuild scripts needed to build the GNOME
slackport-gfs: for Slackware. The gfs is an executable script responsible for build
slackport-gfs: and install the packages in pre-set order. In addition, gfs works as
slackport-gfs: a tool for editing, building and install pacakges in a more practical
slackport-gfs: and automated way.
slackport-gfs:
slackport-gfs: https://github.com/slackport/gfs
slackport-gfs:
EOT
makepkg -l y -c n $OUTPUT/slackport-gfs-$GFSVERSION-x86_64-1_gfs.txz
cd ..
rm -rf pkg/
}
gfsversion() {
gfstalk "$GFSVERSION"
}
gfshelp() {
cat <<EOT
GNOME From Scratch - version $GFSVERSION
gfs autopkg - Create a txz package with gfs directory
and /usr/sbin/gfs symlink.
gfs edit programname - Edit respective SlackBuild file.
gfs build programname - Run the programname SlackBuild file.
gfs cat programname - See the log of installed package.
gfs catlog programname - Same as above.
gfs help - Show this help mensage.
gfs install programname - Install the package on $OUTPUT directory.
gfs new programname - Will create a directory and copy
template.SlackBuid into it with 'programname'
specified. So will edit, build and install this
'programname' sequentially..
gfs prepare programname - Will execute 'edit' 'build' and 'install' sequentially.
gfs see programname - Same as 'cat' command.
gfs version - Show gfs version.
EOT
}
case "$1" in
"") continue ;;
autopkg|-a) makegfspkg && exit 1 ;;
edit|-e) edit && exit 1 ;;
build|-b) build && exit 1 ;;
cat|-c) catlog && exit 1 ;;
catlog|-c) catlog && exit 1 ;;
help|-h) gfshelp && exit 1 ;;
install|-i) installpkg && exit 1 ;;
new|-n) newtemplate && exit 1 ;;
prepare|-p) prepare && exit 1 ;;
see|-s) catlog && exit 1 ;;
version|-v) gfsversion && exit 1 ;;
*) PKGREQ=$PKGREQ2 && prepare && exit 1 ;;
esac
PKGBUILD=(
# Libraries and Desktop
libstemmer
exempi
libgxps
libiptcdata
libosinfo
libuchardet
totem-pl-parser
libgrss
libseccomp
gssdp
gupnp
gupnp-dlna
tracker2
tracker-miners2
tracker3
tracker-miners3
libgusb
#libgtop - slack have it
jam
argyllcms
valgrind
colord
colord-gtk
vulkan-sdk-bin
Vulkan-Headers
Vulkan-Tools
MarkupSafe
Jinja2
python-toml
typogrify
gi-docgen
rest
gst-plugins-bad
libdazzle
sysprof
libcloudproviders
#gtk+4
gtksourceview4
lua
lua53
luasocket
luajit
lcov
wheel
libpst
libquvi-scripts
libquvi
python3-soupsieve
BeautifulSoup4
python-webencodings
html5lib
sphinx
sphinxcontrib-applehelp
sphinxcontrib-devhelp
sphinxcontrib-htmlhelp
sphinxcontrib-jsmath
sphinxcontrib-qthelp
sphinxcontrib-serializinghtml
snowballstemmer
sphinx_rtd_theme
Sphinx
cssselect
lxml
geocode-glib
libmusicbrainz5
libwpe
wpebackend-fdo
bubblewrap
enchant2
gtkspell3
libdaemon
avahi
libdmapsharing3
geoclue2
xdg-dbus-proxy
webkit2gtk
yelp-xsl
yelp
yelp-tools
liboauth
grilo
cogl
clutter
clutter-gtk
clutter-gst
memphis
libchamplain
nspr
uhttpmock
setuptools-scm
python3-lazy-object-proxy
python3-wrapt
python3-astroid
python3-isort
py
python3-attrs
pluggy
more-itertools
atomicwrites
funcsigs
python2-scandir
pathlib2
python3-pytest
pytest-runner
python-mccabe
python3-pylint
libgweather
lgi
libpeas
blocaled
gtest
protobuf
libphonenumber
python3-dbusmock
telepathy-glib
libsocialweb
gsound
libhandy
libportal
zenity
appstream-glib
cups-pk-helper
smartypants
pycodestyle
pyflakes
ConfigParser
flake8
typed_ast
typing-extensions
mypy_extensions
mypy
highlight
mistune
python-m2r
Automat
hyperlink
incremental
constantly
zope.interface
python-twisted
dbus-test-runner
libaccounts-glib
telepathy-mission-control
#fop
plymouth
audit
freerdp
ytnef
# packagekit - maybe in a next release
libjte
libisofs
libisoburn
ostree
libglib-testing
# malcontent is(?) a optional dep for flatpak
# and flatpak is required to build malcontent (wtf?!)
# so my build system have a special `if` for it :)
flatpak
malcontent
flatpak-builder
libgit2
libgit2-glib
amtk
tepl
gspell
jsonrpc-glib
template-glib
devhelp
alabaster
imagesize
pytz
python3-babel
autopep8
uncrustify
libmediaart
gom
libcacard
spice-protocol
spice
phodav
usbredir
spice-gtk
perl-Text-CSV
gtk-vnc
jq
wxPython
p7zip
libmanette
retro-gtk
libwnck4
gcab
cantarell-fonts
libgnomekbd
mm-common # is a dev tool, I think we dont need it, but just in case...
liblouis
pyatspi
gupnp-av
gst-editing-services
gnome-online-accounts
libzapojit
gnome-autoar
gnome-desktop
gnome-bluetooth
gnome-color-manager
gnome-settings-daemon
gnome-video-effects
cheese
gnome-control-center
libgdata
evolution-data-server
mutter
gnome-shell
gnome-shell-extensions
gnome-session
gnome-backgrounds
gnome-user-docs
gnome-menus
xdg-desktop-portal
xdg-desktop-portal-gtk
grilo-plugins
folks
gfbgraph
nautilus
gdm
gnome-initial-setup
baobab
brasero
epiphany
evolution
gedit
gitg
eog
evince
file-roller
gnome-builder
gnome-calculator
gnome-calendar
gnome-disk-utility
gnome-games
gnome-weather
gnome-maps
gnome-music
gnome-nettool
gnome-screenshot
gnome-system-monitor
gnome-terminal
gnome-tweaks
gnote
totem
seahorse
simple-scan
sushi
vinagre
orca
# GNOME Boxes and Deps
liburcu
# cmocka - an unit test - dont install
glusterfs
augeas
netcf
libiscsi
numactl
openwsman
sanlock
yajl # I think is better compile its before acpica...
acpica
xen
apparmor
librdkafka
cunit
leveldb
snappy
xmlsec
oath-toolkit
babeltrace
erlang-otp
elixir
rabbitmq-server
rabbitmq-c
librdkafka
lttng-ust
cython
pyelftools
dpdk
ceph # I need to review the script to add users, rc, deamons, etc.
dog
# numad - maybe in a next release
libvirt
libvirt-glib
libovf-glib
gtk-frdp
gnome-boxes
# gst-validate is a dev tool
# hotdoc - maybe in a next release
rygel
gnome-characters
gnome-clocks
gnome-contacts
gnome-font-viewer
gnome-online-miners
gnome-photos
gnome-remote-desktop
gnome-tour
gnome-user-share
# GNOME Flashback
gnome-panel
gnome-applets
metacity
gnome-flashback
# chrome gnome-shell extension
chrome-gnome-shell
# GNOME Software and Deps - TESTING
#honggfuzz
#libxmlb
#libjcat
#libconfuse
#libftdi1
##genpeimg is a mingw opt dep
#umockdev
#codespell
#flashrom
#fwupd-efi
#fwupd
#gnome-software
)
message() {
gfstalk "I need to add $subject $name."
gfstalk "Is that allright with you ?"
gfstalk "yes / no"
read reply
case $reply in
"yes") gfstalk "Adding $subject $name" ;;
"no") gfstalk "Not adding $subject $name" && exit $? ;;
esac
}
# This function is a collaboration of Martin S.I. Tijsma <[email protected]>
# Thanks a lot!
checkusers() {
if
! grep -q "^avahi:" /etc/group
then
subject=group
name=Avahi
message
groupadd -g 214 avahi
fi
if
! grep -q "^avahi:" /etc/passwd
then
subject=user
name=Avahi
message
useradd -u 214 -g 214 -c "Avahi User" -d /dev/null -s /bin/false avahi
fi
if
! getent group colord 2>/dev/null 1>/dev/null
then
subject=group
name=colord
message
groupadd -g 303 colord
fi
if
! getent passwd colord 2>/dev/null 1>/dev/null
then
subject=user
name=colord
message
useradd -d /var/lib/colord -u 303 -g colord -s /bin/false colord
fi
if
! getent group sanlock 2>/dev/null 1>/dev/null
then
subject=group
name=sanlock
message
groupadd -g 363 sanlock
fi
if
! getent passwd sanlock 2>/dev/null 1>/dev/null
then
subject=user
name=sanlock
message
useradd -u 363 -d /var/run/sanlock -s /bin/false -g sanlock sanlock
fi
if
! getent group disk | grep -q sanlock
then
subject=user
name=sanlock
gfstalk "I need to add $subject $name on disk group."
gfstalk "Is that allright with you ?"
gfstalk "yes / no"
read reply
case $reply in
"yes") gfstalk "Adding $subject $name" && usermod -a -G disk sanlock ;;
"no") gfstalk "Not adding $subject $name" && exit $? ;;
esac
fi
if
! getent group rabbitmq 2>/dev/null 1>/dev/null
then
subject=group
name=rabbitmq
message
groupadd -g 319 rabbitmq
fi
if
! getent passwd rabbitmq 2>/dev/null 1>/dev/null
then
subject=user
name=rabbitmq
message
useradd -u 319 -g 319 -c "Rabbit MQ" -d /var/lib/rabbitmq -s /bin/sh rabbitmq
fi
}
checkusers
REBUILDFLATPAK=${REBUILDFLATPAK:-"no"}
for buildpkg in "${PKGBUILD[@]}"; do
if [ -z "$(ls /var/log/packages | grep ^$buildpkg-[0-9] | grep _gfs)" ]; then
gfstalk "Building $buildpkg..."
sleep 1
cd $buildpkg
OUTPUT=$OUTPUT sh $buildpkg.SlackBuild
gfstalk "$buildpkg builded! Installing..."
sleep 1
PKGINST=${BUILDPKG:-"$(ls $OUTPUT | grep ^$buildpkg-[0-9] | grep _gfs)"}
upgradepkg --install-new --reinstall $OUTPUT/$PKGINST
cd ..
elif [ "$buildpkg" == "flatpak" ]; then
if [ "$REBUILDFLATPAK" == "yes" ]; then
if [ -z "$(ls /var/log/packages | grep ^malcontent-[0-9] | grep _gfs)" ]; then
gfstalk "Building flatpak first time..."
sleep 1
cd flatpak
OUTPUT=$OUTPUT sh flatpak.SlackBuild
gfstalk "flatpak builded! Installing..."
sleep 1
PKGINST=${BUILDPKG:-"$(ls $OUTPUT | grep ^flatpak-[0-9] | grep _gfs)"}
upgradepkg --install-new --reinstall $OUTPUT/$PKGINST
rm $OUTPUT/$PKGINST
cd ../malcontent
gfstalk "Building malcontent..."
sleep 1
OUTPUT=$OUTPUT sh malcontent.SlackBuild
unset PKGINST
PKGINST=${BUILDPKG:-"$(ls $OUTPUT | grep ^malcontent-[0-9] | grep _gfs)"}
upgradepkg --install-new --reinstall $OUTPUT/$PKGINST
cd ../flatpak
gfstalk "Building flatpak again..."
sleep 1
OUTPUT=$OUTPUT sh flatpak.SlackBuild
gfstalk "flatpak builded again! Installing..."
sleep 1
unset PKGINST
PKGINST=${BUILDPKG:-"$(ls $OUTPUT | grep ^flatpak-[0-9] | grep _gfs)"}
upgradepkg --install-new --reinstall $OUTPUT/$PKGINST
cd ..
else
gfstalk "malcontent already installed... rebuilding flatpak"
sleep 1
cd flatpak
OUTPUT=$OUTPUT sh flatpak.SlackBuild
gfstalk "flatpak builded again! Installing..."
sleep 1
unset PKGINST
PKGINST=${BUILDPKG:-"$(ls $OUTPUT | grep ^flatpak-[0-9] | grep _gfs)"}
upgradepkg --install-new --reinstall $OUTPUT/$PKGINST
cd ..
fi
else
if [ -z "$(ls /var/log/packages | grep ^malcontent-[0-9] | grep _gfs)" ]; then
gfstalk "Building malcontent..."
sleep 1
cd malcontent
OUTPUT=$OUTPUT sh malcontent.SlackBuild
unset PKGINST
PKGINST=${BUILDPKG:-"$(ls $OUTPUT | grep ^malcontent-[0-9] | grep _gfs)"}
upgradepkg --install-new --reinstall $OUTPUT/$PKGINST
cd ..
else
gfstalk "malcontent already installed!"
fi
fi
else
gfstalk "$buildpkg is already installed!"
fi
done
gfstalk
gfstalk "All done!"
gfstalk "--------"