mirror of
https://github.com/clearlinux/WALinuxAgent.git
synced 2026-09-03 20:31:31 +00:00
Update folder structure, and resolve comments
This commit is contained in:
@@ -17,29 +17,19 @@
|
||||
# Requires Python 2.4+ and Openssl 1.0+
|
||||
#
|
||||
|
||||
from azurelinuxagent.metadata import DISTRO_NAME, DISTRO_VERSION
|
||||
from azurelinuxagent.metadata import DISTRO_NAME, DISTRO_VERSION, DISTRO_FULL_NAME
|
||||
|
||||
def get_osutil():
|
||||
from azurelinuxagent.distro.ubuntu.osutil import Ubuntu1204OSUtil, \
|
||||
UbuntuOSUtil, \
|
||||
Ubuntu14xOSUtil, \
|
||||
UbuntuSnappyOSUtil
|
||||
import os
|
||||
import azurelinuxagent.utils.fileutil as fileutil
|
||||
|
||||
# TODO: https://bugs.launchpad.net/snappy/+bug/1481086
|
||||
def is_snappy():
|
||||
if os.path.exists("/etc/motd"):
|
||||
motd = fileutil.read_file("/etc/motd")
|
||||
if "snappy" in motd:
|
||||
return True
|
||||
return False
|
||||
|
||||
if DISTRO_VERSION == "12.04":
|
||||
return Ubuntu1204OSUtil()
|
||||
elif DISTRO_VERSION == "14.04" or DISTRO_VERSION == "14.10":
|
||||
return Ubuntu14xOSUtil()
|
||||
elif is_snappy():
|
||||
elif DISTRO_FULL_NAME == "Snappy Ubuntu Core":
|
||||
return UbuntuSnappyOSUtil()
|
||||
else:
|
||||
return UbuntuOSUtil()
|
||||
|
||||
@@ -21,6 +21,7 @@ import os
|
||||
import re
|
||||
import platform
|
||||
import sys
|
||||
import azurelinuxagent.utils.fileutil as fileutil
|
||||
from azurelinuxagent.future import text
|
||||
|
||||
def get_distro():
|
||||
@@ -70,24 +71,12 @@ PY_VERSION_MICRO = sys.version_info[2]
|
||||
Add this walk arround for detecting Snappy Ubuntu Core temporarily, until ubuntu
|
||||
fixed this bug: https://bugs.launchpad.net/snappy/+bug/1481086
|
||||
"""
|
||||
def which(program):
|
||||
# Return path of program for execution if found in path
|
||||
def is_exe(fpath):
|
||||
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
|
||||
_fpath, _ = os.path.split(program)
|
||||
if _fpath:
|
||||
if is_exe(program):
|
||||
return program
|
||||
else:
|
||||
for path in os.environ.get("PATH", "").split(os.pathsep):
|
||||
path = path.strip('"')
|
||||
exe_file = os.path.join(path, program)
|
||||
if is_exe(exe_file):
|
||||
return exe_file
|
||||
return None
|
||||
|
||||
def is_snappy():
|
||||
return which("snappy")
|
||||
if os.path.exists("/etc/motd"):
|
||||
motd = fileutil.read_file("/etc/motd")
|
||||
if "snappy" in motd:
|
||||
return True
|
||||
return False
|
||||
|
||||
if is_snappy():
|
||||
DISTRO_FULL_NAME = "Snappy Ubuntu Core"
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
Place the azurelinuxagent folder here
|
||||
Executable → Regular
Executable → Regular
@@ -0,0 +1 @@
|
||||
Copy the azurelinuxagent folder here
|
||||
@@ -0,0 +1,13 @@
|
||||
### Building the walinuxagent snap package
|
||||
|
||||
1. You will need the snappy developer tools on your Ubuntu Developer Desktop:
|
||||
$ sudo add-apt-repository ppa:snappy-dev/tools
|
||||
$ sudo apt-get update
|
||||
$ sudo apt-get upgrade
|
||||
$ sudo apt-get install snappy-tools
|
||||
|
||||
2. Copy the azurelinuxagent folder to snappy/lib
|
||||
$ cp -rf ../azurelinuxagent snappy/lib
|
||||
|
||||
3. Build the snap package under the snappy folder
|
||||
$ snappy build
|
||||
Reference in New Issue
Block a user