Skip to content

Commit

Permalink
add ant-spk configure file
Browse files Browse the repository at this point in the history
  • Loading branch information
bsdcpp committed May 18, 2017
1 parent f038b13 commit ed7204c
Show file tree
Hide file tree
Showing 10 changed files with 167 additions and 0 deletions.
Binary file added ant-spk/app/dsm/images/icon_256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ant-spk/app/dsm/images/icon_72.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions ant-spk/build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="Ant SPK Task" basedir="." default="spk" xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:syno="antlib:net.filebot.ant.spk">

<property name="package" value="synokvm" />
<property name="version" value="1.0" />

<target name="spk" description="Build SPK package">
<syno:spk destdir="dist" name="${package}" version="${version}" arch="noarch" compression="gzip">
<info name="displayname" value="SynoKVM" />
<info name="description" value="libvirt, kvm for synology DSM" />

<info name="maintainer" value="[email protected]" />
<info name="maintainer_url" value="https://github.com/bsdcpp/synoKVM" />

<icon size="72" file="app/dsm/images/icon_72.png" />
<icon size="256" file="app/dsm/images/icon_256.png" />

<wizard dir="spk/wizard" />
<scripts dir="spk/scripts" filemode="755" />

<package dir="app" includes="**/*" filemode="755" />

<codesign keyid="D545C93D" secring="gpg/secring.gpg" password="" />
</syno:spk>

<syno:package-source file="dist/spksrc.json">
<keyring file="gpg/alice.pub" />
<spk file="dist/${package}-${version}-noarch.spk">
<info name="link" value="http://packages.example.org/${package}-${version}-noarch.spk" />
<thumbnail url="http://images.example.org/${package}/thumbnail.png" />
<snapshot url="http://images.example.org/${package}/screenshot.png" />
</spk>
</syno:package-source>
</target>

<target name="retrieve" description="Retrieve dependencies with Apache Ivy">
<ivy:retrieve pattern="lib/[artifact]-[type].[ext]" />
</target>

</project>
37 changes: 37 additions & 0 deletions ant-spk/spk/scripts/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/sh
# Copyright (C) 2000-2016 Synology Inc. All rights reserved.

p_dir()
{
[ -d "$1" ] || mkdir -p $1
}

p_dir /usr/local/bin
p_dir /usr/local/sbin
p_dir /usr/local/lib
p_dir /usr/local/libexec
p_dir /usr/local/share
p_dir /usr/local/etc
p_dir /usr/local/var
p_dir /usr/local/etc/logrotate.d
p_dir /usr/local/var/cache/
p_dir /usr/local/var/lib/
p_dir /usr/local/var/log
p_dir /usr/local/var/run


ln -sf $SYNOPKG_PKGDEST/bin/* /usr/local/bin
ln -sf $SYNOPKG_PKGDEST/sbin/* /usr/local/sbin
ln -sf $SYNOPKG_PKGDEST/lib/* /usr/local/lib/
ln -sf $SYNOPKG_PKGDEST/libexec/* /usr/local/libexec/
ln -sf $SYNOPKG_PKGDEST/share/* /usr/local/share/

ln -sf $SYNOPKG_PKGDEST/etc/libvirt /usr/local/etc/
ln -sf $SYNOPKG_PKGDEST/etc/sasl2 /usr/local/etc/
ln -sf $SYNOPKG_PKGDEST/etc/logrotate.d/libvirtd /usr/local/etc/logrotate.d/

ln -sf $SYNOPKG_PKGDEST/var/cache/* /usr/local/var/cache/
ln -sf $SYNOPKG_PKGDEST/var/lib/* /usr/local/var/lib/
ln -sf $SYNOPKG_PKGDEST/var/log/* /usr/local/var/log/
ln -sf $SYNOPKG_PKGDEST/var/run/* /usr/local/var/run/
exit 0
6 changes: 6 additions & 0 deletions ant-spk/spk/scripts/postuninst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
# Copyright (C) 2000-2016 Synology Inc. All rights reserved.

find /usr/local/ -type l -ls |grep synokvm |awk -F"->" '{print $1}'|awk '{print $NF}'|xargs rm -f

exit 0
4 changes: 4 additions & 0 deletions ant-spk/spk/scripts/postupgrade
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
# Copyright (C) 2000-2016 Synology Inc. All rights reserved.

exit 0
4 changes: 4 additions & 0 deletions ant-spk/spk/scripts/preinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
# Copyright (C) 2000-2016 Synology Inc. All rights reserved.

exit 0
4 changes: 4 additions & 0 deletions ant-spk/spk/scripts/preuninst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
# Copyright (C) 2000-2016 Synology Inc. All rights reserved.

exit 0
4 changes: 4 additions & 0 deletions ant-spk/spk/scripts/preupgrade
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
# Copyright (C) 2000-2016 Synology Inc. All rights reserved.

exit 0
68 changes: 68 additions & 0 deletions ant-spk/spk/scripts/start-stop-status
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/bin/sh
# Copyright (C) 2000-2016 Synology Inc. All rights reserved.

insert_kernel_modules()
{
insmod /lib/modules/kvm.ko
it=`grep vmx /proc/cpuinfo`
amd=`grep svm /proc/cpuinfo`
if [ ! -z "${it}" ]; then
insmod /lib/modules/kvm-intel.ko
elif [ ! -z "${amd}" ]; then
insmod /lib/modules/kvm-amd.ko
else
echo 0
fi
insmod /lib/modules/tun.ko
insmod /lib/modules/vhost_net.ko
}
remove_kernel_modules()
{
rmmod vhost_net
rmmod tun
it=`grep vmx /proc/cpuinfo`
amd=`grep svm /proc/cpuinfo`
if [ ! -z "${it}" ]; then
rmmod kvm_intel
elif [ ! -z "${amd}" ]; then
rmmod kvm_amd
else
echo 0
fi
rmmod kvm
}

case $1 in
start)
ret=`insert_kernel_modules`
if [ "$ret" != "0" ]; then
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
virtlogd -d
libvirtd -l -d -f /usr/local/etc/libvirt/libvirtd.conf
exit 0
else
exit 1
fi
;;
stop)
killall libvirtd
killall virtlogd
remove_kernel_modules
exit 0
;;
status)
if [ -f "/usr/local/var/run/virtlogd.pid" -a -f "/usr/local/var/run/libvirtd.pid" ]; then
exit 0
else
exit 1
fi
;;
killall)
killall libvirtd
killall virtlogd
remove_kernel_modules
;;
log)
exit 0
;;
esac

0 comments on commit ed7204c

Please sign in to comment.