slitaz-dev-tools view slitaz-release/slitaz-release @ rev 295

Fix to slitaz-release and improve tazcraft (work in progress, to be continued in it's own repo)
author Christophe Lincoln <pankso@slitaz.org>
date Sun Mar 19 17:36:55 2017 +0100 (2017-03-19)
parents f369836fad7e
children af10ffa04919
line source
1 #!/bin/sh
2 #
3 # slitaz-release - SliTaz stable and cooking release helper. The script
4 # will check hostname to handle host specific release tasks (tank, pangolin,
5 # mirror, local)
6 #
7 # Copyright (C) 2017 SliTaz GNU/Linux - BSD License
8 #
9 #. /lib/libtaz.sh # Is not installed on pangolin & mirror (slitaz 4.0)
11 version="$1"
13 if [ "$2" ]; then
14 local_repos="$2"
15 else
16 local_repos="$HOME/Projects"
17 fi
19 help() {
20 cat << EOT
22 $(colorize 032 "Usage:") slitaz-release [version] [repos_path]
24 $(colorize 033 "Local repos :") $local_repos
25 $(colorize 033 "Documentation :") http://www.slitaz.org/en/devel/release.php
27 EOT
28 }
30 # Colorize message
31 colorize() {
32 : ${color=$1}
33 shift
34 case "$color" in
35 0*) echo -e "\\033[${color:-38}m$@\\033[39m" ;;
36 *) echo -e "\\033[1;${color:-38}m$@\\033[0;39m" ;;
37 esac; unset color
38 }
40 title() {
41 echo ""; colorize 033 "$@"
42 }
44 check_string() {
45 if [ "$slitaz_release" != "$version" ]; then
46 colorize 031 "Wrong string: $slitaz_release"
47 echo " * $1"
48 else
49 colorize 031 "SliTaz release: $version"
50 fi
51 }
53 #
54 # Handle commands
55 #
56 case "$1" in
58 info)
59 echo -n "Hostname:"; hostname ;;
61 "") help; exit 0 ;;
62 esac
64 #
65 # Handle host specific tasks
66 #
67 case "$(hostname)" in
69 tank)
70 # Build host with chroots and built ISOs
71 slitaz="/home/slitaz"
72 ;;
74 mirror)
75 # Host packages and official ISOs
76 packages=""
77 ;;
79 pangolin)
80 # Host all Hg repositories
81 repos="/home/slitaz/repos"
83 # Stable wok
84 title "Checking repo: wok-stable"
85 cd $repos/wok-stable; hg up
86 slitaz_release=$(hg parents --template '{latesttag}')
87 check_string "stable wok is not yet tagged to $version"
89 # Cooking wok
90 title "Checking repo: wok"
91 cd $repos/wok; hg up
92 slitaz_release=$(hg parents --template '{latesttag}')
93 check_string "cooking wok is not yet ready to be copied"
95 newline ;;
97 *)
98 # Local Hg repos: set stable string and Hg tags
99 for repo in slitaz-base-files slitaz-doc wok; do
100 if [ ! -d "$local_repos/$repo" ]; then
101 colorize 031 "Missing repos: $local_repos/$repo"; exit 1
102 fi
103 done
105 # /etc/slitaz-release
106 title "Checking file: /etc/slitaz-release"
107 base_files="$local_repos/slitaz-base-files/rootfs"
108 slitaz_release=$(cat $base_files/etc/slitaz-release)
109 check_string "slitaz-base-files must be modified and wok updated"
111 # isolinux.cfg
112 title "Checking file: isolinux.cfg"
113 isolinux_cfg="$local_repos/wok/syslinux/stuff/isolinux.cfg"
114 slitaz_release=$(grep "MENU TITLE" $isolinux_cfg | cut -d " " -f 6)
115 check_string "syslinux package must be modified and wok updated"
117 # slitaz-doc
118 title "Checking repo: slitaz-doc"
119 cd $local_repos/slitaz-doc
120 slitaz_release=$(hg parents --template '{latesttag}')
121 check_string "slitaz-doc should provide relnotes and be tagged"
123 # wok: the current cooking wok will be copied to wok-stable on
124 # Hg server and then it will continue its own life with security updates.
125 # Tagging the wok lets us have the initial state of the new release.
126 title "Checking repo: wok"
127 cd $local_repos/wok
128 slitaz_release=$(hg parents --template '{latesttag}')
129 check_string "the wok should be tagged to $version"
131 echo "" ;;
132 esac
134 exit 0