-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add package for building Linux packages. Initial support is for Ubuntu.
- Loading branch information
Showing
8 changed files
with
244 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
2017-10-21 Kunihiro Ishiguro <[email protected]> | ||
|
||
* README.md: Initial commit. Vesrion 0.8.0. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
## | ||
## Makefile for openconfigd package. | ||
## | ||
PACKAGE_NAME:=openconfigd | ||
|
||
OPENCONFIGD_VERSION:=0.8.0 | ||
|
||
PACKAGE_VERSION:=$(OPENCONFIGD_VERSION) | ||
PACKAGE_LICENSE:=Apache License version 2.0 | ||
PACKAGE_DESCRIPTION:=OpenConfigd | ||
PACKAGE_MAINTAINER:[email protected] | ||
PACKAGE_URL:=http://coreswitch.io/ | ||
PACKAGE_VENDOR:=coreswitch | ||
|
||
OUT_DIR:=out | ||
STAGING_DIR:=$(OUT_DIR)/stage | ||
BUILD_DIR:=$(OUT_DIR)/build | ||
|
||
.PHONY: package stage clean files | ||
|
||
package: $(OUT_DIR)/package.timestamp | ||
|
||
$(OUT_DIR)/package.timestamp: stage | ||
@echo "Creating package" | ||
@rm -f $(OUT_DIR)/$(PACKAGE_NAME)_$(PACKAGE_VERSION)*.deb | ||
@cd $(OUT_DIR) && \ | ||
fpm -s dir -C $(realpath $(STAGING_DIR)) \ | ||
--name $(PACKAGE_NAME) \ | ||
--version $(PACKAGE_VERSION) \ | ||
--license "$(PACKAGE_LICENSE)" \ | ||
--maintainer "$(PACKAGE_MAINTAINER)" \ | ||
--description "$(PACKAGE_DESCRIPTION)" \ | ||
--url "$(PACKAGE_URL)" \ | ||
--vendor "$(PACKAGE_VENDOR)" \ | ||
--before-install ../scripts/before_install.sh \ | ||
--after-install ../scripts/after_install.sh \ | ||
--before-remove ../scripts/before_remove.sh \ | ||
--after-remove ../scripts/after_remove.sh \ | ||
--deb-changelog ../../ChangeLog \ | ||
--deb-no-default-config-files \ | ||
-t deb . | ||
touch $(OUT_DIR)/package.timestamp | ||
|
||
stage: files openconfigd cli | ||
|
||
files: $(STAGING_DIR) $(STAGING_DIR)/etc $(STAGING_DIR)/etc/openconfigd | ||
rsync -avz ./files/ubuntu/ $(STAGING_DIR)/ | ||
rsync -avz ../bash_completion.d $(STAGING_DIR)/etc | ||
rsync -avz ../yang $(STAGING_DIR)/etc/openconfigd | ||
|
||
openconfigd: $(STAGING_DIR)/usr/bin | ||
go get github.com/hash-set/openconfigd/openconfigd | ||
go get github.com/hash-set/openconfigd/cli_command | ||
cp $(GOPATH)/bin/openconfigd $(STAGING_DIR)/usr/bin | ||
cp $(GOPATH)/bin/cli_command $(STAGING_DIR)/usr/bin | ||
|
||
cli: $(BUILD_DIR) $(STAGING_DIR)/usr/bin | ||
(cd $(BUILD_DIR); ../../../cli/configure; make; cp cli ../../$(STAGING_DIR)/usr/bin) | ||
|
||
$(STAGING_DIR): | ||
mkdir -p $(STAGING_DIR) | ||
|
||
$(STAGING_DIR)/usr/bin: | ||
mkdir -p $(STAGING_DIR)/usr/bin | ||
|
||
$(STAGING_DIR)/etc: | ||
mkdir -p $(STAGING_DIR)/etc | ||
|
||
$(STAGING_DIR)/etc/openconfigd: | ||
mkdir -p $(STAGING_DIR)/etc/openconfigd | ||
|
||
$(BUILD_DIR): | ||
mkdir -p $(BUILD_DIR) | ||
|
||
clean: | ||
rm -rf $(OUT_DIR) |
14 changes: 14 additions & 0 deletions
14
package/files/ubuntu/lib/systemd/system/openconfigd.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[Unit] | ||
Description=openconfigd | ||
|
||
[Service] | ||
Type=simple | ||
User=root | ||
Group=root | ||
StandardOutput=syslog | ||
StandardError=syslog | ||
Restart=always | ||
ExecStart=/usr/bin/openconfigd -y /etc/openconfigd/yang | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#! /bin/bash | ||
|
||
_ubuntu_version () | ||
{ | ||
if /bin/grep 16.04 /etc/lsb-release>/dev/null;then | ||
U1604=1 | ||
else | ||
U1604=0 | ||
fi | ||
} | ||
|
||
_process_1404 () | ||
{ | ||
echo "Post install script for Ubuntu 14.04" | ||
/usr/bin/supervisorctl reload | ||
return 0 | ||
} | ||
|
||
_process_1604 () | ||
{ | ||
echo "Post install script for Ubuntu 16.04" | ||
/bin/systemctl daemon-reload | ||
/bin/systemctl restart openconfigd.service | ||
return 0 | ||
} | ||
|
||
_main () | ||
{ | ||
_ubuntu_version | ||
|
||
if [ ${U1604} == 1 ]; then | ||
_process_1604 | ||
else | ||
_process_1404 | ||
fi | ||
} | ||
|
||
_main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#! /bin/bash | ||
|
||
_ubuntu_version () | ||
{ | ||
if /bin/grep 16.04 /etc/lsb-release>/dev/null;then | ||
U1604=1 | ||
else | ||
U1604=0 | ||
fi | ||
} | ||
|
||
_process_1404 () | ||
{ | ||
echo "Post uninstall script for Ubuntu 14.04" | ||
/usr/bin/supervisorctl reload | ||
return 0 | ||
} | ||
|
||
_process_1604 () | ||
{ | ||
echo "Post uninstall script for Ubuntu 16.04" | ||
/bin/systemctl daemon-reload | ||
return 0 | ||
} | ||
|
||
_main () | ||
{ | ||
_ubuntu_version | ||
|
||
if [ ${U1604} == 1 ]; then | ||
_process_1604 | ||
else | ||
_process_1404 | ||
fi | ||
} | ||
|
||
_main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#! /bin/bash | ||
|
||
_ubuntu_version () | ||
{ | ||
if /bin/grep 16.04 /etc/lsb-release>/dev/null;then | ||
U1604=1 | ||
else | ||
U1604=0 | ||
fi | ||
} | ||
|
||
_process_1404 () | ||
{ | ||
echo "Pre install script for Ubuntu 14.04" | ||
/bin/mkdir -p /var/log/openconfigd | ||
/usr/bin/supervisorctl stop openconfigd | ||
return 0 | ||
} | ||
|
||
_process_1604 () | ||
{ | ||
echo "Pre install script for Ubuntu 16.04" | ||
/usr/bin/supervisorctl stop openconfigd | ||
return 0 | ||
} | ||
|
||
_main () | ||
{ | ||
_ubuntu_version | ||
|
||
if [ ${U1604} == 1 ]; then | ||
_process_1604 | ||
else | ||
_process_1404 | ||
fi | ||
} | ||
|
||
_main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#! /bin/bash | ||
|
||
_ubuntu_version () | ||
{ | ||
if /bin/grep 16.04 /etc/lsb-release>/dev/null;then | ||
U1604=1 | ||
else | ||
U1604=0 | ||
fi | ||
} | ||
|
||
_process_1404 () | ||
{ | ||
echo "Pre uninstall script for Ubuntu 14.04" | ||
/usr/bin/supervisorctl stop openconfigd | ||
return 0 | ||
} | ||
|
||
_process_1604 () | ||
{ | ||
echo "Pre uninstall script for Ubuntu 16.04" | ||
/bin/systemctl stop openconfigd.service | ||
return 0 | ||
} | ||
|
||
_main () | ||
{ | ||
_ubuntu_version | ||
|
||
if [ ${U1604} == 1 ]; then | ||
_process_1604 | ||
else | ||
_process_1404 | ||
fi | ||
} | ||
|
||
_main |