1#!/bin/sh 2 3PROG=$0 4 5pkgcfg=/etc/sysconfig/zfs 6 7while getopts "n:v:c:f:" opt; do 8 case $opt in 9 n) pkgname=$OPTARG ;; 10 v) pkgver=$OPTARG ;; 11 c) pkgcfg=$OPTARG ;; 12 f) filename=$OPTARG ;; 13 *) err=1 ;; 14 esac 15done 16 17if [ -z "${pkgname}" ] || [ -z "${pkgver}" ] || [ -z "${filename}" ] || 18 [ -n "${err}" ]; then 19 echo "Usage: $PROG -n <pkgname> -v <pkgver> -c <pkgcfg> -f <filename>" 20 exit 1 21fi 22 23exec cat >"${filename}" <<EOF 24PACKAGE_NAME="${pkgname}" 25PACKAGE_VERSION="${pkgver}" 26PACKAGE_CONFIG="${pkgcfg}" 27NO_WEAK_MODULES="yes" 28PRE_BUILD="configure 29 --prefix=/usr 30 --with-config=kernel 31 --with-linux=\$( 32 case \`lsb_release -is\` in 33 (Debian|Devuan) 34 if [[ -e \${kernel_source_dir/%build/source} ]] 35 then 36 echo \${kernel_source_dir/%build/source} 37 else 38 # A kpkg exception for Proxmox 2.0 39 echo \${kernel_source_dir} 40 fi 41 ;; 42 (*) 43 echo \${kernel_source_dir} 44 ;; 45 esac 46 ) 47 --with-linux-obj=\${kernel_source_dir} 48 \$( 49 [[ -n \"\${ICP_ROOT}\" ]] && \\ 50 { 51 echo --with-qat=\"\${ICP_ROOT}\" 52 } 53 ) 54 \$( 55 [[ -r \${PACKAGE_CONFIG} ]] \\ 56 && source \${PACKAGE_CONFIG} \\ 57 && shopt -q -s extglob \\ 58 && \\ 59 { 60 if [[ \${ZFS_DKMS_ENABLE_DEBUG,,} == @(y|yes) ]] 61 then 62 echo --enable-debug 63 fi 64 if [[ \${ZFS_DKMS_ENABLE_DEBUGINFO,,} == @(y|yes) ]] 65 then 66 echo --enable-debuginfo 67 fi 68 } 69 ) 70" 71POST_BUILD="scripts/dkms.postbuild 72 -n \${PACKAGE_NAME} 73 -v \${PACKAGE_VERSION} 74 -a \${arch} 75 -k \${kernelver} 76 -t \${dkms_tree} 77" 78AUTOINSTALL="yes" 79REMAKE_INITRD="no" 80MAKE[0]="make" 81STRIP[0]="\$( 82 [[ -r \${PACKAGE_CONFIG} ]] \\ 83 && source \${PACKAGE_CONFIG} \\ 84 && shopt -q -s extglob \\ 85 && [[ \${ZFS_DKMS_DISABLE_STRIP,,} == @(y|yes) ]] \\ 86 && echo -n no 87)" 88STRIP[1]="\${STRIP[0]}" 89STRIP[2]="\${STRIP[0]}" 90STRIP[3]="\${STRIP[0]}" 91STRIP[4]="\${STRIP[0]}" 92STRIP[5]="\${STRIP[0]}" 93STRIP[6]="\${STRIP[0]}" 94STRIP[7]="\${STRIP[0]}" 95STRIP[8]="\${STRIP[0]}" 96BUILT_MODULE_NAME[0]="zavl" 97BUILT_MODULE_LOCATION[0]="module/avl/" 98DEST_MODULE_LOCATION[0]="/extra/avl/avl" 99BUILT_MODULE_NAME[1]="znvpair" 100BUILT_MODULE_LOCATION[1]="module/nvpair/" 101DEST_MODULE_LOCATION[1]="/extra/nvpair/znvpair" 102BUILT_MODULE_NAME[2]="zunicode" 103BUILT_MODULE_LOCATION[2]="module/unicode/" 104DEST_MODULE_LOCATION[2]="/extra/unicode/zunicode" 105BUILT_MODULE_NAME[3]="zcommon" 106BUILT_MODULE_LOCATION[3]="module/zcommon/" 107DEST_MODULE_LOCATION[3]="/extra/zcommon/zcommon" 108BUILT_MODULE_NAME[4]="zfs" 109BUILT_MODULE_LOCATION[4]="module/zfs/" 110DEST_MODULE_LOCATION[4]="/extra/zfs/zfs" 111BUILT_MODULE_NAME[5]="icp" 112BUILT_MODULE_LOCATION[5]="module/icp/" 113DEST_MODULE_LOCATION[5]="/extra/icp/icp" 114BUILT_MODULE_NAME[6]="zlua" 115BUILT_MODULE_LOCATION[6]="module/lua/" 116DEST_MODULE_LOCATION[6]="/extra/lua/zlua" 117BUILT_MODULE_NAME[7]="spl" 118BUILT_MODULE_LOCATION[7]="module/spl/" 119DEST_MODULE_LOCATION[7]="/extra/spl/spl" 120BUILT_MODULE_NAME[8]="zzstd" 121BUILT_MODULE_LOCATION[8]="module/zstd/" 122DEST_MODULE_LOCATION[8]="/extra/zstd/zzstd" 123EOF 124