@@ -20,11 +20,7 @@ ORG_NAME=teambox.co
20
20
KEY_ID=99999999
21
21
22
22
# GIT repository configuration
23
- GIT_TBXSOSD=https://github.com/fdgonthier/tbxsosd.git
24
- GIT_KAS=https://github.com/fdgonthier/kas.git
25
- GIT_TEAMBOX_CORE=https://github.com/fdgonthier/teambox-core.git
26
- GIT_KMOD=https://github.com/fdgonthier/kmod.git
27
- GIT_TAG=R1
23
+ GIT_DEFAULT_TAG=R2
28
24
29
25
# #
30
26
# #
@@ -450,14 +446,28 @@ debian_install_packages() {
450
446
#
451
447
452
448
core_build () {
449
+ local GIT_TEAMBOX_CORE
450
+
451
+ if [ $opt_fdg = 1 ]; then
452
+ GIT_TEAMBOX_CORE=https://github.com/fdgonthier/teambox-core.git
453
+ else
454
+ GIT_TEAMBOX_CORE=https://github.com/tmbx/teambox-core.git
455
+ fi
456
+
453
457
if [ ! -d $BUILD_DIR /teambox-core/.git ]; then
454
458
(cd $BUILD_DIR && git clone $GIT_TEAMBOX_CORE )
455
459
[ $? -eq 0 ] || return 1
456
- # cd $BUILD_DIR/teambox-core && git checkout $GIT_TAG
457
- # [ $? -eq 0 ] || return 1
460
+ if [ $opt_usehead = 0 ]; then
461
+ git --git-dir=$BUILD_DIR /teambox-core checkout $opt_gittag
462
+ [ $? -eq 0 ] || return 1
463
+ fi
458
464
else
459
- (cd $BUILD_DIR /teambox-core && git pull)
460
- [ $? -eq 0 ] || return 1
465
+ if [ $opt_usehead = 1 ]; then
466
+ git --git-dir=$BUILD_DIR /teambox-core checkout master
467
+ [ $? -eq 0 ] || return 1
468
+ git --git-dir=$BUILD_DIR /teambox-core pull
469
+ [ $? -eq 0 ] || return 1
470
+ fi
461
471
fi
462
472
(cd $BUILD_DIR /teambox-core &&
463
473
scons --quiet --config=force \
@@ -482,18 +492,32 @@ core_install() {
482
492
}
483
493
484
494
tbxsosd_build () {
495
+ local GIT_TBXSOSD
496
+
485
497
mkdir -p $TEAMBOX_HOME /etc/tbxsosd
486
498
[ $? -eq 0 ] || return 1
487
499
500
+ if [ $opt_fdg = 1 ]; then
501
+ GIT_TBXSOSD=https://github.com/fdgonthier/tbxsosd.git
502
+ else
503
+ GIT_TBXSOSD=https://github.com/tmbx/tbxsosd.git
504
+ fi
505
+
488
506
# Programs
489
507
if [ ! -d $BUILD_DIR /tbxsosd/.git ]; then
490
508
(cd $BUILD_DIR && git clone $GIT_TBXSOSD )
491
509
[ $? -eq 0 ] || return 1
492
- # cd $BUILD_DIR/tbxsosd && git tag $GIT_TAG
493
- # [ $? -eq 0 ] || return 1
510
+ if [ $opt_usehead = 0 ]; then
511
+ git --git-dir=$BUILD_DIR /tbxsosd tag tags/$opt_gittag
512
+ [ $? -eq 0 ] || return 1
513
+ fi
494
514
else
495
- (cd $BUILD_DIR /tbxsosd && git pull)
496
- [ $? -eq 0 ] || return 1
515
+ if [ $opt_usehead = 1 ]; then
516
+ git --git-dir=$BUILD_DIR /tbxsosd checkout master
517
+ [ $? -eq 0 ] || return 1
518
+ git --git-dir=$BUILD_DIR /tbxsosd pull
519
+ [ $? -eq 0 ] || return 1
520
+ fi
497
521
fi
498
522
(cd $BUILD_DIR /tbxsosd &&
499
523
scons PREFIX=$TEAMBOX_HOME --config=force \
@@ -544,14 +568,29 @@ tbxsosd_install() {
544
568
}
545
569
546
570
kmod_build () {
571
+ local GIT_KMOD
572
+
573
+ if [ $opt_fdg = 1 ]; then
574
+ GIT_KMOD=https://github.com/fdgonthier/kmod.git
575
+ else
576
+ GIT_KMOD=https://github.com/tmbx/kmod.git
577
+ fi
578
+
547
579
# Programs
548
580
if [ ! -d $BUILD_DIR /kmod/.git ]; then
549
581
(cd $BUILD_DIR && git clone $GIT_KMOD )
550
582
[ $? -eq 0 ] || return 1
551
- # cd $BUILD_DIR/kmod && git checkout $GIT_TAG
552
- # [ $? -eq 0 ] || return 1
583
+ if [ $opt_usehead = 0 ]; then
584
+ git --git-dir=$BUILD_DIR /kmod checkout tags/$opt_gittag
585
+ [ $? -eq 0 ] || return 1
586
+ fi
553
587
else
554
- (cd $BUILD_DIR /kmod && git pull)
588
+ if [ $opt_usehead = 1 ]; then
589
+ git --git-dir=$BUILD_DIR /kmod checkout master
590
+ [ $? -eq 0 ] || return 1
591
+ git --git-dir=$BUILD_DIR /kmod pull
592
+ [ $? -eq 0 ] || return 1
593
+ fi
555
594
fi
556
595
(cd $BUILD_DIR /kmod && scons --quiet config DESTDIR=$TEAMBOX_HOME )
557
596
[ $? -eq 0 ] || return 1
@@ -571,15 +610,29 @@ kmod_install() {
571
610
}
572
611
573
612
kas_build () {
613
+ local GIT_KAS
614
+
615
+ if [ $opt_fdg = 1 ]; then
616
+ GIT_KAS=https://github.com/fdgonthier/kas.git
617
+ else
618
+ GIT_KAS=https://github.com/tmbx/kas.git
619
+ fi
620
+
574
621
# Programs
575
622
if [ ! -d $BUILD_DIR /kas/.git ]; then
576
623
(cd $BUILD_DIR && git clone $GIT_KAS )
577
624
[ $? -eq 0 ] || return 1
578
- # cd $BUILD_DIR/kas && git checkout $GIT_TAG
579
- # [ $? -eq 0 ] || return 1
625
+ if [ $opt_usehead = 0 ]; then
626
+ git --git-dir=$BUILD_DIR /kas checkout tags/$opt_gittag
627
+ [ $? -eq 0 ] || return 1
628
+ fi
580
629
else
581
- (cd $BUILD_DIR /kas && git pull)
582
- [ $? -eq 0 ] || return 1
630
+ if [ $opt_usehead = 1 ]; then
631
+ git --git-dir=$BUILD_DIR /kas checkout master
632
+ [ $? -eq 0 ] || return 1
633
+ git --git-dir=$BUILD_DIR /kas pull
634
+ [ $? -eq 0 ] || return 1
635
+ fi
583
636
fi
584
637
(cd $BUILD_DIR /kas && scons --quiet config \
585
638
libktools_include=$TEAMBOX_HOME /include \
@@ -663,40 +716,61 @@ if [ $(id -u) != 0 ]; then
663
716
exit 1
664
717
fi
665
718
666
- vmmode=0
667
- vmfirst=0
668
- gittag=R1
669
- usehead=0
719
+ opt_vmmode=0
720
+ opt_vmfirst=0
721
+ opt_gittag=$GIT_DEFAULT_TAG
722
+ opt_usehead=0
723
+ opt_keep=0
724
+ opt_fdg=0
670
725
671
726
firstboot=' .*teambox-firstboot'
672
727
if [[ $0 =~ $firstboot ]]; then
673
- vmfirst =1
728
+ opt_vmfirst =1
674
729
fi
675
730
676
- ARGS=$( getopt -o vht:h -l " vm,git-tag:,use-head,help" -- " $@ " ) ;
731
+ ARGS=$( getopt -o vht:hkf -l " vm,git-tag:,use-head,help,keep,fdg" -- " $@ " ) ;
732
+ [ $? = 0 ] || exit 0
677
733
eval set -- " $ARGS " ;
678
734
679
735
while true ; do
680
736
case " $1 " in
681
737
-v|--vm)
682
738
shift
683
- vmmode =1
739
+ opt_vmmode =1
684
740
;;
685
741
-h|--use-head)
686
742
shift
687
- usehead =0
743
+ opt_usehead =0
688
744
;;
689
745
-t|--git-tag)
690
746
shift
691
- gittag=$1
747
+ if [ -n " $1 " ]; then
748
+ opt_gittag=$1
749
+ shift
750
+ else
751
+ echo " Missing argument to --git-tag."
752
+ exit 1
753
+ fi
754
+ ;;
755
+ -k|--keep)
756
+ shift
757
+ opt_keep=1
758
+ ;;
759
+ -f|--fdg)
760
+ shift
761
+ opt_fdg=1;
692
762
;;
693
763
-h|--help)
694
764
shift
695
765
echo " Teambox Installer script"
696
766
echo " Copyright Opersys Inc. 2013"
697
767
echo " "
698
- echo " --vm VM mode install VM generating hooks"
699
- echo " Depends on the presence of Turnkey Initthooks"
768
+ echo " --vm (-v) VM mode install VM generating hooks "
769
+ echo " --keep (-k) Keep the build directory $BUILD_DIR after "
770
+ echo " installation "
771
+ echo " --fdg (-f) Fetch from http://github.com/fdgonthier repositories "
772
+ echo " instead of the ordinary Teambox repositories. "
773
+ echo " --git-tag (-t) [tag] Fetch this release tag instead of the default one. "
700
774
exit 0
701
775
;;
702
776
--)
@@ -711,7 +785,7 @@ allSteps="build install"
711
785
712
786
# exec 2>&1 > teambox-installer.log
713
787
714
- if [ $vmfirst = 0 ]; then
788
+ if [ $opt_vmfirst = 0 ]; then
715
789
detect_distribution dist
716
790
717
791
if [ " $dist " != " debian" -a " $dist " != " ubuntu" -a " $dist " != " centos" ]; then
@@ -738,7 +812,7 @@ generate_ssl $TEAMBOX_HOME/etc/tbxsosd/ssl \
738
812
generate_ssl $TEAMBOX_HOME /etc/kcd/ssl \
739
813
kcd.req kcd.key kcd.crt kcd.cnf
740
814
741
- if [ $vmfirst = 0 ]; then
815
+ if [ $opt_vmfirst = 0 ]; then
742
816
echo " *** Installing Python virtual environment packages (don't hold your breath)" >&2
743
817
generate_python_virtual_env
744
818
if [ $? -eq 1 ]; then
764
838
765
839
# Don't execute this if we are producing a VM. It will be executed at
766
840
# first boot. In non VM mode, always execute.
767
- if [ $vmmode = 0 -o $vmfirst = 1 ]; then
841
+ if [ $opt_vmmode = 0 -o $opt_vmfirst = 1 ]; then
768
842
password_fix_all
769
843
configure_teambox
770
844
fix_hostnames
771
845
fi
772
846
773
847
# Never executed except at first boot.
774
- if [ $vmfirst = 1 ]; then
848
+ if [ $opt_vmfirst = 1 ]; then
775
849
# Reconfigure the SSH keys.
776
850
rm /etc/ssh/ssh_host_dsa_key*
777
851
rm /etc/ssh/ssh_host_rsa_key*
@@ -788,7 +862,7 @@ if [ $vmfirst = 1 ]; then
788
862
fi
789
863
790
864
# Install the hook for initthooks
791
- if [ $vmmode = 1 ]; then
865
+ if [ $opt_vmmode = 1 ]; then
792
866
echo $PWD
793
867
cp $0 /etc/init.d/teambox-firstboot
794
868
if [ ! -z " $( which update-rc.d 2> /dev/null) " ]; then
@@ -799,11 +873,16 @@ if [ $vmmode = 1 ]; then
799
873
fi
800
874
801
875
# Restart the services.
802
- if [ $vmmode = 0 -a $vmfirst = 0 ]; then
876
+ if [ $opt_vmmode = 0 -a $opt_vmfirst = 0 ]; then
803
877
run_service tbxsosd
804
878
run_service kcd
805
879
run_service kcdnotif
806
880
run_service kwsfetcher
807
881
808
882
echo " Please start or restart Apache immediately." >&2
809
883
fi
884
+
885
+ # Erase the build directory if required.
886
+ if [ $opt_keep = 0 ]; then
887
+ rm -r $BUILD_DIR
888
+ fi
0 commit comments