diff --git a/app/file.py b/app/file.py index bbd3bf8..1e9c987 100644 --- a/app/file.py +++ b/app/file.py @@ -39,6 +39,11 @@ def setup(path, base_dir, file_prefix, etcd_url): sp.check_output(['pipenv','--site-packages', '--python', '3'], cwd=repo_name) sp.check_output(['pipenv', 'install'], cwd=repo_name) + # TODO: Devuan/Debian have crontab under /etc/crontab + # while Alpine have it under /etc/crontabs/root + # Detect in the following code where should we write + # our crontab entries + # Write Crontab entry with open("/etc/crontabs/root", "a") as crontab: crontab.write( diff --git a/app/image.py b/app/image.py index 4b64ad0..ec22150 100644 --- a/app/image.py +++ b/app/image.py @@ -39,6 +39,12 @@ def setup(path, base_dir, etcd_url, without_ceph): sp.check_output(['pipenv','--site-packages', '--python', '3'], cwd=repo_name) sp.check_output(['pipenv', 'install'], cwd=repo_name) + # TODO: Devuan/Debian have crontab under /etc/crontab + # while Alpine have it under /etc/crontabs/root + # Detect in the following code where should we write + # our crontab entries + + # Write Crontab entry with open("/etc/crontabs/root", "a") as crontab: crontab.write( diff --git a/init.sh b/init.sh index f33dc44..e7e5bcc 100644 --- a/init.sh +++ b/init.sh @@ -3,12 +3,24 @@ get_distro() { echo $OS } +# These directories would be need if user chooses +# to setup ucloud without CEPH + +mkdir /var/vm +mkdir /var/www +mkdir /var/image + if ! grep -q "export LC_ALL=C.UTF-8" ~/.bashrc; then echo 'export LC_ALL=C.UTF-8' >> ~/.bashrc echo 'export LANG=C.UTF-8' >> ~/.bashrc source ~/.bashrc fi +if ! grep -q "alias etcdctl='ETCDCTL_API=3 etcdctl'" ~/.bashrc; then + echo "alias etcdctl='ETCDCTL_API=3 etcdctl'" >> ~/.bashrc + source ~/.bashrc +fi + case $(get_distro) in "alpine") # Install QEMU @@ -43,7 +55,7 @@ EOF apt upgrade --yes # Install QEMU - apt install qemu python3 ceph python-pip python3-pip etcd-client --yes + apt install qemu qemu-system python3 ceph python-pip python3-pip etcd-client --yes ;; *) echo "Unsupported OS/Distribution"