Compare commits

..

No commits in common. "master" and "archlinux-2015.01.30" have entirely different histories.

18 changed files with 146 additions and 78 deletions

View File

@ -1,30 +1,30 @@
FROM derjudge/archlinux
MAINTAINER lesderid <les@lesderid.net>
## -*- docker-image-name: "armbuild/ocs-distrib-archlinux:latest" -*-
FROM armbuild/archlinux-disk:2014-12-02
MAINTAINER Online Labs <opensource@ocs.online.net> (@online_en)
# Environment
ENV SCW_BASE_IMAGE armbuild/scw-archlinux:2014-12-02
# Update the keyring
RUN pacman -Sy --noconfirm archlinux-keyring
# Force openssl upgrade first (bad symbol issue)
RUN pacman -Sy --noconfirm --force openssl
ENV OCS_BASE_IMAGE armbuild/ocs-archlinux:2014-12-02
# Install packages
RUN pacman -Sy --noconfirm \
bash-completion \
bc \
binutils \
cronie \
curl \
dhcpcd \
dnsutils \
fakeroot \
file \
htop \
iptables \
less \
localepurge \
lsb-release \
man \
mg \
nano \
nbd \
networkmanager \
ntp \
openbsd-netcat \
openssh \
@ -38,42 +38,57 @@ RUN pacman -Sy --noconfirm \
wget
# xnbd-client
RUN mkdir /tmp/build-xnbd \
&& cd /tmp/build-xnbd \
&& wget https://bitbucket.org/hirofuchi/xnbd/downloads/xnbd-0.3.0.tar.bz2 -O xnbd.tar.bz2 \
&& tar -xf xnbd.tar.bz2 \
&& cd xnbd-* \
&& pacman -Sy --noconfirm gcc automake pkg-config make \
&& cd /tmp/build-xnbd/xnbd-* \
&& ./configure --prefix=/usr/local \
&& make -j4 \
&& make install \
&& pacman -R --noconfirm gcc automake pkg-config make \
&& cd / \
&& rm -rf /tmp/build-xnbd /tmp/xnbd.tar.bz2
# Locales
RUN sed 's/^\([^#]\)/#\1/' -i /etc/locale.gen \
&& sed 's/^#en_US.UTF-8/en_US.UTF-8/;s/^#en_GB.UTF-8/en_GB.UTF-8/' -i /etc/locale.gen \
&& echo LANG=en_GB.UTF-8 > /etc/locale.conf \
RUN sed -e s/^\#en_US.UTF-8/en_US.UTF-8/ -i /etc/locale.gen \
&& locale-gen
# Patch rootfs
RUN curl -Lkq http://j.mp/scw-skeleton | FLAVORS=common,docker-based,systemd bash -e
ADD ./patches/etc/ /etc/
ADD ./patches/usr/ /usr/
# Systemd
RUN systemctl enable \
scw-fetch-ssh-keys \
scw-sync-kernel-modules \
scw-generate-ssh-keys \
scw-gen-machine-id.service \
ntpdate.service \
sshd.service \
serial-getty@ttyS0.service \
&& systemctl mask \
getty@tty1.service
RUN systemctl disable getty@tty1.service \
&& systemctl disable systemd-networkd.service \
&& systemctl enable NetworkManager-wait-online.service \
&& systemctl enable serial-getty@ttyS0.service \
&& systemctl enable sshd.service \
&& systemctl enable NetworkManager \
&& systemctl enable ntpdate
# packages upgrade
RUN pacman --noconfirm -Suy
# Remove root password
RUN passwd -d root
# Patch rootfs
RUN wget -qO - http://j.mp/ocs-scripts | bash
ADD ./patches/etc/ /etc/
ADD ./patches/usr/ /usr/
# Enable Online-Labs services
RUN systemctl enable oc-ssh-keys \
&& systemctl enable oc-add-extra-volumes \
&& systemctl enable oc-sync-kernel-modules
# Cleanup
RUN pacman-db-upgrade \
&& pacman -Rns linux-armv7 --noconfirm \
&& pacman -Sc --noconfirm \
&& rm -rf /var/cache/pacman/pkg \
&& localepurge-config && localepurge \
&& pacman-db-upgrade

View File

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2014-2015 Scaleway
Copyright (c) 2014-2015 Online Labs
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,18 +1,15 @@
NAME = archlinux
DOCKER_NAMESPACE = armbuild/
NAME = ocs-distrib-archlinux
VERSION = latest
VERSION_ALIASES = 2014-12-02
TITLE = Arch Linux
DESCRIPTION = A simple, lightweight distribution
SOURCE_URL = https://github.com/lesderid/image-archlinux
VENDOR_URL = https://www.archlinux.org/
IMAGE_VOLUME_SIZE = 50G
IMAGE_BOOTSCRIPT = latest
IMAGE_NAME = ArchLinux
TITLE = Archlinux
DESCRIPTION = Archlinux latest
SOURCE_URL = https://github.com/online-labs/image-archlinux
## Image tools (https://github.com/scaleway/image-tools)
all: docker-rules.mk
## Image tools (https://github.com/online-labs/image-tools)
all: docker-rules.mk
docker-rules.mk:
wget -qO - https://j.mp/scw-builder | bash
wget -qO - http://j.mp/image-tools | bash
-include docker-rules.mk
## Below you can add custom makefile commands and overrides

View File

@ -1,44 +1,35 @@
# Arch Linux image on Scaleway
Official Archlinux image on Online Labs
=======================================
[![Build Status](https://travis-ci.org/lesderid/image-archlinux.svg?branch=master)](https://travis-ci.org/lesderid/image-archlinux)
**Warning: this image is not yet working**
Scripts to build an Arch Linux (x86_64) image on Scaleway
Scripts to build the official Archlinux image on Online Labs
This image is built using [Image Tools](https://github.com/scaleway/image-tools) and is based on the official [Ubuntu](https://github.com/scaleway/image-ubuntu) image.
![](https://d11xdyzr0div58.cloudfront.net/static/logos/archlinux-logo-dark-scalable.518881f04ca9.svg)
This image is built using [Image Tools](https://github.com/online-labs/image-tools) and is based on the official [Ubuntu](https://github.com/online-labs/image-ubuntu) image.
---
**This image is meant to be used on a VC1 server.**
**This image is meant to be used on a C1 server.**
We use the Docker's building system and convert it at the end to a disk image that will boot on real servers without Docker. Note that the image is still runnable as a Docker container for debug or for inheritance.
[More info](https://github.com/scaleway/image-tools#docker-based-builder)
[More info](https://github.com/online-labs/image-tools#docker-based-builder)
---
## Building
Install
-------
Build and add the image to [your account](https://cloud.scaleway.com/#/images):
Build and write the image to /dev/nbd1 (see [documentation](https://doc.cloud.online.net/howto/create_image.html))
$ make image_on_local
Full list of commands available at: [scaleway/image-tools](https://github.com/scaleway/image-tools/#commands)
$ make install
## Testing
To test your image, run:
$ scw run --tmp-ssh-key --name="archlinux" <IMAGE_ID>
Full list of commands available at: [online-labs/image-tools](https://github.com/online-labs/image-tools/tree/master#commands)
---
## Links
links
-----
- [Community: Add Archlinux ARM image](https://community.cloud.online.net/t/need-feedback-add-arch-linux-arm-image/243?u=manfred)
- [Community: New linux distributions (Debian, CoreOS, CentOS, Fedora, Arch Linux, ...)](https://community.cloud.online.net/t/official-new-linux-distributions-debian-coreos-centos-fedora-arch-linux/229?u=manfred)
---
A project by [![Scaleway](https://avatars1.githubusercontent.com/u/5185491?v=3&s=42)](https://www.scaleway.com/) and lesderid

View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
interface=$1
action=$2
if [ "$interface" = "eth0" -a "$action" = "up" ]
then
rm -f /etc/resolv.conf
ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
fi

View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
interface=$1
action=$2
if [ "$interface" = "eth0" -a "$action" = "up" ]
then
metadata_host_name=$(/usr/local/bin/oc-metadata --cached HOSTNAME)
if [ "x$metadata_host_name" != "x" ]
then
echo $metadata_host_name > /etc/hostname
sed "/^127.0.1.1[ \t].*$/ s/.*$/127.0.1.1\t$metadata_host_name/" -i /etc/hosts
sed "/^127.0.0.1[ \t]localhost/ s/localhost.*$/localhost $metadata_host_name/" -i /etc/hosts
hostnamectl set-hostname $metadata_host_name
fi
fi

View File

@ -3,7 +3,7 @@
# - http://support.ntp.org/bin/view/Support/GettingStarted
# - https://wiki.archlinux.org/index.php/Network_Time_Protocol_daemon
server ntp.int.scaleway.com
server ntp.int.cloud.online.net
# Associate to public NTP pool servers; see http://www.pool.ntp.org/
server 0.arch.pool.ntp.org

View File

@ -112,7 +112,7 @@ PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
UseDNS no
#UseDNS yes
#PidFile /run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no

View File

@ -2,7 +2,6 @@
Name=eth0
[Network]
DHCP=yes
DNS=10.1.31.38
DNS=10.1.31.39
Domains=scaleway.com
Domains=cloud.online.net

View File

@ -1,4 +1,4 @@
# Scaleway's DNS
# online cloud's DNS
[Resolve]
DNS=10.1.31.38

View File

@ -0,0 +1,10 @@
[Unit]
Description=OCS additional volumes mounter
[Service]
ExecStart=/usr/sbin/oc-add-extra-volumes
ExecStop=/usr/sbin/oc-remove-extra-volumes
Type=forking
[Install]
WantedBy=basic.target

View File

@ -0,0 +1,10 @@
[Unit]
Description=OCS fetch ssh keys from metadata
After=NetworkManager-wait-online.service
[Service]
ExecStart=/bin/bash -c "mkdir -p /root/.ssh/ ; chmod 700 /root/.ssh ; /usr/local/bin/oc-metadata | grep SSH_PUBLIC_KEYS_.*_KEY | cut -d'=' -f 2- | tr -d \\' > /root/.ssh/authorized_keys"
Type=oneshot
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,10 @@
[Unit]
Description=OCS fetch kernel modules from OCS mirror
After=NetworkManager-wait-online.service
[Service]
ExecStart=/usr/sbin/oc-sync-kernel-modules
Type=oneshot
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,10 @@
[Unit]
Description=Reboot
Documentation=man:systemd-halt.service(8)
DefaultDependencies=no
Requires=shutdown.target umount.target final.target
After=shutdown.target umount.target final.target
[Service]
Type=oneshot
ExecStart=/usr/sbin/oc-nbd-disconnect-root

View File

@ -1,6 +1,6 @@
# Fetch Scaleway metadata
# Fetch OCS metadata
fetch_scw_metadata()
fetch_ocs_metadata()
{
metadata_host_name=$(/usr/local/bin/oc-metadata --cached HOSTNAME)
if [ "x$metadata_host_name" != "x" ]; then
@ -14,5 +14,5 @@ fetch_scw_metadata()
}
if $if_up; then
fetch_scw_metadata
fetch_ocs_metadata
fi

View File

@ -4,7 +4,7 @@ METADATA_CACHE=`mktemp -u`
get_metadata() {
if [ ! -f $METADATA_CACHE ]; then
/usr/local/bin/oc-metadata --cached > $METADATA_CACHE
/usr/local/bin/oc-metadata > $METADATA_CACHE
fi
}