--- /dev/null
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ Copyright 2014 Docker, Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
--- /dev/null
+NIWA Hideyuki <niwa.niwa@nifty.ne.jp>
+
+
--- /dev/null
+Fulcon
+
+Copyright (C) 2015 NIWA Hideyuki
+
+
--- /dev/null
+## Fulcon
+
+`Fulcon` is the CLI tool for Full Container System
+
+## State of the project
+
+In Fulcon, the container can be handled like VM.
+Fulcon constructs the system by generating the container, logging in
+from the console, and installing the package with yum and apt, and stops
+the system with shutdown command. The container can be connected directly with
+the Internet by adding virtual NIC.
+Fulcon can handle CentOS 7 and Ubuntu 15.04
+
+Docker is used for the container. However, Fulcon does not depend on Docker.
+Docker is used by way of the driver of Fulcon.
+Other container software might be added to the driver.
+
+### Building:
+
+ubuntu15.04
+
+/ $ sudo apt-get install docker.io
+/ $ sudo apt-get install python-ipy
+/ $ sudo apt-get install bridge-utils
+
+/ $ tar xzf fulcon.tgz
+/ $ cd fulcon
+/ $ sudo make install
+
+CentOS 7
+
+/ $ sudo yum install docker-io
+/ $ sudo yum install python-IPy
+/ $ sudo yum install bridge-utils
+
+/ $ tar xzf fulcon.tgz
+/ $ cd fulcon
+/ $ sudo make install
+
+### Setup:
+
+The image of CentOS 7 and Ubuntu15.04 is prepared.
+
+/ $ sudo fulcon setup
+
+The image is acquired by using Dockerfile and this command is set up.
+If it does not go well. images are generated with following Dockerfile.
+ /var/lib/fulcon/driver/dockerfile/centos7/Dockerfile
+ /var/lib/fulcon/driver/dockerfile/ubuntu1504/Dockerfile
+It must be builded "fulcon/centos7" and "fulcon/ubuntu1504"
+
+### Using:
+
+1. Generation of container
+
+In the following example, the container "webap-server" is generated.
+
+/ $ sudo fulcon sysgen webap-server1
+
+The container of "fulcon/centos7" was generated.
+It is optional -c, and "fulcon/ubuntu1504" can be specified.
+
+2. The user is added, and the password is set.
+
+In the following example, the user "niwa" is seted.
+
+/ $ sudo fulcon set-passwd webap-server niwa
+
+3. Virtual NIC addition
+
+/ $ sudo fulcon net-add webap-server 192.168.17.2/24
+
+
+4. Attache console to the container, and login in the container.
+
+/ $ sudo fulcon console webap-server
+/ Attached aa-srv.
+/ To enter console, hit Enter.
+/ To exit console, ^p^q is pushed.
+
+5. When you login the container, yum and apt can be used.
+ You can login with ssh.
+ "shutdown -h now" can be used in container.
+
+6. Stop and start of container
+
+/ $ sudo fulcon stop webap-server
+
+/ $ sudo fulcon start webap-server
+
+7. List containers
+
+/ $ sudo fulcon list
+
+8. Erase of container
+
+/ $ sudo fulcon erase webap-server
+
+
+### Sub command:
+
+ console [ -x ] [ -n REPEAT_NUMBER] NAME
+
+ dirver-name
+
+ erase NAME ...
+ erase [-n REPEAT_NUMBER] NAME
+
+ help
+
+ image-catalog
+
+ image-name
+
+ list
+
+ net-add [-d NIC_DEVICE] [-n VETH_NUMBER] [-g GATEWAY] [-b BRIDGE] NAME IP_ADDR/MASK
+
+ net-del [-n VETH_NUMBER] NAME
+ net-del [-d NIC_DEVICE] NAME
+
+ net-info NAME
+
+ resource [-c CPU] [-n CPUSET] [-m MEM] NAME
+
+ set-default-image [ IMAGE_NAME ]
+
+ set-passwd
+
+ setup
+
+ start NAME ...
+ start [-n REPEAT_NUMBER] NAME
+
+ stop NAME ...
+ stop [-n REPEAT_NUMBER] NAME
+
+ sysgen [ -c IMAGE ] NAME NAME ...
+ sysgen [-n REPEAT_NUMBER ] [ -c IMAGE ] NAME ...
+
+ update
+
+
+
+```
+
+
--- /dev/null
+The ubuntu package is made here.
--- /dev/null
+The centos package is made here.
--- /dev/null
+program: Fulcon
+Maintainer: Hideyuki Niwa
+
--- /dev/null
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ Copyright 2014 Docker, Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
--- /dev/null
+Installation
+=============
+
+ 1) tar xzf fulcon.tgz
+
+ 2) cd fulcon
+
+ 3) Type 'make install' to install the program and any data files and
+ documentation.
+
--- /dev/null
+# Fulcon/CS
+# Copyright (C) 2015 NIWA Hideyuki
+
+VERSION=0.1
+
+prefix ?= /usr
+exec_prefix ?= ${prefix}
+datarootdir ?= ${prefix}/share
+sbindir ?= ${exec_prefix}/sbin
+libdir ?= ${exec_prefix}/lib64
+localstatedir ?= /var
+mandir ?= ${prefix}/share/man
+docdir ?= ${datarootdir}/doc/fulcon-${VERSION}
+
+fulcon :
+
+install : install-cmd install-lib install-driver install-doc
+
+install-cmd :
+ install -m 755 cmd/fulcon $(DESTDIR)$(sbindir)/fulcon
+
+install-lib :
+ mkdir -p $(DESTDIR)$(libdir)/fulcon/sbin
+ install -m 755 lib/image-name $(DESTDIR)$(libdir)/fulcon/sbin/image-name
+ install -m 755 lib/driver-name $(DESTDIR)$(libdir)/fulcon/sbin/driver-name
+ install -m 755 lib/list $(DESTDIR)$(libdir)/fulcon/sbin/list
+ install -m 755 lib/sysgen $(DESTDIR)$(libdir)/fulcon/sbin/sysgen
+ install -m 755 lib/erase $(DESTDIR)$(libdir)/fulcon/sbin/erase
+ install -m 755 lib/start $(DESTDIR)$(libdir)/fulcon/sbin/start
+ install -m 755 lib/stop $(DESTDIR)$(libdir)/fulcon/sbin/stop
+ install -m 755 lib/net-add $(DESTDIR)$(libdir)/fulcon/sbin/net-add
+ install -m 755 lib/net-del $(DESTDIR)$(libdir)/fulcon/sbin/net-del
+ install -m 755 lib/net-info $(DESTDIR)$(libdir)/fulcon/sbin/net-info
+ install -m 755 lib/resource $(DESTDIR)$(libdir)/fulcon/sbin/resource
+ install -m 755 lib/setup $(DESTDIR)$(libdir)/fulcon/sbin/setup
+ install -m 755 lib/set-user $(DESTDIR)$(libdir)/fulcon/sbin/set-user
+ install -m 755 lib/set-passwd $(DESTDIR)$(libdir)/fulcon/sbin/set-passwd
+ install -m 755 lib/image-catalog $(DESTDIR)$(libdir)/fulcon/sbin/image-catalog
+ install -m 755 lib/set-default-image $(DESTDIR)$(libdir)/fulcon/sbin/set-default-image
+ install -m 755 lib/update $(DESTDIR)$(libdir)/fulcon/sbin/update
+ install -m 755 lib/console $(DESTDIR)$(libdir)/fulcon/sbin/console
+ install -m 755 lib/help $(DESTDIR)$(libdir)/fulcon/sbin/help
+
+install-driver : install-driver-docker
+
+install-driver-docker : install-dockerfile
+ mkdir -p $(DESTDIR)$(libdir)/fulcon/driver/docker
+ install -m 755 driver/docker/cpu $(DESTDIR)$(libdir)/fulcon/driver/docker/cpu
+ install -m 755 driver/docker/cpuset $(DESTDIR)$(libdir)/fulcon/driver/docker/cpuset
+ install -m 755 driver/docker/docker-find-id $(DESTDIR)$(libdir)/fulcon/driver/docker/docker-find-id
+ install -m 755 driver/docker/erase $(DESTDIR)$(libdir)/fulcon/driver/docker/erase
+ install -m 755 driver/docker/find-proc $(DESTDIR)$(libdir)/fulcon/driver/docker/find-proc
+ install -m 755 driver/docker/list $(DESTDIR)$(libdir)/fulcon/driver/docker/list
+ install -m 755 driver/docker/mem $(DESTDIR)$(libdir)/fulcon/driver/docker/mem
+ install -m 755 driver/docker/net-add $(DESTDIR)$(libdir)/fulcon/driver/docker/net-add
+ install -m 755 driver/docker/net-del $(DESTDIR)$(libdir)/fulcon/driver/docker/net-del
+ install -m 755 driver/docker/net-ipv4 $(DESTDIR)$(libdir)/fulcon/driver/docker/net-ipv4
+ install -m 755 driver/docker/start $(DESTDIR)$(libdir)/fulcon/driver/docker/start
+ install -m 755 driver/docker/stop $(DESTDIR)$(libdir)/fulcon/driver/docker/stop
+ install -m 755 driver/docker/sysgen $(DESTDIR)$(libdir)/fulcon/driver/docker/sysgen
+ install -m 755 driver/docker/setup $(DESTDIR)$(libdir)/fulcon/driver/docker/setup
+ install -m 755 driver/docker/set-user $(DESTDIR)$(libdir)/fulcon/driver/docker/set-user
+ install -m 755 driver/docker/set-passwd $(DESTDIR)$(libdir)/fulcon/driver/docker/set-passwd
+ install -m 755 driver/docker/update $(DESTDIR)$(libdir)/fulcon/driver/docker/update
+ install -m 755 driver/docker/console $(DESTDIR)$(libdir)/fulcon/driver/docker/console
+
+install-dockerfile :
+ mkdir -p $(DESTDIR)/$(localstatedir)/lib/fulcon/driver/dockerfile
+ mkdir -p $(DESTDIR)/$(localstatedir)/lib/fulcon/driver/dockerfile/centos7
+ install -m 755 driver/docker/dockerfile/centos7/Dockerfile $(DESTDIR)/$(localstatedir)/lib/fulcon/driver/dockerfile/centos7/Dockerfile
+ mkdir -p $(DESTDIR)/$(localstatedir)/lib/fulcon/driver/dockerfile/ubuntu1504
+ install -m 755 driver/docker/dockerfile/ubuntu1504/Dockerfile $(DESTDIR)/$(localstatedir)/lib/fulcon/driver/dockerfile/ubuntu1504/Dockerfile
+ install -m 755 driver/docker/dockerfile/ubuntu1504/80proxy $(DESTDIR)/$(localstatedir)/lib/fulcon/driver/dockerfile/ubuntu1504/80proxy
+
+install-doc :
+ mkdir -p $(DESTDIR)$(libdir)/fulcon/doc
+ install -m 644 doc/help.txt $(DESTDIR)$(libdir)/fulcon/doc/help.txt
+ install -m 644 README $(DESTDIR)$(libdir)/fulcon/doc/README
+ mkdir -p $(DESTDIR)$(localstatedir)/lib/fulcon
+ install -m 644 doc/default-image $(DESTDIR)$(localstatedir)/lib/fulcon/default-image
+
+
+uninstall :
+ rm -f $(DESTDIR)$(sbindir)/fulcon
+ rm -rf $(DESTDIR)$(libdir)/fulcon
+ rm -rf $(DESTDIR)/$(docdir)
+ rm -rf $(DESTDIR)/var/lib/fulcon
+
--- /dev/null
+
+2015 Aug23 start release 0.1 :
+- First release.
--- /dev/null
+## Fulcon
+
+`Fulcon` is the CLI tool for Full Container System
+
+## State of the project
+
+In Fulcon, the container can be handled like VM.
+Fulcon constructs the system by generating the container, logging in
+from the console, and installing the package with yum and apt, and stops
+the system with shutdown command. The container can be connected directly with
+the Internet by adding virtual NIC.
+Fulcon can handle CentOS 7 and Ubuntu 15.04
+
+Docker is used for the container. However, Fulcon does not depend on Docker.
+Docker is used by way of the driver of Fulcon.
+Other container software might be added to the driver.
+
+### Building:
+
+ubuntu15.04
+
+/ $ sudo apt-get install docker.io
+/ $ sudo apt-get install python-ipy
+/ $ sudo apt-get install bridge-utils
+
+/ $ tar xzf fulcon.tgz
+/ $ cd fulcon
+/ $ sudo make install
+
+CentOS 7
+
+/ $ sudo yum install docker-io
+/ $ sudo yum install python-IPy
+/ $ sudo yum install bridge-utils
+
+/ $ tar xzf fulcon.tgz
+/ $ cd fulcon
+/ $ sudo make install
+
+### Setup:
+
+The image of CentOS 7 and Ubuntu15.04 is prepared.
+
+/ $ sudo fulcon setup
+
+The image is acquired by using Dockerfile and this command is set up.
+If it does not go well. images are generated with following Dockerfile.
+ /var/lib/fulcon/driver/dockerfile/centos7/Dockerfile
+ /var/lib/fulcon/driver/dockerfile/ubuntu1504/Dockerfile
+It must be builded "fulcon/centos7" and "fulcon/ubuntu1504"
+
+### Using:
+
+1. Generation of container
+
+In the following example, the container "webap-server" is generated.
+
+/ $ sudo fulcon sysgen webap-server1
+
+The container of "fulcon/centos7" was generated.
+It is optional -c, and "fulcon/ubuntu1504" can be specified.
+
+2. The user is added, and the password is set.
+
+In the following example, the user "niwa" is seted.
+
+/ $ sudo fulcon set-passwd webap-server niwa
+
+3. Virtual NIC addition
+
+/ $ sudo fulcon net-add webap-server 192.168.17.2/24
+
+
+4. Attache console to the container, and login in the container.
+
+/ $ sudo fulcon console webap-server
+/ Attached aa-srv.
+/ To enter console, hit Enter.
+/ To exit console, ^p^q is pushed.
+
+5. When you login the container, yum and apt can be used.
+ You can login with ssh.
+ "shutdown -h now" can be used in container.
+
+6. Stop and start of container
+
+/ $ sudo fulcon stop webap-server
+
+/ $ sudo fulcon start webap-server
+
+7. List containers
+
+/ $ sudo fulcon list
+
+8. Erase of container
+
+/ $ sudo fulcon erase webap-server
+
+
+### Sub command:
+
+ console [ -x ] [ -n REPEAT_NUMBER] NAME
+
+ dirver-name
+
+ erase NAME ...
+ erase [-n REPEAT_NUMBER] NAME
+
+ help
+
+ image-catalog
+
+ image-name
+
+ list
+
+ net-add [-d NIC_DEVICE] [-n VETH_NUMBER] [-g GATEWAY] [-b BRIDGE] NAME IP_ADDR/MASK
+
+ net-del [-n VETH_NUMBER] NAME
+ net-del [-d NIC_DEVICE] NAME
+
+ net-info NAME
+
+ resource [-c CPU] [-n CPUSET] [-m MEM] NAME
+
+ set-default-image [ IMAGE_NAME ]
+
+ set-passwd
+
+ setup
+
+ start NAME ...
+ start [-n REPEAT_NUMBER] NAME
+
+ stop NAME ...
+ stop [-n REPEAT_NUMBER] NAME
+
+ sysgen [ -c IMAGE ] NAME NAME ...
+ sysgen [-n REPEAT_NUMBER ] [ -c IMAGE ] NAME ...
+
+ update
+
+
+
+```
+
+
--- /dev/null
+#!/bin/bash
+
+# Fulcon/CS - Full Container / Cargo Ship
+# Copyright (C) 2015 NIWA Hideyuki
+
+# check root
+if [ ${EUID:-$UID} -ne 0 ] ; then
+ echo "error: Because you are not root, you cannot execute this command."
+ exit 1
+fi
+
+export PATH=/usr/lib64/fulcon/sbin:$PATH
+export FULCONDIR=/var/lib/fulcon
+
+mkdir -p /var/lib/fulcon
+if [ ! -f /var/lib/fulcon/default-image ]; then
+ echo "fulcon/centos7" > /var/lib/fulcon/default-image
+fi
+
+FLG_H=0
+
+while getopts h OPT
+do
+ case $OPT in
+ "h" ) FLG_H=1 ;;
+ esac
+done
+shift `expr $OPTIND - 1`
+
+if [ $# -eq 0 ] ; then
+ less /usr/lib64/fulcon/doc/help.txt
+else
+ . $*
+fi
+
+exit 0
--- /dev/null
+fulcon/centos7
--- /dev/null
+Fulcon/CS 0.1 Copyright (C) 2015 NIWA Hideyuki
+ Apache License Version 2.0
+
+ SUB-COMMAND :
+
+ console [ -x ] [ -n REPEAT_NUMBER] NAME
+
+ dirver-name
+
+ erase NAME ...
+ erase [-n REPEAT_NUMBER] NAME
+
+ help
+
+ image-catalog
+
+ image-name
+
+ list
+
+ net-add [-d NIC_DEVICE] [-n VETH_NUMBER] [-g GATEWAY] [-b BRIDGE] NAME IP_ADDR/MASK
+
+ net-del [-n VETH_NUMBER] NAME
+ net-del [-d NIC_DEVICE] NAME
+
+ net-info NAME
+
+ resource [-c CPU] [-n CPUSET] [-m MEM] NAME
+
+ set-default-image [ IMAGE_NAME ]
+
+ set-passwd
+
+ setup
+
+ start NAME ...
+ start [-n REPEAT_NUMBER] NAME
+
+ stop NAME ...
+ stop [-n REPEAT_NUMBER] NAME
+
+ sysgen [ -c IMAGE ] NAME NAME ...
+ sysgen [-n REPEAT_NUMBER ] [ -c IMAGE ] NAME ...
+
+ update
--- /dev/null
+FULCON driver by Docker
+
--- /dev/null
+#!/bin/sh
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+usage() {
+ echo "usage: console NAME"
+}
+
+if [ $# -ne 1 ]; then
+ usage
+ exit -1
+fi
+
+NAME=$1
+
+echo Attached $NAME"."
+echo To enter console, hit Enter.
+echo To exit console, ^p^q is pushed.
+
+docker attach $NAME
+
+exit 0
--- /dev/null
+#!/bin/bash
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+
+CPUDIR="/sys/fs/cgroup/cpu/system.slice/"
+
+if [ $# -ne 2 -a $# -ne 1 ]; then
+ echo "usage: cpu CONTAINER_NAME [VALUE]"
+ exit 1
+fi
+
+if [ ! -d $CPUDIR ]; then
+ echo "error:" $CPUDIR "is not exist"
+ exit 1
+fi
+
+ARGN=$#
+
+NAME=$1
+if [ $ARGN -eq 2 ]; then
+ VAL=$2
+ USEDCPU=`echo $VAL | \
+ awk '{if(($1 >= 1) && ($1 <= 100)){print int($1*1000)}else{print "-1"}}'`
+
+ if [ $USEDCPU -lt 0 ]; then
+ echo "error: VALUE must be [1-100]"
+ exit 1
+ fi
+fi
+
+DID=`docker-find-id $NAME`
+if [ $? -ne 0 ]; then
+ echo "error: can't find a container"
+ exit -1
+fi
+
+cd $CPUDIR
+ls docker-${DID}* >& /dev/null
+if [ $? -ne 0 ]; then
+ exit 0
+fi
+
+for i in docker-${DID}*
+do
+ if [ $ARGN -eq 2 ]; then
+ echo 100000 > $i/cpu.cfs_period_us
+ echo $USEDCPU > $i/cpu.cfs_quota_us
+ else
+ cat $i/cpu.cfs_quota_us | \
+ awk '{if ($1 <= 0)print "CPU : 100 %"; else printf "CPU : %3.1f %%\n",$1/1000}'
+ fi
+done
+exit 0
+
--- /dev/null
+#!/bin/bash
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+
+CPUSETDIR="/sys/fs/cgroup/cpuset/system.slice/"
+
+if [ $# -ne 2 -a $# -ne 1 ]; then
+ echo "usage: cpuset CONTAINER_NAME [VALUE]"
+ echo "error: VALUE must be 1 or [2-5] or [3,8]"
+ exit 1
+fi
+
+if [ ! -d $CPUSETDIR ]; then
+ echo "error:" $CPUSETDIR "is not exist"
+ exit 1
+fi
+
+ARGN=$#
+
+NAME=$1
+if [ $ARGN -eq 2 ]; then
+ VAL=$2
+fi
+
+DID=`docker-find-id $NAME`
+if [ $? -ne 0 ]; then
+ echo "error: can't find a container"
+ exit -1
+fi
+
+cd $CPUSETDIR
+ls docker-${DID}* >& /dev/null
+if [ $? -ne 0 ]; then
+ exit 0
+fi
+
+for i in docker-${DID}*
+do
+ if [ $ARGN -eq 2 ]; then
+ echo $VAL > $i/cpuset.cpus
+ else
+ cat $i/cpuset.cpus | awk '{printf "CPUSET : %s\n",$1}'
+ fi
+done
+exit 0
+
--- /dev/null
+#!/bin/bash
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+
+# check args
+if [ $# -ne 1 ]; then
+ echo "usage: find-id CONTAINER_NAME"
+ exit -1
+fi
+
+# get cgroup.procs path
+ARG1=$1
+CNAME=`docker ps | awk 'NR>1{n=split($0,a);print a[n],a[1]}' | grep -w "$ARG1" | awk '{print $2}'`
+if [ x"$CNAME" == x"" ]; then
+ echo "error: can't find container:" $1
+ exit -1
+fi
+
+CPATH=`ls -1 /sys/fs/cgroup/cpu/system.slice/docker-${CNAME}*.scope/cgroup.procs`
+if [ $? -ne 0 ]; then
+ echo "error: can't find container:" $CNAME
+ exit -1
+fi
+
+echo $CNAME
+
+exit 0
--- /dev/null
+FROM centos:centos7
+MAINTAINER NIWA Hideyuki
+
+# setup proxy
+# The first # is removed, rewrite the following "http://xxx" in proxy.
+
+#ENV http_proxy http://xxx
+#ENV https_proxy http://xxx
+#ENV ftp_proxy http://xxx
+#RUN echo "proxy=http://xxx" >> /etc/yum.conf
+
+ENV container docker
+
+# setup systemd
+RUN yum -y update; yum clean all
+RUN yum -y swap -- remove fakesystemd -- install systemd systemd-libs
+
+# enable localedef
+RUN yum -y update glibc-common
+RUN yum -y reinstall glibc-common
+
+# install packages
+RUN yum -y install net-tools yum-langpacks system-config-language perl sudo rsyslog
+
+# unused services
+RUN systemctl mask dev-mqueue.mount dev-hugepages.mount \
+ systemd-remount-fs.service sys-kernel-config.mount \
+ sys-kernel-debug.mount sys-fs-fuse-connections.mount
+RUN systemctl mask display-manager.service systemd-logind.service
+
+# install ssh
+RUN yum -y install openssh-server initscripts openssh-clients
+
+# setup ssh
+RUN printf "\nUseDNS=no\n" >> /etc/ssh/sshd_config
+RUN printf "\nGSSAPIAuthentication no\nAddressFamily inet\n" >>/etc/ssh/ssh_config
+RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
+RUN mkdir /var/run/sshd && chown root /var/run/sshd
+
+RUN yum -y remove avahi avahi-libs avahi-glib
+RUN systemctl unmask console-getty.service ; \
+ systemctl enable console-getty.service ; \
+ systemctl unmask getty.target ; \
+ true
+
+RUN systemctl disable network.service; \
+ systemctl mask rhel-dmesg.service; \
+ true
+
+# setup passwd
+RUN passwd -l root
+
+VOLUME ["/sys/fs/cgroup"]
+VOLUME ["/run"]
+
+CMD ["/usr/lib/systemd/systemd"]
--- /dev/null
+Acquire::http::proxy "http://xxx";
+Acquire::https::proxy "http://xxx";
+Acquire::ftp::proxy "http://xxx";
+
--- /dev/null
+FROM ubuntu:15.04
+MAINTAINER NIWA Hideyuki
+
+# setup proxy
+# The first # is removed, rewrite the following "http://xxx" in proxy.
+# Please rewrite in "80proxy" file similarly.
+
+#ENV http_proxy http://xxx
+#ENV https_proxy http://xxx
+#ENV ftp_proxy http://xxx
+#ADD 80proxy /etc/apt/apt.conf.d/
+
+ENV container docker
+ENV DEBIAN_FRONTEND noninteractive
+
+# install packages
+RUN apt-get update && apt-get upgrade -y
+RUN rm -f /lib/systemd/systemd
+RUN apt-get install --reinstall -y --force-yes systemd libpam-systemd \
+ libsystemd0 systemd-shim upstart upstart-bin sysv-rc sysvinit-utils
+RUN mv /sbin/initctl.distrib /sbin/initctl
+RUN apt-get install -qq -y --force-yes rsyslog apt-utils sudo vim \
+ language-pack-ja less openssh-server net-tools
+RUN update-rc.d rsyslog defaults
+RUN update-rc.d ssh defaults
+
+# setup systemd
+#RUN systemctl mask dev-mqueue.mount dev-hugepages.mount \
+# systemd-remount-fs.service \
+# sys-kernel-debug.mount sys-fs-fuse-connections.mount
+#RUN systemctl mask systemd-logind.service graphical.target
+
+
+# setup ssh
+RUN printf "\nUseDNS=no\n" >> /etc/ssh/sshd_config
+RUN printf "\nGSSAPIAuthentication no\nAddressFamily inet\n" >>/etc/ssh/ssh_config
+RUN rm -rf /etc/ssh/ssh_host_rsa_key && ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
+RUN sed -i /etc/ssh/sshd_config \
+ -e "s/PermitRootLogin without-password/PermitRootLogin yes/"
+
+# setup passwd
+RUN passwd -l root
+
+
+VOLUME ["/sys/fs/cgroup"]
+VOLUME ["/run"]
+
+ENTRYPOINT ["/sbin/init"]
+
--- /dev/null
+#!/bin/bash
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+# check options
+OPT_FLG=""
+FLG_F=0
+
+while getopts f OPT
+do
+ case $OPT in
+ "f" ) FLG_F=1; OPT_FLG=" " ;;
+ esac
+done
+
+shift `expr $OPTIND - 1`
+
+usage()
+{
+ echo "usage: erase [ -f ] NAME"
+}
+
+if [ $# -eq 1 ]; then
+ NAME=$1
+else
+ usage
+ sleep 5
+ exit -1
+fi
+
+docker ps -a | awk '(NR>1){ printf "%s\n",$NF }' | egrep $NAME >& /dev/null
+if [ $? -ne 0 ]; then
+ echo "error: can't find" $NAME
+ sleep 5
+ exit -1
+fi
+
+docker stop $NAME >& /dev/null
+docker rm $NAME >& /dev/null
+echo "erased" $NAME
+
+exit 0
+
+
--- /dev/null
+#!/bin/bash
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+
+# check args
+if [ $# -ne 1 ]; then
+ echo "usage: find-proc CONTAINER_NAME"
+ exit -1
+fi
+
+# get cgroup.procs path
+ARG1=$1
+CNAME=`docker ps | awk 'NR>1{n=split($0,a);print a[n],a[1]}' | grep -w "$ARG1" | awk '{print $2}'`
+if [ x"$CNAME" == x"" ]; then
+ echo "error: can't find container:" $1
+ exit -1
+fi
+
+CPATH=`ls -1 /sys/fs/cgroup/cpu/system.slice/docker-${CNAME}*.scope/cgroup.procs`
+if [ $? -ne 0 ]; then
+ echo "error: can't find container:" $CNAME
+ exit -1
+fi
+
+# get supervisord procs
+INITPROCS=`ps aux | egrep -v egrep | awk '{print $2}'`
+
+if [ x"$INITPROCS" == x"" ]; then
+ exit -1
+fi
+
+# search the /usr/bin/supervisord proc with container
+CPROC=""
+for i in $INITPROCS
+do
+ cat $CPATH | egrep -w $i >& /dev/null
+ if [ $? -eq 0 ]; then
+ CPROC=$i
+ break
+ fi
+done
+
+if [ x$CPROC == x"" ]; then
+ exit -1
+fi
+
+echo $CPROC
+
+exit 0
--- /dev/null
+#!/bin/bash
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+usage()
+{
+ echo "usage: list "
+}
+
+RUNNING=`docker ps | egrep "fulcon/" | awk '{printf "%s:%s\n",$NF,$2}'`
+ALLCONT=`docker ps -a | egrep "fulcon/" | awk '{printf "%s:%s\n",$NF,$2}'`
+for i in $ALLCONT
+do
+ NAME=`echo $i | awk -F ":" '{print $1}'`
+ IMAGE=`echo $i | awk -F ":" '{print $2}'`
+ echo $RUNNING | egrep -w $i >& /dev/null
+ if [ $? -eq 0 ]; then
+ printf "%s\t\tRUNNING\t\t%s\n" $NAME $IMAGE
+ else
+ printf "%s\t\tSTOPPED\t\t%s\n" $NAME $IMAGE
+ fi
+done | sort
+
+exit 0
+
+
--- /dev/null
+#!/bin/bash
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+
+MEMSETDIR="/sys/fs/cgroup/memory/system.slice/"
+
+if [ $# -ne 2 -a $# -ne 1 ]; then
+ echo "usage: mem CONTAINER_NAME [VALUE]"
+ exit 1
+fi
+
+if [ ! -d $MEMSETDIR ]; then
+ echo "error:" $MEMSETDIR "is not exist"
+ exit 1
+fi
+
+ARGN=$#
+
+NAME=$1
+if [ $ARGN -eq 2 ]; then
+ VAL=$2
+
+ USEDMEM=`echo $VAL | \
+ awk '{if($1 >= 0){print int($1*1024*1024*1024)}else{print "-1"}}'`
+
+ if [ $USEDMEM -lt 0 ]; then
+ echo "error: VALUE must be GB"
+ exit 1
+ fi
+fi
+
+DID=`docker-find-id $NAME`
+if [ $? -ne 0 ]; then
+ echo "error: can't find a container"
+ exit -1
+fi
+
+cd $MEMSETDIR
+ls docker-${DID}* >& /dev/null
+if [ $? -ne 0 ]; then
+ exit 0
+fi
+
+for i in docker-${DID}*
+do
+ if [ $ARGN -eq 2 ]; then
+ echo $USEDMEM > $i/memory.limit_in_bytes
+ else
+ cat $i/memory.limit_in_bytes | \
+ awk '{if ($1 >= 1024*1024*1024*1024*1024) print "MEMORY : - GB"; else printf "MEMORY : %4.2f GB\n",$1/1024.0/1024.0/1024.0}'
+ fi
+done
+exit 0
+
--- /dev/null
+#!/bin/bash
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+
+umask 022
+
+# function usage
+usage()
+{
+ echo "usage: net-add [ -d NETDEV ] [ -n NUMBER ] [ -g GATEWAY ] [ -b BRIDGE ] CONTAINER_NAME IPADDR/MASK "
+}
+
+# check options
+FLG_D=0 ; NETDEV=""
+FLG_N=0 ; NUM=""
+FLG_G=0 ; LXCGATEWAY=""
+FLG_B=0 ; LXCBR="fulcon-br0"
+
+while getopts d:n:g:b: OPT ; do
+ case $OPT in
+ d) FLG_D=1 ; NETDEV=$OPTARG ;;
+ n) FLG_N=1 ; NUM=$OPTARG ;;
+ g) FLG_G=1 ; LXCGATEWAY=$OPTARG ;;
+ b) FLG_B=1 ; LXCBR=$OPTARG ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+# check args
+if [ $# -ne 2 ]; then
+ usage
+ exit -1
+fi
+
+LXCNAME=$1
+LXCBRIP=`net-ipv4 -g $2`
+if [ $? -ne 0 ]; then
+ echo $2 "must be IP_address/Mask format"
+ exit -1
+fi
+
+LXCIP=`echo $2 | awk -F / '{printf "%s",$1}'`
+LXCMASK=`echo $2 | awk -F / '{printf "%s",$2}'`
+
+if [ x$LXCGATEWAY == x"" ]; then
+ LXCGATEWAY=$LXCBRIP
+fi
+
+if [ x$NETDEV != x"" ]; then
+ LXCBRIP=`ip a show $NETDEV | awk 'NR==3{print $2}' | awk -F / '{print $1}'`
+ DEVMASK=`ip a show $NETDEV | awk 'NR==3{print $2}' | awk -F / '{print $2}'`
+ if [ x$DEVMASK != x$LXCMASK ]; then
+ echo "error: netmask(/$DEVMASK) of NIC is not corresponding to netmask(/$LXCMASK) of IP address"
+ exit -1
+ fi
+fi
+
+LXCPROC=`find-proc ${LXCNAME}`
+if [ $? -ne 0 ]; then
+ echo "error: can't find" ${LXCNAME}
+ exit -1
+fi
+
+set_ipaddr()
+{
+ mkdir -p /var/run/netns/
+ ln -s /proc/${LXCPROC}/ns/net /var/run/netns/${LXCNAME}${NUM}
+
+ ip link delete ${LXCNAME}${NUM} type veth >& /dev/null
+
+ ip link add name ${LXCNAME}${NUM} type veth peer name vg${LXCNAME}${NUM} >& /dev/null
+ ip link set ${LXCNAME}${NUM} up
+
+ brctl show $LXCBR |& egrep 'No such device' >& /dev/null
+ if [ $? -eq 0 ]; then
+ brctl addbr $LXCBR
+ ip link set $LXCBR up
+ ip addr add ${LXCBRIP}/${LXCMASK} dev $LXCBR
+ fi
+ brctl addif $LXCBR ${LXCNAME}${NUM} >& /dev/null
+
+ # setting up of IP address
+ LXCFBROADCAST=`net-ipv4 -b "${LXCIP}/${LXCMASK}"`
+ ip link set vg${LXCNAME}${NUM} netns ${LXCNAME}${NUM}
+
+ # Setting of network in container
+ ip netns exec ${LXCNAME}${NUM} ip link set vg${LXCNAME}${NUM} up
+ IPFLG=""
+ while [ x${IPFLG} == x"inet6" -o x${IPFLG} != x"inet" ];
+ do
+ IPFLG=`ip netns exec "${LXCNAME}${NUM}" ip addr show vg${LXCNAME}${NUM} | awk 'NR==3{print $1}'`
+ ip netns exec "${LXCNAME}${NUM}" ip addr add ${LXCIP}/${LXCMASK} dev vg${LXCNAME}${NUM} broadcast $LXCFBROADCAST >& /dev/null
+ OLDIPADR=`ip netns exec "${LXCNAME}${NUM}" ip addr show vg${LXCNAME}${NUM} | awk 'NR==3{print $2}'`
+ sleep 1
+ done
+ while [ x${OLDIPADR} != x${LXCIP}/${LXCMASK} ];
+ do
+ OLDIPADR=`ip netns exec "${LXCNAME}${NUM}" ip addr show vg${LXCNAME}${NUM} | awk 'NR==3{print $2}'`
+ if [ x${OLDIPADR} != x${LXCIP}/${LXCMASK} ]; then
+ ip netns exec ${LXCNAME}${NUM} ip addr del ${OLDIPADR} dev vg${LXCNAME}${NUM}
+ ip netns exec ${LXCNAME}${NUM} ip addr add ${LXCIP}/${LXCMASK} dev vg${LXCNAME}${NUM} broadcast $LXCFBROADCAST >& /dev/null
+ fi
+ sleep 1
+ done
+
+ # setting up of gateway
+ if [ x$LXCGATEWAY != x"" ]; then
+ ip netns exec ${LXCNAME}${NUM} ip route delete default >& /dev/null
+ IPADDR=$LXCGATEWAY
+ IPMASK=$LXCMASK
+ ip netns exec ${LXCNAME}${NUM} ip route add default via ${IPADDR}
+ fi
+
+ rm -f /var/run/netns/${LXCNAME}${NUM}
+
+ if [ x$NETDEV != x"" ]; then
+ # setting of promiscuous mode
+ ip link set $NETDEV promisc on
+
+ brctl show $LXCBR | egrep -w $NETDEV >& /dev/null
+ if [ $? -ne 0 ]; then
+ brctl addif $LXCBR $NETDEV
+ fi
+ fi
+}
+
+set_ipaddr
+
+echo "${LXCNAME}${NUM} ${LXCIP}/${IPMASK}"
+
+exit 0
--- /dev/null
+#!/bin/bash
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+
+# check root
+if [ ${EUID:-${UID}} != 0 ]; then
+ echo "error: Because you are not root, you cannot execute this command. "
+ exit 1
+fi
+
+# check options
+FLG_N=0 ; NUM=""
+FLG_D=0 ; DEV=""
+
+while getopts n:d: OPT ; do
+ case $OPT in
+ n) FLG_N=1 ; NUM=$OPTARG ;;
+ d) FLG_D=1 ; DEV=$OPTARG ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+usage()
+{
+ echo "usage: net-del [ -n NUMBER ] CONTAINER_NAME"
+ echo "usage: net-del [ -d DEVICE ] "
+}
+
+# check args
+if [ $FLG_D -eq 1 -a $# -ne 0 ]; then
+ usage
+ exit -1
+fi
+if [ $FLG_D -ne 1 -a $# -ne 1 ]; then
+ usage
+ exit -1
+
+fi
+
+if [ $FLG_D -eq 1 -a $FLG_N -eq 1 ]; then
+ usage
+ exit -1
+fi
+
+
+if [ $FLG_D -eq 1 ]; then
+ ip link delete $DEV type veth
+ echo "deleted" $DEV
+else
+ LXCNAME=$1
+ brctl show |& egrep ${LXCNAME}${NUM} >& /dev/null
+ if [ $? -ne 0 ]; then
+ echo "error: can't find" vh${LXCNAME}${NUM}
+ exit -1
+ fi
+ ip link delete ${LXCNAME}${NUM} type veth
+ echo "deleted" ${LXCNAME}${NUM}
+fi
+
+exit 0
--- /dev/null
+#!/bin/bash
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+
+# check root
+if [ ${EUID:-${UID}} != 0 ]; then
+ echo "error: Because you are not root, you cannot execute this command. "
+ exit 1
+fi
+
+# check args
+if [ $# -ne 2 ]; then
+ echo "usage: net-gateway CONTAINER_NAME IP_ADDR"
+ exit -1
+fi
+
+LXCNAME=$1
+LXCGATEWAY=$2
+
+brctl show |& egrep ${LXCNAME} >& /dev/null
+if [ $? -ne 0 ]; then
+ echo "error: can't find" ${LXCNAME}
+ exit -1
+fi
+
+LXCPROC=`docker-find ${LXCNAME}`
+if [ $? -ne 0 ]; then
+ echo "error: can't find" ${LXCNAME}
+ exit -1
+fi
+
+mkdir -p /var/run/netns/
+ln -s /proc/${LXCPROC}/ns/net /var/run/netns/${LXCNAME}
+
+# setting up of gateway
+if [ x$LXCGATEWAY != x"" ]; then
+ ip netns exec ${LXCNAME} ip route del default
+ IPADDR=$LXCGATEWAY
+ ip netns exec ${LXCNAME} ip route add default via ${IPADDR}
+fi
+
+rm -f /var/run/netns/${LXCNAME}
+
+exit 0
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+
+import sys
+import IPy
+from optparse import OptionParser
+
+# check args
+parser = OptionParser()
+parser.add_option("-n", "--number", action="store_true", default=False,
+ dest="ipnum", help="exchange number")
+parser.add_option("-b", "--broadcast", action="store_true", default=False,
+ dest="ipbroadcast", help="ip broadcast")
+parser.add_option("-m", "--mask", action="store_true", default=False,
+ dest="ipmask", help="ip mask")
+parser.add_option("-g", "--gateway", action="store_true", default=False,
+ dest="ipgw", help="ip gateway")
+(options, args) = parser.parse_args(sys.argv)
+
+if len(args) != 2:
+ print("usage: net-ipv4 [ -n ] [ -b ] [ -m ] [ -g ] IP-ADDR/MASK")
+ sys.exit(1)
+
+# get args
+ipstr = args[1]
+ipary = ipstr.split("/")
+try:
+ ip = IPy.IP(ipary[0])
+ mask = int(ipary[1])
+except:
+ print("error: illegal format(xxx.xxx.xxx.xxx/nn) "+ipstr)
+ sys.exit(1)
+
+if (mask < 0) or (mask >32):
+ print("error: illegal mask "+mask)
+ sys.exit(1)
+
+# make bit masks
+bnetmask = 0xffffffff
+for i in range(32-mask):
+ bnetmask = bnetmask << 1
+
+netmask = (bnetmask ^ 0xffffffff) & 0xffffffff
+
+# option -n
+if options.ipnum:
+ print ip.int()
+
+# option -b
+if options.ipbroadcast:
+ print IPy.IP((ip.int() | netmask) & 0xffffffff)
+
+# option -m
+if options.ipmask:
+ print IPy.IP((ip.int() & bnetmask) & 0xffffffff)
+
+# option -g
+if options.ipgw:
+ print IPy.IP((ip.int() & bnetmask | 1) & 0xffffffff)
+
+sys.exit(0)
--- /dev/null
+#!/bin/bash
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+
+# check root
+if [ ${EUID:-${UID}} != 0 ]; then
+ echo "error: Because you are not root, you cannot execute this command. "
+ exit 1
+fi
+
+# check options
+FLG_N=0 ; NUM=""
+
+while getopts n: OPT ; do
+ case $OPT in
+ n) FLG_N=1 ; NUM=$OPTARG ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+if [ $# -ne 3 ]; then
+ echo "usage: net-route-add [ -n NUMBER ] CONTAINER_NAME NET_ADDR GATEWAY"
+ exit -1
+fi
+
+LXCNAME=$1
+NET_ADDR=$2
+LXCGATEWAY=$3
+
+brctl show |& egrep ${LXCNAME} >& /dev/null
+if [ $? -ne 0 ]; then
+ echo "error: can't find" ${LXCNAME}
+ exit -1
+fi
+
+LXCPROC=`docker-find ${LXCNAME}`
+if [ $? -ne 0 ]; then
+ echo "error: can't find" ${LXCNAME}
+ exit -1
+fi
+
+mkdir -p /var/run/netns/
+ln -s /proc/${LXCPROC}/ns/net /var/run/netns/${LXCNAME}
+
+# setting up of gateway
+if [ x$LXCGATEWAY != x"" ]; then
+ ip netns exec ${LXCNAME} ip route add $NET_ADDR via $LXCGATEWAY dev vg${LXCNAME}${NUM}
+fi
+
+rm -f /var/run/netns/${LXCNAME}
+
+exit 0
--- /dev/null
+#!/bin/bash
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+
+# check root
+if [ ${EUID:-${UID}} != 0 ]; then
+ echo "error: Because you are not root, you cannot execute this command. "
+ exit 1
+fi
+
+if [ $# -ne 2 ]; then
+ echo "usage: net-route-del CONTAINER_NAME NET_ADDR "
+ exit -1
+fi
+
+LXCNAME=$1
+NET_ADDR=$2
+
+brctl show |& egrep ${LXCNAME} >& /dev/null
+if [ $? -ne 0 ]; then
+ echo "error: can't find" ${LXCNAME}
+ exit -1
+fi
+
+LXCPROC=`docker-find ${LXCNAME}`
+if [ $? -ne 0 ]; then
+ echo "error: can't find" ${LXCNAME}
+ exit -1
+fi
+
+mkdir -p /var/run/netns/
+ln -s /proc/${LXCPROC}/ns/net /var/run/netns/${LXCNAME}
+
+# delete a routing table
+ip netns exec ${LXCNAME} ip route del $NET_ADDR
+
+rm -f /var/run/netns/${LXCNAME}
+
+exit 0
--- /dev/null
+#!/bin/bash
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+
+# check root
+if [ ${EUID:-${UID}} != 0 ]; then
+ echo "error: Because you are not root, you cannot execute this command. "
+ exit 1
+fi
+
+usage()
+{
+ echo "usage: set-passwd NAME USER"
+}
+
+if [ $# -ne 2 ]; then
+ usage
+ exit -1
+fi
+
+LXCNAME=$1
+USERNAME=$2
+docker exec -it $LXCNAME /usr/bin/passwd $USERNAME
+
+exit 0
--- /dev/null
+#!/bin/bash
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+
+# check root
+if [ ${EUID:-${UID}} != 0 ]; then
+ echo "error: Because you are not root, you cannot execute this command. "
+ exit 1
+fi
+
+usage()
+{
+ echo "usage: set-user NAME USER"
+}
+
+if [ $# -ne 2 ]; then
+ usage
+ exit -1
+fi
+
+LXCNAME=$1
+USERNAME=$2
+docker exec -it $LXCNAME useradd -m $USERNAME
+if [ $? -ne 0 ]; then
+ echo "error: set-user is failed"
+ exit -1
+fi
+
+docker exec -it $LXCNAME mkdir -p /etc/sudoers.d
+SUDOERS_LINE="echo $USERNAME ALL\=\(ALL\) ALL > /etc/sudoers.d/$USERNAME"
+docker exec -it $LXCNAME /bin/sh -c "$SUDOERS_LINE"
+docker exec -it $LXCNAME chmod 440 /etc/sudoers.d/$USERNAME
+docker exec -it $LXCNAME passwd $USERNAME
+
+
+
+exit 0
--- /dev/null
+#!/bin/bash
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+DOCKERFILEDIR=/var/lib/fulcon/driver/dockerfile
+
+ls $DOCKERFILEDIR/*
+if [ $? -ne 0 ]; then
+ echo "Dockerfile is not exist"
+ exit 0
+fi
+
+cd $DOCKERFILEDIR
+for i in *
+do
+ cd $i
+ echo docker build -t fulcon/$i .
+ docker build -t fulcon/$i .
+ echo
+ echo
+ cd ..
+done
+
--- /dev/null
+#!/bin/bash
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+# check options
+OPT_FLG=""
+FLG_I=0
+
+while getopts i OPT
+do
+ case $OPT in
+ "i" ) FLG_I=1; OPT_FLG="-i " ;;
+ esac
+done
+
+shift `expr $OPTIND - 1`
+
+usage()
+{
+ echo "usage: start [ -i ] NAME"
+}
+
+if [ $# -eq 1 ]; then
+ NAME=$1
+else
+ usage
+ sleep 5
+ exit -1
+fi
+
+docker ps | awk '(NR>1){ printf "%s\n",$NF }' | egrep $NAME >& /dev/null
+if [ $? -eq 0 ]; then
+ echo "error: already started" $NAME
+ sleep 5
+ exit -1
+fi
+
+docker ps -a | awk '(NR>1){ printf "%s\n",$NF }' | egrep $NAME >& /dev/null
+if [ $? -ne 0 ]; then
+ echo "error: can't find" $NAME
+ sleep 5
+ exit -1
+fi
+
+echo "started" $NAME
+
+docker start $OPT_FLG $NAME
+
+exit 0
+
+
--- /dev/null
+#!/bin/bash
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+# check options
+OPT_FLG=""
+FLG_F=0
+
+while getopts f OPT
+do
+ case $OPT in
+ "f" ) FLG_F=1; OPT_FLG=" " ;;
+ esac
+done
+
+shift `expr $OPTIND - 1`
+
+usage()
+{
+ echo "usage: stop [ -f ] NAME"
+}
+
+if [ $# -eq 1 ]; then
+ NAME=$1
+else
+ usage
+ exit -1
+fi
+
+docker ps | awk '(NR>1){ printf "%s\n",$NF }' | egrep $NAME >& /dev/null
+if [ $? -ne 0 ]; then
+ echo "error: can't find" $NAME
+ exit -1
+fi
+
+docker ps -a | awk '(NR>1){ printf "%s\n",$NF }' | egrep $NAME >& /dev/null
+if [ $? -ne 0 ]; then
+ echo "error: can't find" $NAME
+ exit -1
+fi
+
+docker stop $NAME >& /dev/null
+
+echo "stopped" $NAME
+exit 0
+
+
--- /dev/null
+#!/bin/bash
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+# check options
+FLG_I=0
+
+while getopts i OPT
+do
+ case $OPT in
+ "i" ) FLG_I=1;;
+ esac
+done
+
+shift `expr $OPTIND - 1`
+
+usage()
+{
+ echo "usage: sysgen [ -i ] NAME IMAGE"
+}
+
+if [ $# -eq 2 ]; then
+ NAME=$1
+else
+ usage
+ sleep 5
+ exit -1
+fi
+
+IMAGE=$2
+
+docker ps | awk '(NR>1){ printf "%s\n",$NF }' | egrep $NAME >& /dev/null
+if [ $? -eq 0 ]; then
+ echo "error: already started" $NAME
+ sleep 5
+ exit -1
+fi
+
+docker ps -a | awk '(NR>1){ printf "%s\n",$NF }' | egrep $NAME >& /dev/null
+if [ $? -eq 0 ]; then
+ echo "error: already existed" $NAME
+ sleep 5
+ exit -1
+fi
+
+CPUSET=`cat /sys/fs/cgroup/cpuset/cpuset.cpus`
+OPTCPUSET=`docker run --help | egrep '\-\-cpuset' | egrep -v mem | awk '{print $1}' | awk -F '=' '{print $1}'`
+
+start_docker() {
+ docker run -it ${OPTCPUSET}=${CPUSET} -c 100 -m 512m \
+ --name $NAME --hostname $NAME \
+ -v /sys/fs/cgroup:/sys/fs/cgroup:ro \
+ --cap-drop=ALL \
+ --cap-add=AUDIT_CONTROL \
+ --cap-add=AUDIT_WRITE \
+ --cap-add=BLOCK_SUSPEND \
+ --cap-add=CHOWN \
+ --cap-add=DAC_OVERRIDE \
+ --cap-add=DAC_READ_SEARCH \
+ --cap-add=FOWNER \
+ --cap-add=FSETID \
+ --cap-add=IPC_LOCK \
+ --cap-add=IPC_OWNER \
+ --cap-add=KILL \
+ --cap-add=LEASE \
+ --cap-add=LINUX_IMMUTABLE \
+ --cap-add=MAC_ADMIN \
+ --cap-add=MAC_OVERRIDE \
+ --cap-add=MKNOD \
+ --cap-add=NET_ADMIN \
+ --cap-add=NET_BIND_SERVICE \
+ --cap-add=NET_BROADCAST \
+ --cap-add=NET_RAW \
+ --cap-add=SETFCAP \
+ --cap-add=SETGID \
+ --cap-add=SETPCAP \
+ --cap-add=SETUID \
+ --cap-add=SYS_ADMIN \
+ --cap-add=SYS_BOOT \
+ --cap-add=SYS_CHROOT \
+ --cap-add=SYS_MODULE \
+ --cap-add=SYS_NICE \
+ --cap-add=SYS_PACCT \
+ --cap-add=SYS_PTRACE \
+ --cap-add=SYS_RAWIO \
+ --cap-add=SYS_RESOURCE \
+ --cap-add=SYS_TIME \
+ --cap-add=SYS_TTY_CONFIG \
+ --cap-add=SYSLOG \
+ --cap-add=WAKE_ALARM \
+ --privileged \
+ $IMAGE /sbin/init
+}
+
+if [ $FLG_I -eq 1 ]; then
+ start_docker
+else
+ start_docker < /dev/tty >& /dev/null &
+ stty sane
+ echo "sysgened:" $NAME
+fi
+
+exit 0
+
+
--- /dev/null
+#!/bin/sh
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+usage() {
+ echo "usage: update [ IMAGE [ PACKAGE ... ] ]"
+}
+
+update_ubuntu_all() {
+ NAMES=`fulcon list | egrep ubuntu | awk '{print $1}'`
+ if [ x"$NAMES" != x"" ]; then
+ for i in $NAMES
+ do
+ echo "update" $i
+ docker exec -it $i apt-get update
+ docker exec -it $i apt-get upgrade
+ echo
+ echo
+ done
+ fi
+}
+
+update_centos_all() {
+ NAMES=`fulcon list | egrep centos | awk '{print $1}'`
+ if [ x"$NAMES" != x"" ]; then
+ for i in $NAMES
+ do
+ echo "update" $i
+ docker exec -it $i /usr/bin/yum update -y
+ echo
+ echo
+ done
+ fi
+}
+
+update_ubuntu_all
+update_centos_all
+exit
+
+if [ $# -eq 1 ]; then
+ if [ x"$1" == x"update" ]; then
+ update_ubuntu_all
+ update_centos_all
+ exit 0
+ fi
+fi
+
+IMAGE=$1
+
--- /dev/null
+FULCON driver by runC
+
--- /dev/null
+# spec file for lxcf
+
+Summary: Generate the full container and management it
+License: Apache 2.0
+Name: fulcon
+Version: 0.1
+Release: 1%{?dist}
+Source0: http://downloads.sourceforge.net/lxcfacility/source/%{name}-%{version}.tar.gz
+URL: https://sourceforge.net/projects/lxcfacility/
+Requires: libvirt-daemon-driver-lxc
+Requires: python-IPy
+
+%description
+LXCF efficiently makes the instance. One-instance making is a few
+minutes or less.
+The LXCF instance can dynamically change the resource of CPU, MEMORY,
+IO and NET. Even if the instance has stopped, the change in the resource
+can be changed.
+LXCF can be used by installing it on Linux on VM as well as bare metal.
+LXCF can be operated stabilizing the job like a past system at a long term.
+Moreover, a lot of LXCF instances are generate in a short time. If a lot
+of LXCF instances become unnecessary, it is possible to delete it
+collectively. Such stateless instance can be operated.
+
+%prep
+%setup -q
+
+%build
+CFLAGS=$RPM_OPT_FLAGS ; export CFLAGS
+LDFLAGS=$RPM_OPT_FLAGS ; export LDFLAGS
+make %{?_smp_mflags} libdir=%_libdir
+
+%install
+make install libdir=%_libdir DESTDIR=$RPM_BUILD_ROOT
+
+%preun
+%systemd_preun libvirtd.service
+%systemd_preun lxcf.service
+%systemd_preun lxcf-sched.service
+%systemd_preun lxcf-api.service
+
+%post
+systemctl restart libvirtd
+%{_libdir}/lxcf/lxcf-init
+%systemd_post lxcf.service
+%systemd_post lxcf-sched.service
+%systemd_post lxcf-api.service
+
+%postun
+systemctl restart libvirtd
+
+%files
+%{_sbindir}/lxcf
+%{_libdir}/lxcf/
+%config(noreplace) %{_sysconfdir}/lxcf/
+%{_sysconfdir}/libvirt/hooks/lxc
+%{_sysconfdir}/libvirt/hooks/qemu
+%config(noreplace) %{_sysconfdir}/libvirt/qemu/networks/lxcfnet1.xml
+%{_sysconfdir}/libvirt/qemu/networks/autostart/lxcfnet1.xml
+%{_unitdir}/lxcf.service
+%{_unitdir}/lxcf-sched.service
+%{_unitdir}/lxcf-api.service
+%{_var}/lib/libvirt/network/lxcfnet1.xml
+%{_mandir}/man1/lxcf.1.gz
+%{_defaultdocdir}/lxcf-%{version}/
+%doc README COPYING ChangeLog AUTHORS example
+
+%changelog
+* Fri Nov 14 2014 NIWA Hideyuki <niwa.hideyuki@jp.fujitsu.com> - 0.11-1
+- New Build. update to release 0.11-1
+
+* Thu Sep 25 2014 NIWA Hideyuki <niwa.hideyuki@jp.fujitsu.com> - 0.10-1
+- New Build. update to release 0.10-1
+
+* Wed Jul 30 2014 NIWA Hideyuki <niwa.hideyuki@jp.fujitsu.com> - 0.9-1
+- New Build. update to release 0.9-1
+
+* Fri Jul 4 2014 NIWA Hideyuki <niwa.hideyuki@jp.fujitsu.com> - 0.8-1
+- New Build. update to release 0.8-1
+
+* Fri Jun 13 2014 NIWA Hideyuki <niwa.hideyuki@jp.fujitsu.com> - 0.7-1
+- New Build. update to release 0.7-1
+
+* Sat May 24 2014 NIWA Hideyuki <niwa.hideyuki@jp.fujitsu.com> - 0.6-1
+- New Build. update to release 0.6-1
+
+* Fri May 02 2014 NIWA Hideyuki <niwa.hideyuki@jp.fujitsu.com> - 0.5-3
+- Cleanup of specfile. update to release 0.5-3
+
+* Thu Apr 17 2014 NIWA Hideyuki <niwa.hideyuki@jp.fujitsu.com> - 0.5-2
+- changelog of specfile is renewed. update to release 0.5-2
+
+* Tue Apr 15 2014 NIWA Hideyuki <niwa.hideyuki@jp.fujitsu.com> - 0.5-1
+- New Build. update to release 0.5-1
+
+* Wed Apr 02 2014 NIWA Hideyuki <niwa.hideyuki@jp.fujitsu.com> - 0.4-1
+- New Build. update to release 0.4-1
+
+* Wed Feb 19 2014 NIWA Hideyuki <niwa.hideyuki@jp.fujitsu.com> - 0.3-1
+- New Build. update to release 0.3-1
+
+* Sat Feb 08 2014 NIWA Hideyuki <niwa.hideyuki@jp.fujitsu.com> - 0.2-1
+- New Build. update to release 0.2-1
+
+* Tue Feb 04 2014 NIWA Hideyuki <niwa.hideyuki@jp.fujitsu.com> - 0.1-3
+- New Build. update to release 0.1-3
+
+* Tue Dec 17 2013 NIWA Hideyuki <niwa.hideyuki@jp.fujitsu.com> - 0.1
+- New Build. First release 0.1
--- /dev/null
+#!/bin/sh
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+FULCONDRIVER=`driver-name`
+PATH=/usr/lib64/fulcon/driver/$FULCONDRIVER:$PATH
+
+
+# check options
+FLG_X=0
+FLG_N=0
+RNUM=0
+
+while getopts xn: OPT
+do
+ case $OPT in
+ "x" ) FLG_X=1 ; FLG_I=1;;
+ "n" ) FLG_N=1 ; RNUM=$OPTARG ;;
+ esac
+done
+
+shift `expr $OPTIND - 1`
+
+usage() {
+ echo "usage: console [ -x ] [ -n REPEAT_NUMBER] NAME"
+}
+
+if [ $FLG_N -eq 1 ]; then
+ if [ $# -ne 1 ]; then
+ usage
+ exit -1
+ fi
+ NAME=$1
+ if [ $RNUM -gt 0 -a $RNUM -lt 1000 ]; then
+ for i in `seq $RNUM`
+ do
+ N=`printf "%04d" $i`
+ gnome-terminal -e "console $NAME$N"
+ done;
+ exit 0
+ else
+ echo "REPEAT_NUMBER must be [1...999]"
+ exit -1
+ fi
+
+fi
+
+if [ $# -ne 1 ]; then
+ usage
+ exit -1
+fi
+
+NAMES=$@
+
+if [ x"$NAMES" == x"console" ]; then
+ usage
+ exit -1
+fi
+
+for i in $NAMES
+do
+ if [ $FLG_X -eq 0 ]; then
+ console $i
+ else
+ gnome-terminal -e "console $i"
+ fi
+done
+
+exit 0
--- /dev/null
+#!/bin/bash
+
+echo "docker"
+
--- /dev/null
+#!/bin/bash
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+FULCONDRIVER=`driver-name`
+PATH=/usr/lib64/fulcon/driver/$FULCONDRIVER:$PATH
+
+# check options
+OPT_FLG=""
+FLG_N=0
+RNUM=0
+
+while getopts n: OPT
+do
+ case $OPT in
+ "n" ) FLG_N=1; RNUM=$OPTARG;;
+ esac
+done
+
+shift `expr $OPTIND - 1`
+
+usage()
+{
+ echo "usage: erase NAME ..."
+ echo "usage: erase [-n REPEAT_NUMBER] NAME"
+}
+
+if [ $FLG_N -eq 1 ]; then
+ if [ $# -ne 1 ]; then
+ usage
+ exit -1
+ fi
+ NAME=$1
+ if [ $RNUM -gt 0 -a $RNUM -lt 1000 ]; then
+ for i in `seq $RNUM`
+ do
+ N=`printf "%04d" $i`
+ erase $NAME$N
+ rm -rf $FULCONDIR/container/$NAME$N
+ done;
+ exit 0
+ else
+ echo "REPEAT_NUMBER must be [1...999]"
+ exit -1
+ fi
+
+fi
+
+if [ $# -ge 1 ]; then
+ NAMES=$@
+else
+ usage
+ exit -1
+fi
+
+if [ x"$NAMES" == x"erase" ]; then
+ usage
+ exit -1
+fi
+
+for i in $NAMES
+do
+ erase $OPT_FLG$i
+ rm -rf $FULCONDIR/container/$OPT_FLG$i
+done
+
+exit 0
+
+
--- /dev/null
+#!/bin/bash
+
+less /usr/lib64/fulcon/doc/help.txt
+
+exit 0
+
--- /dev/null
+#!/bin/bash
+
+ls /var/lib/fulcon/driver/dockerfile/* >& /dev/null
+if [ $? -ne 0 ]; then
+ echo "there is not a image"
+ exit -1
+fi
+
+usage() {
+ echo "usage: image-catalog"
+}
+
+if [ $# -ne 1 ]; then
+ usage
+ exit -1
+fi
+
+if [ x"$1" != x"image-catalog" ]; then
+ usage
+ exit -1
+fi
+
+cd /var/lib/fulcon/driver/dockerfile
+
+for i in *
+do
+ echo "fulcon/"$i
+done
+
+exit 0
+
--- /dev/null
+#!/bin/bash
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+cat /var/lib/fulcon/default-image
+
+exit 0
--- /dev/null
+#!/bin/bash
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+FULCONDRIVER=`driver-name`
+PATH=/usr/lib64/fulcon/driver/$FULCONDRIVER:$PATH
+
+NUMOFARGS=$#
+
+usage()
+{
+ echo "usage: list "
+}
+
+if [ $NUMOFARGS -ne 1 ]; then
+ usage
+ exit -1
+fi
+
+if [ x"$1" == x"list" ]; then
+ list
+else
+ usage
+ exit -1
+fi
+
+exit 0
+
+
--- /dev/null
+#!/bin/bash
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+FULCONDRIVER=`driver-name`
+PATH=/usr/lib64/fulcon/driver/$FULCONDRIVER:$PATH
+
+NETARGS=$@
+
+# check options
+FLG_D=0 ; NETDEV=""
+FLG_N=0 ; NUM=""
+FLG_G=0 ; LXCGATEWAY=""
+FLG_B=0 ; LXCBR="fulcon-br0"
+
+while getopts d:n:g:b: OPT ; do
+ case $OPT in
+ d) FLG_D=1 ; NETDEV=$OPTARG ;;
+ n) FLG_N=1 ; NUM=$OPTARG ;;
+ g) FLG_G=1 ; LXCGATEWAY=$OPTARG ;;
+ b) FLG_B=1 ; LXCBR=$OPTARG ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+if [ $# -eq 2 ]; then
+ CNAME=$1
+fi
+
+net-add $NETARGS
+
+if [ $? -eq 0 ]; then
+ mkdir -p $FULCONDIR/container/$CNAME/net
+ echo "net-add" $NETARGS > $FULCONDIR/container/$CNAME/net/$CNAME$NUM
+ chmod 755 $FULCONDIR/container/$CNAME/net/$CNAME$NUM
+fi
+
+exit 0
--- /dev/null
+#!/bin/bash
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+FULCONDRIVER=`driver-name`
+PATH=/usr/lib64/fulcon/driver/$FULCONDRIVER:$PATH
+
+NETARGS=$@
+
+# check options
+FLG_N=0 ; NUM=""
+FLG_D=0 ; DEV=""
+
+while getopts n:d: OPT ; do
+ case $OPT in
+ n) FLG_N=1 ; NUM=$OPTARG ;;
+ d) FLG_D=1 ; DEV=$OPTARG ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+if [ $# -ne 1 ]; then
+ usage
+ exit -1
+fi
+
+CNAME=$1
+net-del $NETARGS
+
+if [ $? -eq 0 ]; then
+ rm -f $FULCONDIR/container/$CNAME/net/$CNAME$NUM
+fi
+
+exit 0
+
+
--- /dev/null
+#!/bin/bash
+
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+usage()
+{
+ echo "net-info NAME"
+}
+
+if [ $# -ne 1 ]; then
+ usage
+ exit -1
+fi
+
+CNAME=$1
+
+if [ x"$CNAME" == x"net-info" ]; then
+ ls $FULCONDIR/container/*/net/* >& /dev/null
+ if [ $? -eq 0 ]; then
+ cat $FULCONDIR/container/*/net/*
+ fi
+ exit 0
+fi
+
+ls $FULCONDIR/container/$CNAME/net/* >& /dev/null
+if [ $? -eq 0 ]; then
+ cat $FULCONDIR/container/$CNAME/net/*
+fi
+
+exit 0
--- /dev/null
+#!/bin/sh
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+FULCONDRIVER=`driver-name`
+PATH=/usr/lib64/fulcon/driver/$FULCONDRIVER:$PATH
+
+# check options
+FLG_C=0; CPU=""
+FLG_N=0; CPUSET=""
+FLG_M=0; MEM=""
+
+while getopts c:m:n: OPT
+do
+ case $OPT in
+ "c" ) FLG_C=1 ; CPU=$OPTARG ;;
+ "m" ) FLG_M=1 ; MEM=$OPTARG ;;
+ "n" ) FLG_N=1 ; CPUSET=$OPTARG ;;
+ esac
+done
+
+shift `expr $OPTIND - 1`
+
+usage() {
+ echo "usage: resource [-c CPU] [-n CPUSET] [-m MEM] NAME "
+}
+
+if [ $# -ne 1 ]; then
+ usage
+ exit -1
+fi
+
+if [ x"$1" == x"resource" ]; then
+ usage
+ exit -1
+fi
+
+CNAME=$1
+
+if [ $FLG_C -eq 1 ]; then
+ cpu $CNAME $CPU
+fi
+
+if [ $FLG_M -eq 1 ]; then
+ cpuset $CNAME $CPUSET
+fi
+
+if [ $FLG_M -eq 1 ]; then
+ mem $CNAME $MEM
+fi
+
+cpu $CNAME
+cpuset $CNAME
+mem $CNAME
+
+exit 0
+
--- /dev/null
+#!/bin/bash
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+if [ $# -eq 1 ]; then
+ if [ x"$1" == x"set-default-image" ]; then
+ echo image catalog:
+ fulcon image-catalog
+ echo
+ read -p "image name : " NAME
+ else
+ NAME=$1
+ fi
+fi
+
+fulcon image-catalog | awk 'BEGIN{r=-1}{if ($1 == "'$NAME'") r=0}END{exit(r)}'
+if [ $? -eq 0 ]; then
+ echo "set" $NAME
+ echo "$NAME" > /var/lib/fulcon/default-image
+else
+ echo "error: it is not an effective image:" $NAME
+ exit -1
+fi
+
+exit 0
+
+
--- /dev/null
+#!/bin/bash
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+FULCONDRIVER=`driver-name`
+PATH=/usr/lib64/fulcon/driver/$FULCONDRIVER:$PATH
+
+usage() {
+ echo "usage: set-passwd NAME USER"
+}
+
+if [ $# -ne 2 ]; then
+ usage
+ exit -1
+fi
+
+if [ x"$1" == x"set-passwd" ]; then
+ usage
+ exit -1
+fi
+
+. set-passwd $@
+
+exit 0
+
+
--- /dev/null
+#!/bin/bash
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+FULCONDRIVER=`driver-name`
+PATH=/usr/lib64/fulcon/driver/$FULCONDRIVER:$PATH
+
+usage() {
+ echo "usage: set-user NAME USER"
+}
+
+if [ $# -ne 2 ]; then
+ usage
+ exit -1
+fi
+
+if [ x"$1" == x"set-user" ]; then
+ usage
+ exit -1
+fi
+
+. set-user $@
+
+exit 0
+
+
--- /dev/null
+#!/bin/sh
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+FULCONDRIVER=`driver-name`
+PATH=/usr/lib64/fulcon/driver/$FULCONDRIVER:$PATH
+
+usage() {
+ echo "usage: setup"
+}
+
+if [ $# -ne 1 ]; then
+ usage
+ exit -1
+fi
+
+if [ x"$1" != x"setup" ]; then
+ usage
+ exit -1
+fi
+
+. setup $@
+
+exit 0
--- /dev/null
+#!/bin/bash
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+FULCONDRIVER=`driver-name`
+PATH=/usr/lib64/fulcon/driver/$FULCONDRIVER:$PATH
+
+# check options
+OPT_FLG=""
+FLG_I=0
+FLG_X=0
+FLG_N=0
+RNUM=0
+
+while getopts ixn: OPT
+do
+ case $OPT in
+ "i" ) FLG_I=1 ; OPT_FLG="-i ";;
+ "x" ) FLG_X=1 ; FLG_I=1; OPT_FLG="-i ";;
+ "n" ) FLG_N=1 ; RNUM=$OPTARG ;;
+ esac
+done
+
+shift `expr $OPTIND - 1`
+
+usage()
+{
+ echo "usage: start [ -i ] [ -x ]NAME NAME ..."
+ echo " start [-n REPEAT_NUMBER] [ -x ] NAME ..."
+}
+
+if [ $FLG_I -eq 1 -a $FLG_N -eq 1 -a $FLG_X -ne 1 ]; then
+ echo "error: -n and -i cannot be specified at the same time."
+ exit -1
+fi
+
+if [ $FLG_N -eq 1 ]; then
+ if [ $# -ne 1 ]; then
+ usage
+ exit -1
+ fi
+ NAME=$1
+ if [ $RNUM -gt 0 -a $RNUM -lt 1000 ]; then
+ for i in `seq $RNUM`
+ do
+ N=`printf "%04d" $i`
+ if [ $FLG_X -eq 0 ]; then
+ start $OPT_FLG $NAME$N
+ else
+ gnome-terminal -e "start $OPT_FLG $NAME$N"
+ fi
+
+ NETDIR=$FULCONDIR/container/$NAME$N/net
+ ls $NETDIR/* >& /dev/null
+ if [ $? -eq 0 ]; then
+ for j in `ls -1 $NETDIR`
+ do
+ sh $NETDIR/$j
+ done
+ fi
+ done;
+ exit 0
+ else
+ echo "REPEAT_NUMBER must be [1...999]"
+ exit -1
+ fi
+
+fi
+
+if [ $# -ge 1 ]; then
+ NAMES=$@
+else
+ usage
+ exit -1
+fi
+
+if [ x"$NAMES" == x"start" ]; then
+ usage
+ exit -1
+fi
+
+for i in $NAMES
+do
+ if [ $FLG_X -eq 0 ]; then
+ start $OPT_FLG $i
+ else
+ gnome-terminal -e "start $OPT_FLG $i"
+ fi
+
+ NETDIR=$FULCONDIR/container/$i/net/
+ ls $NETDIR/* >& /dev/null
+ if [ $? -eq 0 ]; then
+ for j in `ls -1 $NETDIR`
+ do
+ sh $NETDIR/$j
+ done
+ fi
+done
+
+exit 0
+
+
--- /dev/null
+#!/bin/bash
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+FULCONDRIVER=`driver-name`
+PATH=/usr/lib64/fulcon/driver/$FULCONDRIVER:$PATH
+
+# check options
+OPT_FLG=""
+FLG_N=0
+RNUM=0
+
+while getopts n: OPT
+do
+ case $OPT in
+ "n" ) FLG_N=1; RNUM=$OPTARG;;
+ esac
+done
+
+shift `expr $OPTIND - 1`
+
+usage()
+{
+ echo "usage: stop [-n REPEAT_NUMBER] NAME ..."
+}
+
+if [ $FLG_N -eq 1 ]; then
+ if [ $# -ne 1 ]; then
+ usage
+ exit -1
+ fi
+ NAME=$1
+ if [ $RNUM -gt 0 -a $RNUM -lt 1000 ]; then
+ for i in `seq $RNUM`
+ do
+ N=`printf "%04d" $i`
+ stop $NAME$N
+ done;
+ exit 0
+ else
+ echo "REPEAT_NUMBER must be [1...999]"
+ exit -1
+ fi
+
+fi
+
+if [ $# -ge 1 ]; then
+ NAMES=$@
+else
+ usage
+ exit -1
+fi
+
+if [ x"$NAMES" == x"stop" ]; then
+ usage
+ exit -1
+fi
+
+for i in $NAMES
+do
+ stop $OPT_FLG $i
+done
+
+exit 0
+
+
--- /dev/null
+#!/bin/bash
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+FULCONDRIVER=`driver-name`
+PATH=/usr/lib64/fulcon/driver/$FULCONDRIVER:$PATH
+
+# check options
+OPT_FLG=""
+FLG_N=0; RNUM=0
+FLG_C=0; IMAGENAME=`image-name`
+FLG_I=0;
+FLG_X=0;
+FLG_P=0;
+
+while getopts in:c:x OPT
+do
+ case $OPT in
+ "i" ) FLG_I=1; OPT_FLG="-i ";;
+ "n" ) FLG_N=1; RNUM=$OPTARG;;
+ "c" ) FLG_C=1; IMAGENAME=$OPTARG;;
+ "x" ) FLG_X=1; FLG_I=1; OPT_FLG="-i ";;
+ esac
+done
+
+shift `expr $OPTIND - 1`
+
+usage()
+{
+ echo "usage: sysgen [ -i ] [ -c IMAGE ] NAME NAME ..."
+ echo " sysgen [-n REPEAT_NUMBER ] [ -c IMAGE ] NAME ..."
+}
+
+if [ $FLG_I -eq 1 -a $FLG_N -eq 1 -a $FLG_X -ne 1 ]; then
+ echo "error: -n and -i cannot be specified at the same time."
+ exit -1
+fi
+
+fulcon image-catalog | awk 'BEGIN{r=-1}{if ($1 == "'$IMAGENAME'") r=0}END{exit r}'
+if [ $? -ne 0 ]; then
+ echo "error: can't find" $IMAGENAME
+ exit -1
+fi
+
+if [ $FLG_N -eq 1 ]; then
+ if [ $# -ne 1 ]; then
+ usage
+ exit -1
+ fi
+ NAME=$1
+ if [ $RNUM -gt 0 -a $RNUM -lt 1000 ]; then
+ for i in `seq $RNUM`
+ do
+ N=`printf "%04d" $i`
+ if [ $FLG_X -eq 0 ]; then
+ sysgen $OPT_FLG $NAME$N $IMAGENAME
+ else
+ gnome-terminal -e "sysgen $OPT_FLG $NAME$N $IMAGENAME"
+ fi
+ mkdir -p $FULCONDIR/container/$NAME$N
+ done;
+ exit 0
+ else
+ echo "REPEAT_NUMBER must be [1...999]"
+ exit -1
+ fi
+
+fi
+
+if [ $# -ge 1 ]; then
+ NAMES=$@
+else
+ usage
+ exit -1
+fi
+
+if [ x"$NAMES" == x"sysgen" ]; then
+ usage
+ exit -1
+fi
+
+for i in $NAMES
+do
+ mkdir -p $FULCONDIR/container/$i
+ if [ $FLG_X -eq 0 ]; then
+ sysgen $OPT_FLG $i $IMAGENAME
+ else
+ gnome-terminal -e "sysgen $OPT_FLG $i $IMAGENAME"
+ fi
+done
+
+exit 0
+
+
--- /dev/null
+#!/bin/sh
+
+# Copyright (C) 2015 NIWA Hideyuki
+
+FULCONDRIVER=`driver-name`
+PATH=/usr/lib64/fulcon/driver/$FULCONDRIVER:$PATH
+
+usage() {
+ echo "usage: update"
+}
+
+if [ $# -ne 1 ]; then
+ usage
+ exit -1
+fi
+
+if [ x"$1" != x"update" ]; then
+ usage
+ exit -1
+fi
+
+. update $@
+
+exit 0