cookutils diff cooklinux @ rev 747
Update zh_CN.po (thanks Zhangwenyu)
author | Paul Issott <paul@slitaz.org> |
---|---|
date | Sat Jul 11 13:00:35 2015 +0100 (2015-07-11) |
parents | 14605a8b8489 |
children | 0b59118bbd03 |
line diff
1.1 --- a/cooklinux Thu Feb 13 20:25:58 2014 +0000 1.2 +++ b/cooklinux Sat Jul 11 13:00:35 2015 +0100 1.3 @@ -4,28 +4,31 @@ 1.4 # No patches, aufs and co, keep it simple. The goal is to let users build 1.5 # a custom and optimized kernel in a few commands 1.6 # 1.7 -# Copyright (C) 2014 SliTaz GNU/Linux - BSD License 1.8 +# Copyright (C) 2014-15 SliTaz GNU/Linux - BSD License 1.9 # 1.10 # Author: Christophe Lincoln <pankso@slitaz.org> 1.11 # 1.12 + 1.13 . /lib/libtaz.sh 1.14 . /etc/slitaz/slitaz.conf 1.15 1.16 version="$1" 1.17 -cookdir="/home/slitaz/src" 1.18 -srcurl="https://www.kernel.org/pub/linux/kernel" 1.19 +cookdir='/home/slitaz/src' 1.20 +srcurl='https://www.kernel.org/pub/linux/kernel' 1.21 1.22 check_root 1.23 1.24 + 1.25 # Help and usage 1.26 + 1.27 usage() { 1.28 - cat << EOT 1.29 + cat <<EOT 1.30 1.31 SliTaz Linux Kernel cooker 1.32 1.33 -$(boldify "Usage:") $(basename $0) [version] [--options] 1.34 +$(boldify 'Usage:') $(basename $0) [version] [--options] 1.35 1.36 -$(boldify "Options:") 1.37 +$(boldify 'Options:') 1.38 --clean Remove various generated files but keep the config 1.39 --mrproper Remove all generated files + config + backup files 1.40 --defconfig New config with default from ARCH supplied defconfig 1.41 @@ -38,45 +41,53 @@ 1.42 --bzImage Build the compressed kernel image 1.43 --modules Build all kernel modules 1.44 1.45 -$(boldify "Examples:") 1.46 +$(boldify 'Examples:') 1.47 $(basename $0) 3.8.3 --defconfig --menuconfig --bzImage 1.48 $(basename $0) 3.2.14 --tazconfig --bzImage --modules 1.49 1.50 EOT 1.51 } 1.52 1.53 + 1.54 # Check and install a packages 1.55 + 1.56 check_pkg() { 1.57 if [ ! -f "$PKGS_DB/installed/$1/receipt" ]; then 1.58 - echo -n "Installing package:" && colorize 34 " $1" 1.59 + echo -n "Installing package:"; colorize 34 " $1" 1.60 tazpkg -gi $1 2>/dev/null >/dev/null 1.61 fi 1.62 } 1.63 1.64 + 1.65 # 1.66 # Commands/help - Support 3.x 2.6 and 2.4 kernels. 1.67 # 1.68 + 1.69 case "$1" in 1.70 - 3.*) wgeturl="${srcurl}/v3.0/" ;; 1.71 + 3.*) wgeturl="${srcurl}/v3.0/" ;; 1.72 2.6.*) wgeturl="${srcurl}/v2.6/" ;; 1.73 2.4.*) wgeturl="${srcurl}/v2.4/" ;; 1.74 -h|-u|help|usage|"") 1.75 - usage && exit 0 ;; 1.76 + usage; exit 0 ;; 1.77 esac 1.78 1.79 + 1.80 # Sanity check 1.81 -[ ! "$wgeturl" ] && echo "Unable to set download url" && exit 0 1.82 +if [ -z "$wgeturl" ]; then 1.83 + echo 'Unable to set download url'; 1.84 + exit 0 1.85 +fi 1.86 + 1.87 1.88 # 1.89 # Build start 1.90 # 1.91 1.92 -echo -n "Building Linux kernel:" && colorize 32 " $version" 1.93 -echo -n "Source directory:" && colorize 30 " $cookdir" 1.94 +echo -n 'Building Linux kernel:'; colorize 32 " $version" 1.95 +echo -n 'Source directory:'; colorize 30 " $cookdir" 1.96 1.97 # Install needed packages to compile. 1.98 -for pkg in slitaz-toolchain perl xz lzma patch tar bc 1.99 -do 1.100 +for pkg in slitaz-toolchain perl xz lzma patch tar bc; do 1.101 check_pkg $pkg 1.102 done 1.103 1.104 @@ -88,98 +99,100 @@ 1.105 fi 1.106 if [ ! -d "linux-$version" ]; then 1.107 echo "Extracting: linux-$version.tar.xz" 1.108 - unxz -c linux-$version.tar.xz | tar xf - 1.109 + unxz -c linux-$version.tar.xz | tar -xf - 1.110 fi 1.111 1.112 # Clean-up and get or update config 1.113 cd linux-$version 1.114 1.115 -if [ "$clean" ]; then 1.116 +if [ -n "$clean" ]; then 1.117 make clean 1.118 rm -rf slitaz 1.119 fi 1.120 1.121 -if [ "$mrproper" ]; then 1.122 +if [ -n "$mrproper" ]; then 1.123 make mrproper 1.124 rm -rf slitaz 1.125 fi 1.126 1.127 # Get SliTaz current config. 1.128 -if [ "$tazconfig" ]; then 1.129 - echo "Using current SliTaz config: /proc/config.gz" 1.130 +if [ -n "$tazconfig" ]; then 1.131 + echo 'Using current SliTaz config: /proc/config.gz' 1.132 zcat /proc/config.gz > .config 1.133 yes '' | make oldconfig 1.134 fi 1.135 1.136 # Create a new default config. 1.137 -if [ "$defconfig" ]; then 1.138 +if [ -n "$defconfig" ]; then 1.139 make defconfig 1.140 fi 1.141 1.142 # Update config and wipe out unloaded modules. 1.143 -if [ "$localmod" ]; then 1.144 +if [ -n "$localmod" ]; then 1.145 make localmodconfig 1.146 fi 1.147 1.148 + 1.149 # 1.150 # Configurators text/ncurses/Qt/GTK 1.151 # 1.152 1.153 -if [ "$config" ]; then 1.154 - echo "Starting Text mode configuration tool..." 1.155 +if [ -n "$config" ]; then 1.156 + echo 'Starting Text mode configuration tool...' 1.157 make config 1.158 fi 1.159 1.160 -if [ "$menuconfig" ]; then 1.161 - echo "Starting Ncurses configuration tool..." 1.162 +if [ -n "$menuconfig" ]; then 1.163 + echo 'Starting Ncurses configuration tool...' 1.164 check_pkg ncurses-dev 1.165 make menuconfig 1.166 fi 1.167 1.168 -if [ "$xconfig" ]; then 1.169 - echo "Starting QT configuration tool..." 1.170 +if [ -n "$xconfig" ]; then 1.171 + echo 'Starting Qt configuration tool...' 1.172 check_pkg qt-4 1.173 make xconfig 1.174 fi 1.175 1.176 -if [ "$gconfig" ]; then 1.177 - echo "Starting GTK+ configuration tool..." 1.178 +if [ -n "$gconfig" ]; then 1.179 + echo 'Starting GTK+ configuration tool...' 1.180 check_pkg gtk+-dev 1.181 check_pkg libglade-dev 1.182 make gconfig 1.183 fi 1.184 1.185 -if [ "$bzImage" ]; then 1.186 - echo "Building bzImage..." 1.187 +if [ -n "$bzImage" ]; then 1.188 + echo 'Building bzImage...' 1.189 make bzImage || exit 1 1.190 mkdir -p slitaz/linux-custom-$version/fs/boot 1.191 cp -f arch/x86/boot/bzImage \ 1.192 slitaz/linux-custom-$version/fs/boot/vmlinuz-$version 1.193 fi 1.194 - 1.195 -if [ "$modules" ]; then 1.196 - echo "Building modules..." 1.197 + 1.198 +if [ -n "$modules" ]; then 1.199 + echo 'Building modules...' 1.200 make modules || exit 1 1.201 make INSTALL_MOD_PATH=slitaz/linux-custom-$version/fs modules_install 1.202 rm -f slitaz/linux-custom-$version/fs/lib/modules/$version/build 1.203 rm -f slitaz/linux-custom-$version/fs/lib/modules/$version/source 1.204 fi 1.205 1.206 + 1.207 # 1.208 # Packaging 1.209 # 1.210 1.211 if [ -d "slitaz/linux-custom-$version/fs" ]; then 1.212 - echo "Packing Linux..." 1.213 + echo 'Packing Linux...' 1.214 cd slitaz 1.215 else 1.216 - echo -n "Packing Linux:" && colorize 31 " not yet built" 1.217 + echo -n 'Packing Linux:'; colorize 31 ' not yet built' 1.218 exit 0 1.219 fi 1.220 1.221 # Receipt. 1.222 -echo "Creating the receipt..." 1.223 -cat > linux-custom-$version/receipt << EOF 1.224 +echo 'Creating the receipt...' 1.225 +cat > linux-custom-$version/receipt <<EOF 1.226 # SliTaz package receipt. 1.227 1.228 PACKAGE="linux-custom" 1.229 @@ -225,7 +238,7 @@ 1.230 tazpkg pack linux-custom-$version 1.231 1.232 # Install the new kernel. 1.233 -if [ "$install" ]; then 1.234 +if [ -n "$install" ]; then 1.235 cd $cookdir/linux-$version/slitaz 1.236 tazpkg -i linux-custom-$version.tazpkg --forced 1.237 fi