Add package build script

This commit is contained in:
Nick Peng
2019-12-14 15:46:18 +08:00
parent 8433729186
commit cc93156ee3
8 changed files with 481 additions and 185 deletions

View File

@@ -680,6 +680,10 @@ https://github.com/pymumu/smartdns/releases
bind [::]:6053 -no-speed-check -group office -no-rule-addr
```
## 编译
smartdns包含了编译软件包的脚本支持编译lucidebianopenwrtoptare安装包可执行`package/build-pkg.sh`编译。
## Donate
如果你觉得此项目对你有帮助,请捐助我们,以使项目能持续发展,更加完善。

View File

@@ -677,6 +677,10 @@ Note: Merlin firmware is derived from ASUS firmware and can theoretically be use
bind [::]:6053 -no-speed-check -group office -no-rule-addr
```
## Compile
smartdns contains scripts for compiling packages, supports compiling luci, debian, openwrt, opare installation packages, and can execute `package/build-pkg.sh` compilation.
## [Donate](#Donate)
If you feel that this project is helpful to you, please donate to us so that the project can continue to develop and be more perfect.

180
package/build-pkg.sh Normal file
View File

@@ -0,0 +1,180 @@
#!/bin/sh
# Copyright (C) 2018-2019 Nick Peng (pymumu@gmail.com)
CURR_DIR=$(cd $(dirname $0);pwd)
VER="`date +"1.%Y.%m.%d-%H%M"`"
CODE_DIR="$CURR_DIR/.."
IS_BUILD_SMARTDNS=1
OUTPUTDIR=$CURR_DIR
export CC
export STRIP
showhelp()
{
echo "Usage: $0 [OPTION]"
echo "Options:"
echo " --platform [luci|debian|openwrt|optware|linux] build for platform. "
echo " --arch [all|armhf|arm64|x86_64|...] build for architecture, e.g. "
echo " --cross-tool [cross-tool] cross compiler, e.g. mips-openwrt-linux-"
echo ""
echo "Advance Options:"
echo " --static static link smartdns"
echo " --only-package only package, not build source"
echo " --filearch [arch] output file arch, default: equal --arch"
echo " --outputdir [dir] output package to specific directory"
echo " "
echo "Example:"
echo " build luci:"
echo " $0 --platform luci"
echo " build debian:"
echo " $0 --platform debian --arch x86_64"
echo " build raspbian pi:"
echo " $0 --platform debian --arch armhf"
echo " build optware mips:"
echo " $0 --platform optware --arch mipsbig"
echo " build openwrt mips:"
echo " $0 --platform openwrt --arch mips_24kc"
echo " build generic linux:"
echo " $0 --platform linux --arch x86_64"
}
build_smartdns()
{
if [ "$PLATFORM" != "luci" ]; then
make -C $CODE_DIR/src clean
make -C $CODE_DIR/src all -j8 VER=$VER $MAKE_ARGS
if [ $? -ne 0 ]; then
echo "make smartdns failed"
exit 1
fi
fi
$STRIP -d $CODE_DIR/src/smartdns >/dev/null 2>&1
return 0
}
build()
{
echo "build package for $PLATFORM"
if [ $IS_BUILD_SMARTDNS -eq 1 ]; then
build_smartdns
if [ $? -ne 0 ]; then
return 1
fi
fi
chmod +x $CODE_DIR/package/$PLATFORM/make.sh
$CODE_DIR/package/$PLATFORM/make.sh -o $CURR_DIR --arch $ARCH --ver $VER --filearch $FILEARCH -o $OUTPUTDIR
if [ $? -ne 0 ]; then
echo "build package for $PLATFORM failed"
return 1
fi
echo "build package for $PLATFORM success."
return 0
}
main()
{
OPTS=`getopt -o o:h --long arch:,filearch:,ver:,platform:,cross-tool:,static,only-package,outputdir: \
-n "" -- "$@"`
if [ "$#" -le "1" ]; then
showhelp
exit 1
fi
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$OPTS"
while true; do
case "$1" in
--arch)
ARCH="$2"
shift 2;;
--filearch)
FILEARCH="$2"
shift 2;;
--platform)
PLATFORM="$2"
shift 2;;
--cross-tool)
CROSS_TOOL="$2"
shift 2;;
--static)
export STATIC="yes"
shift 1;;
--only-package)
IS_BUILD_SMARTDNS=0
shift 1;;
--outputdir)
OUTPUTDIR="$2"
shift 2;;
--ver)
VER="$2"
shift 2;;
-h | --help )
showhelp
return 0
shift ;;
-- ) shift; break ;;
* ) break ;;
esac
done
if [ -z "$PLATFORM" ]; then
echo "please input platform"
echo "run $0 -h for help."
return 1
fi
if [ "$PLATFORM" = "luci" ]; then
ARCH="all"
fi
if [ -z "$ARCH" ]; then
echo "please input arch."
echo "run $0 -h for help."
return 1
fi
if [ -z "$FILEARCH" ]; then
FILEARCH="$ARCH"
fi
if [ -z "$OUTPUTDIR" ]; then
OUTPUTDIR=$CURR_DIR
fi
if [ ! -z "$CROSS_TOOL" ]; then
CC="${CROSS_TOOL}gcc"
STRIP="${CROSS_TOOL}strip"
fi
if [ -z "$CC" ]; then
CC="gcc"
fi
if [ -z "$STRIP" ]; then
if [ ! -z "`echo $CC | grep '\-gcc'`" ]; then
STRIP="`echo "$CC" | sed 's/-gcc\$/-strip/g'`"
else
STRIP="strip"
fi
fi
if [ ! -e "`which $CC`" ]; then
echo "Cannot find compiler $CC"
return 1
fi
build
}
main $@
exit $?

View File

@@ -14,7 +14,6 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
CURR_DIR=$(cd $(dirname $0);pwd)
VER="`date +"1.%Y.%m.%d-%H%M"`"
SMARTDNS_DIR=$CURR_DIR/../../
@@ -26,37 +25,41 @@ showhelp()
echo "Options:"
echo " -o output directory."
echo " --arch archtecture."
echo " --ver version."
echo " --ver version."
echo " -h show this message."
}
build()
{
ROOT=/tmp/smartdns-deiban
rm -fr $ROOT
mkdir -p $ROOT
cd $ROOT/
ROOT=/tmp/smartdns-deiban
rm -fr $ROOT
mkdir -p $ROOT
cd $ROOT/
cp $CURR_DIR/DEBIAN $ROOT/ -af
CONTROL=$ROOT/DEBIAN/control
mkdir $ROOT/usr/sbin -p
mkdir $ROOT/etc/smartdns/ -p
mkdir $ROOT/etc/default/ -p
mkdir $ROOT/lib/systemd/system/ -p
cp $CURR_DIR/DEBIAN $ROOT/ -af
CONTROL=$ROOT/DEBIAN/control
mkdir $ROOT/usr/sbin -p
mkdir $ROOT/etc/smartdns/ -p
mkdir $ROOT/etc/default/ -p
mkdir $ROOT/lib/systemd/system/ -p
sed -i "s/Version:.*/Version: $VER/" $ROOT/DEBIAN/control
sed -i "s/Architecture:.*/Architecture: $ARCH/" $ROOT/DEBIAN/control
chmod 0755 $ROOT/DEBIAN/prerm
sed -i "s/Version:.*/Version: $VER/" $ROOT/DEBIAN/control
sed -i "s/Architecture:.*/Architecture: $ARCH/" $ROOT/DEBIAN/control
chmod 0755 $ROOT/DEBIAN/prerm
cp $SMARTDNS_DIR/etc/smartdns/smartdns.conf $ROOT/etc/smartdns/
cp $SMARTDNS_DIR/etc/default/smartdns $ROOT/etc/default/
cp $SMARTDNS_DIR/systemd/smartdns.service $ROOT/lib/systemd/system/
cp $SMARTDNS_DIR/src/smartdns $ROOT/usr/sbin
chmod +x $ROOT/usr/sbin/smartdns
cp $SMARTDNS_DIR/etc/smartdns/smartdns.conf $ROOT/etc/smartdns/
cp $SMARTDNS_DIR/etc/default/smartdns $ROOT/etc/default/
cp $SMARTDNS_DIR/systemd/smartdns.service $ROOT/lib/systemd/system/
cp $SMARTDNS_DIR/src/smartdns $ROOT/usr/sbin
if [ $? -ne 0 ]; then
echo "copy smartdns file failed."
return 1
fi
chmod +x $ROOT/usr/sbin/smartdns
dpkg -b $ROOT $OUTPUTDIR/smartdns.$VER.$FILEARCH.deb
dpkg -b $ROOT $OUTPUTDIR/smartdns.$VER.$FILEARCH.deb
rm -fr $ROOT/
rm -fr $ROOT/
}
main()
@@ -74,38 +77,38 @@ main()
--arch)
ARCH="$2"
shift 2;;
--filearch)
FILEARCH="$2"
shift 2;;
--ver)
VER="$2"
shift 2;;
--filearch)
FILEARCH="$2"
shift 2;;
--ver)
VER="$2"
shift 2;;
-o )
OUTPUTDIR="$2"
shift 2;;
-h | --help )
-h | --help )
showhelp
return 0
shift ;;
-- ) shift; break ;;
* ) break ;;
esac
esac
done
if [ -z "$ARCH" ]; then
echo "please input arch."
return 1;
fi
if [ -z "$ARCH" ]; then
echo "please input arch."
return 1;
fi
if [ -z "$FILEARCH" ]; then
FILEARCH=$ARCH
fi
if [ -z "$FILEARCH" ]; then
FILEARCH=$ARCH
fi
if [ -z "$OUTPUTDIR" ]; then
OUTPUTDIR=$CURR_DIR;
fi
if [ -z "$OUTPUTDIR" ]; then
OUTPUTDIR=$CURR_DIR;
fi
build
build
}
main $@

98
package/linux/make.sh Normal file
View File

@@ -0,0 +1,98 @@
#!/bin/sh
CURR_DIR=$(cd $(dirname $0);pwd)
VER="`date +"1.%Y.%m.%d-%H%M"`"
SMARTDNS_DIR=$CURR_DIR/../../
SMARTDNS_BIN=$SMARTDNS_DIR/src/smartdns
showhelp()
{
echo "Usage: make [OPTION]"
echo "Options:"
echo " -o output directory."
echo " --arch archtecture."
echo " --ver version."
echo " -h show this message."
}
build()
{
PKG_ROOT=/tmp/smartdns-linux
rm -fr $PKG_ROOT
mkdir -p $PKG_ROOT/smartdns
cd $PKG_ROOT/
# Generic x86_64
mkdir $PKG_ROOT/smartdns/src -p
mkdir $PKG_ROOT/smartdns/package -p
cd $SMARTDNS_DIR
cp package/windows $PKG_ROOT/smartdns/package/ -a
cp etc systemd *.md LICENSE install $PKG_ROOT/smartdns/ -a
cp src/smartdns $PKG_ROOT/smartdns/src -a
if [ $? -ne 0 ]; then
echo "copy smartdns file failed"
rm -fr $PKG_ROOT
exit 1
fi
cd $PKG_ROOT
tar zcf $OUTPUTDIR/smartdns.$VER.$FILEARCH.tar.gz smartdns
if [ $? -ne 0 ]; then
echo "create package failed"
rm -fr $PKG_ROOT
exit 1
fi
cd $CURR_DIR
rm -fr $PKG_ROOT
}
main()
{
OPTS=`getopt -o o:h --long arch:,ver:,filearch: \
-n "" -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$OPTS"
while true; do
case "$1" in
--arch)
ARCH="$2"
shift 2;;
--filearch)
FILEARCH="$2"
shift 2;;
--ver)
VER="$2"
shift 2;;
-o )
OUTPUTDIR="$2"
shift 2;;
-h | --help )
showhelp
return 0
shift ;;
-- ) shift; break ;;
* ) break ;;
esac
done
if [ -z "$ARCH" ]; then
echo "please input arch."
return 1;
fi
if [ -z "$FILEARCH" ]; then
FILEARCH=$ARCH
fi
if [ -z "$OUTPUTDIR" ]; then
OUTPUTDIR=$CURR_DIR;
fi
build
}
main $@
exit $?

View File

@@ -14,7 +14,6 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
CURR_DIR=$(cd $(dirname $0);pwd)
VER="`date +"1.%Y.%m.%d-%H%M"`"
@@ -27,58 +26,58 @@ showhelp()
echo "Options:"
echo " -o output directory."
echo " --arch archtecture."
echo " --ver version."
echo " --ver version."
echo " -h show this message."
}
build_tool()
{
make -C $ROOT/tool/po2lmo -j
PO2LMO="$ROOT/tool/po2lmo/src/po2lmo"
make -C $ROOT/tool/po2lmo -j
PO2LMO="$ROOT/tool/po2lmo/src/po2lmo"
}
clean_tool()
{
make -C $ROOT/tool/po2lmo clean
make -C $ROOT/tool/po2lmo clean
}
build()
{
ROOT=/tmp/luci-app-smartdns
rm -fr $ROOT
ROOT=/tmp/luci-app-smartdns
rm -fr $ROOT
mkdir -p $ROOT
cp $CURR_DIR/* $ROOT/ -af
cd $ROOT/
build_tool
mkdir $ROOT/root/usr/lib/lua/ -p
cp $ROOT/files/luci $ROOT/root/usr/lib/lua/ -af
#Generate Language
$PO2LMO $ROOT/files/luci/i18n/smartdns.zh-cn.po $ROOT/root/usr/lib/lua/luci/i18n/smartdns.zh-cn.lmo
rm $ROOT/root/usr/lib/lua/luci/i18n/smartdns.zh-cn.po
mkdir -p $ROOT
cp $CURR_DIR/* $ROOT/ -af
cd $ROOT/
build_tool
mkdir $ROOT/root/usr/lib/lua/ -p
cp $ROOT/files/luci $ROOT/root/usr/lib/lua/ -af
#Generate Language
$PO2LMO $ROOT/files/luci/i18n/smartdns.zh-cn.po $ROOT/root/usr/lib/lua/luci/i18n/smartdns.zh-cn.lmo
rm $ROOT/root/usr/lib/lua/luci/i18n/smartdns.zh-cn.po
cp $ROOT/files/etc $ROOT/root/ -af
INST_SIZE="`du -sb $ROOT/root/ | awk '{print $1}'`"
sed -i "s/^Architecture.*/Architecture: $ARCH/g" $ROOT/control/control
sed -i "s/Version:.*/Version: $VER/" $ROOT/control/control
cp $ROOT/files/etc $ROOT/root/ -af
INST_SIZE="`du -sb $ROOT/root/ | awk '{print $1}'`"
sed -i "s/^Architecture.*/Architecture: all/g" $ROOT/control/control
sed -i "s/Version:.*/Version: $VER/" $ROOT/control/control
if [ ! -z "$INST_SIZE" ]; then
echo "Installed-Size: $INST_SIZE" >> $ROOT/control/control
fi
if [ ! -z "$INST_SIZE" ]; then
echo "Installed-Size: $INST_SIZE" >> $ROOT/control/control
fi
cd $ROOT/control
chmod +x *
tar zcf ../control.tar.gz ./
cd $ROOT
cd $ROOT/control
chmod +x *
tar zcf ../control.tar.gz ./
cd $ROOT
tar zcf $ROOT/data.tar.gz -C root .
tar zcf $OUTPUTDIR/luci-app-smartdns.$VER.$FILEARCH.ipk control.tar.gz data.tar.gz debian-binary
tar zcf $ROOT/data.tar.gz -C root .
tar zcf $OUTPUTDIR/luci-app-smartdns.$VER.$FILEARCH.ipk control.tar.gz data.tar.gz debian-binary
rm -fr $ROOT/
rm -fr $ROOT/
}
main()
@@ -96,38 +95,38 @@ main()
--arch)
ARCH="$2"
shift 2;;
--filearch)
FILEARCH="$2"
shift 2;;
--ver)
VER="$2"
shift 2;;
--filearch)
FILEARCH="$2"
shift 2;;
--ver)
VER="$2"
shift 2;;
-o )
OUTPUTDIR="$2"
shift 2;;
-h | --help )
-h | --help )
showhelp
return 0
shift ;;
-- ) shift; break ;;
* ) break ;;
esac
esac
done
if [ -z "$ARCH" ]; then
echo "please input arch."
return 1;
fi
if [ -z "$ARCH" ]; then
echo "please input arch."
return 1;
fi
if [ -z "$FILEARCH" ]; then
FILEARCH=$ARCH
fi
if [ -z "$FILEARCH" ]; then
FILEARCH=$ARCH
fi
if [ -z "$OUTPUTDIR" ]; then
OUTPUTDIR=$CURR_DIR;
fi
if [ -z "$OUTPUTDIR" ]; then
OUTPUTDIR=$CURR_DIR;
fi
build
build
}
main $@

View File

@@ -14,7 +14,6 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
CURR_DIR=$(cd $(dirname $0);pwd)
VER="`date +"1.%Y.%m.%d-%H%M"`"
@@ -31,47 +30,52 @@ showhelp()
echo "Options:"
echo " -o output directory."
echo " --arch archtecture."
echo " --ver version."
echo " --ver version."
echo " -h show this message."
}
build()
{
ROOT=/tmp/smartdns-openwrt
rm -fr $ROOT
ROOT=/tmp/smartdns-openwrt
rm -fr $ROOT
mkdir -p $ROOT
cp $CURR_DIR/* $ROOT/ -af
cd $ROOT/
mkdir $ROOT/root/usr/sbin -p
mkdir $ROOT/root/etc/init.d -p
mkdir $ROOT/root/etc/smartdns/ -p
mkdir -p $ROOT
cp $CURR_DIR/* $ROOT/ -af
cd $ROOT/
mkdir $ROOT/root/usr/sbin -p
mkdir $ROOT/root/etc/init.d -p
mkdir $ROOT/root/etc/smartdns/ -p
cp $SMARTDNS_CONF $ROOT/root/etc/smartdns/
cp $ADDRESS_CONF $ROOT/root/etc/smartdns/
cp $BLACKLIST_IP_CONF $ROOT/root/etc/smartdns/
cp $CUSTOM_CONF $ROOT/root/etc/smartdns/
cp $CURR_DIR/files/etc $ROOT/root/ -af
cp $SMARTDNS_BIN $ROOT/root/usr/sbin
cp $SMARTDNS_CONF $ROOT/root/etc/smartdns/
cp $ADDRESS_CONF $ROOT/root/etc/smartdns/
cp $BLACKLIST_IP_CONF $ROOT/root/etc/smartdns/
cp $CUSTOM_CONF $ROOT/root/etc/smartdns/
cp $CURR_DIR/files/etc $ROOT/root/ -af
cp $SMARTDNS_BIN $ROOT/root/usr/sbin
if [ $? -ne 0 ]; then
echo "copy smartdns file failed."
rm -fr $ROOT/
return 1
fi
chmod +x $ROOT/root/etc/init.d/smartdns
INST_SIZE="`du -sb $ROOT/root/ | awk '{print $1}'`"
chmod +x $ROOT/root/etc/init.d/smartdns
INST_SIZE="`du -sb $ROOT/root/ | awk '{print $1}'`"
sed -i "s/^Architecture.*/Architecture: $ARCH/g" $ROOT/control/control
sed -i "s/Version:.*/Version: $VER/" $ROOT/control/control
sed -i "s/^\(bind .*\):53/\1:6053/g" $ROOT/root/etc/smartdns/smartdns.conf
if [ ! -z "$INST_SIZE" ]; then
echo "Installed-Size: $INST_SIZE" >> $ROOT/control/control
fi
sed -i "s/^Architecture.*/Architecture: $ARCH/g" $ROOT/control/control
sed -i "s/Version:.*/Version: $VER/" $ROOT/control/control
sed -i "s/^\(bind .*\):53/\1:6053/g" $ROOT/root/etc/smartdns/smartdns.conf
if [ ! -z "$INST_SIZE" ]; then
echo "Installed-Size: $INST_SIZE" >> $ROOT/control/control
fi
cd $ROOT/control
chmod +x *
tar zcf ../control.tar.gz --owner=0 --group=0 ./
cd $ROOT
cd $ROOT/control
chmod +x *
tar zcf ../control.tar.gz --owner=0 --group=0 ./
cd $ROOT
tar zcf $ROOT/data.tar.gz -C root --owner=0 --group=0 .
tar zcf $OUTPUTDIR/smartdns.$VER.$FILEARCH.ipk --owner=0 --group=0 control.tar.gz data.tar.gz debian-binary
rm -fr $ROOT/
tar zcf $ROOT/data.tar.gz -C root --owner=0 --group=0 .
tar zcf $OUTPUTDIR/smartdns.$VER.$FILEARCH.ipk --owner=0 --group=0 control.tar.gz data.tar.gz debian-binary
rm -fr $ROOT/
}
main()
@@ -89,38 +93,38 @@ main()
--arch)
ARCH="$2"
shift 2;;
--filearch)
FILEARCH="$2"
shift 2;;
--ver)
VER="$2"
shift 2;;
--filearch)
FILEARCH="$2"
shift 2;;
--ver)
VER="$2"
shift 2;;
-o )
OUTPUTDIR="$2"
shift 2;;
-h | --help )
-h | --help )
showhelp
return 0
shift ;;
-- ) shift; break ;;
* ) break ;;
esac
esac
done
if [ -z "$ARCH" ]; then
echo "please input arch."
return 1;
fi
if [ -z "$ARCH" ]; then
echo "please input arch."
return 1;
fi
if [ -z "$FILEARCH" ]; then
FILEARCH=$ARCH
fi
if [ -z "$FILEARCH" ]; then
FILEARCH=$ARCH
fi
if [ -z "$OUTPUTDIR" ]; then
OUTPUTDIR=$CURR_DIR;
fi
if [ -z "$OUTPUTDIR" ]; then
OUTPUTDIR=$CURR_DIR;
fi
build
build
}
main $@

View File

@@ -14,7 +14,6 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
CURR_DIR=$(cd $(dirname $0);pwd)
VER="`date +"1.%Y.%m.%d-%H%M"`"
SMARTDNS_DIR=$CURR_DIR/../../
@@ -28,39 +27,44 @@ showhelp()
echo "Options:"
echo " -o output directory."
echo " --arch archtecture."
echo " --ver version."
echo " --ver version."
echo " -h show this message."
}
build()
{
ROOT=/tmp/smartdns-optware
rm -fr $ROOT
ROOT=/tmp/smartdns-optware
rm -fr $ROOT
mkdir -p $ROOT
cp $CURR_DIR/* $ROOT/ -af
cd $ROOT/
mkdir $ROOT/opt/usr/sbin -p
mkdir $ROOT/opt/etc/init.d -p
mkdir $ROOT/opt/etc/smartdns/ -p
mkdir -p $ROOT
cp $CURR_DIR/* $ROOT/ -af
cd $ROOT/
mkdir $ROOT/opt/usr/sbin -p
mkdir $ROOT/opt/etc/init.d -p
mkdir $ROOT/opt/etc/smartdns/ -p
cp $SMARTDNS_CONF $ROOT/opt/etc/smartdns/
cp $SMARTDNS_OPT $ROOT/opt/etc/smartdns/
cp $CURR_DIR/S50smartdns $ROOT/opt/etc/init.d/
cp $SMARTDNS_BIN $ROOT/opt/usr/sbin
cp $SMARTDNS_CONF $ROOT/opt/etc/smartdns/
cp $SMARTDNS_OPT $ROOT/opt/etc/smartdns/
cp $CURR_DIR/S50smartdns $ROOT/opt/etc/init.d/
cp $SMARTDNS_BIN $ROOT/opt/usr/sbin
if [ $? -ne 0 ]; then
echo "copy smartdns file failed."
rm -fr $ROOT/
return 1
fi
sed -i "s/# *server-name smartdns/server-name smartdns/g" $ROOT/opt/etc/smartdns/smartdns.conf
sed -i "s/^Architecture.*/Architecture: $ARCH/g" $ROOT/control/control
sed -i "s/Version:.*/Version: $VER/" $ROOT/control/control
sed -i "s/# *server-name smartdns/server-name smartdns/g" $ROOT/opt/etc/smartdns/smartdns.conf
sed -i "s/^Architecture.*/Architecture: $ARCH/g" $ROOT/control/control
sed -i "s/Version:.*/Version: $VER/" $ROOT/control/control
cd $ROOT/control
chmod +x *
tar zcf ../control.tar.gz --owner=0 --group=0 ./
cd $ROOT
cd $ROOT/control
chmod +x *
tar zcf ../control.tar.gz --owner=0 --group=0 ./
cd $ROOT
tar zcf data.tar.gz --owner=0 --group=0 opt
tar zcf $OUTPUTDIR/smartdns.$VER.$FILEARCH.ipk --owner=0 --group=0 control.tar.gz data.tar.gz debian-binary
rm -fr $ROOT/
tar zcf data.tar.gz --owner=0 --group=0 opt
tar zcf $OUTPUTDIR/smartdns.$VER.$FILEARCH.ipk --owner=0 --group=0 control.tar.gz data.tar.gz debian-binary
rm -fr $ROOT/
}
main()
@@ -78,38 +82,38 @@ main()
--arch)
ARCH="$2"
shift 2;;
--filearch)
FILEARCH="$2"
shift 2;;
--ver)
VER="$2"
shift 2;;
--filearch)
FILEARCH="$2"
shift 2;;
--ver)
VER="$2"
shift 2;;
-o )
OUTPUTDIR="$2"
shift 2;;
-h | --help )
-h | --help )
showhelp
return 0
shift ;;
-- ) shift; break ;;
* ) break ;;
esac
esac
done
if [ -z "$ARCH" ]; then
echo "please input arch."
return 1;
fi
if [ -z "$ARCH" ]; then
echo "please input arch."
return 1;
fi
if [ -z "$FILEARCH" ]; then
FILEARCH=$ARCH
fi
if [ -z "$FILEARCH" ]; then
FILEARCH=$ARCH
fi
if [ -z "$OUTPUTDIR" ]; then
OUTPUTDIR=$CURR_DIR;
fi
if [ -z "$OUTPUTDIR" ]; then
OUTPUTDIR=$CURR_DIR;
fi
build
build
}
main $@