Преглед изворни кода

openwrt: add apk packages.

Nick Peng пре 1 месец
родитељ
комит
72b60e4ae8
3 измењених фајлова са 76 додато и 0 уклоњено
  1. 25 0
      package/luci-lite/make.sh
  2. 25 0
      package/luci/make.sh
  3. 26 0
      package/openwrt/make.sh

+ 25 - 0
package/luci-lite/make.sh

@@ -81,6 +81,31 @@ build()
 	tar zcf $ROOT/data.tar.gz -C root .
 	tar zcf $OUTPUTDIR/luci-app-smartdns-lite.$VER.$FILEARCH.ipk ./control.tar.gz ./data.tar.gz ./debian-binary
 
+	which apk >/dev/null 2>&1
+	if [ $? -eq 0 ]; then
+		APK_VER="`echo $VER | sed 's/[-]/-r/'`"
+		ARCH="`echo $ARCH | sed 's/all/noarch/g'`"
+		apk mkpkg \
+			--info "name:luci-app-smartdns-lite" \
+			--info "version:$APK_VER" \
+			--info "description:smartdns luci lite" \
+			--info "arch:$ARCH" \
+			--info "license:GPL" \
+			--info "origin: https://github.com/pymumu/smartdns.git" \
+			--info "depends:libc smartdns" \
+			--script "post-install:$ROOT/control/postinst" \
+			--script "pre-deinstall:$ROOT/control/prerm" \
+			--files "$ROOT/root/" \
+			--output "$OUTPUTDIR/luci-app-smartdns-lite.$VER.$FILEARCH.apk"
+		if [ $? -ne 0 ]; then
+			echo "build apk package failed."
+			rm -fr $ROOT/
+			return 1
+		fi
+	else
+		echo "== warning: apk tool not found, skip build apk package. =="
+	fi
+
 	rm -fr $ROOT/
 }
 

+ 25 - 0
package/luci/make.sh

@@ -80,6 +80,31 @@ build()
 	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
 
+	which apk >/dev/null 2>&1
+	if [ $? -eq 0 ]; then
+		APK_VER="`echo $VER | sed 's/[-]/-r/'`"
+		ARCH="`echo $ARCH | sed 's/all/noarch/g'`"
+		apk mkpkg \
+			--info "name:luci-app-smartdns" \
+			--info "version:$APK_VER" \
+			--info "description:smartdns luci" \
+			--info "arch:$ARCH" \
+			--info "license:GPL" \
+			--info "origin: https://github.com/pymumu/smartdns.git" \
+			--info "depends:libc smartdns" \
+			--script "post-install:$ROOT/control/postinst" \
+			--script "pre-deinstall:$ROOT/control/prerm" \
+			--files "$ROOT/root/" \
+			--output "$OUTPUTDIR/luci-app-smartdns.$VER.$FILEARCH.apk"
+		if [ $? -ne 0 ]; then
+			echo "build apk package failed."
+			rm -fr $ROOT/
+			return 1
+		fi
+	else
+		echo "== warning: apk tool not found, skip build apk package. =="
+	fi
+
 	rm -fr $ROOT/
 }
 

+ 26 - 0
package/openwrt/make.sh

@@ -108,6 +108,32 @@ build()
 
 	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
+
+	which apk >/dev/null 2>&1
+	if [ $? -eq 0 ]; then
+		APK_VER="`echo $VER | sed 's/[-]/-r/'`"
+		ARCH="`echo $ARCH | sed 's/all/noarch/g'`"
+		apk mkpkg \
+			--info "name:smartdns" \
+			--info "version:$APK_VER" \
+			--info "description:A smartdns Server" \
+			--info "arch:$ARCH" \
+			--info "license:GPL" \
+			--info "origin: https://github.com/pymumu/smartdns.git" \
+			--info "depends:libc libpthread" \
+			--script "post-install:$ROOT/control/postinst" \
+			--script "pre-deinstall:$ROOT/control/prerm" \
+			--files "$ROOT/root/" \
+			--output "$OUTPUTDIR/smartdns.$VER.$FILEARCH.apk"
+		if [ $? -ne 0 ]; then
+			echo "build apk package failed."
+			rm -fr $ROOT/
+			return 1
+		fi
+	else
+		echo "== warning: apk tool not found, skip build apk package. =="
+	fi
+
 	rm -fr $ROOT/
 }