Skip to content
This repository was archived by the owner on May 24, 2020. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion script/hypercube/hypercube.service → hypercube.service
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Unit]
Description=Hypercube
Requires=network.target
After=network.target dnsmasq.service ynh-hotspot.service ynh-vpnclient.service resize2fs-reboot.service firstrun.service secondrun.service
After=network.target dnsmasq.service ynh-hotspot.service ynh-vpnclient.service armbian-resize-filesystem.service

[Service]
Type=oneshot
Expand Down
17 changes: 0 additions & 17 deletions script/hypercube/hypercube.sh → hypercube.sh
Original file line number Diff line number Diff line change
Expand Up @@ -658,23 +658,6 @@ info "===== Start HyperCube Service ====="
set_logpermissions
start_logwebserver

# firstrun/secondrun not finished
# should never happen
if [ ! -f /etc/yunohost/cube_installed ]; then
info "Waiting for the end of the FS resizing..."

keep_debugging=false
exit 0
fi

# ARMbian not finished resizing
if [ -f /var/run/resize2fs-reboot ]; then
info "Waiting for the end of the FS resizing..."

keep_debugging=false
exit 0
fi

# Second boot
if [ -f "${log_filepath}/enabled" ]; then
info "Starting second step"
Expand Down
File renamed without changes.
51 changes: 0 additions & 51 deletions script/firstrun

This file was deleted.

10 changes: 0 additions & 10 deletions script/firstrun.service

This file was deleted.

46 changes: 0 additions & 46 deletions script/hypercube/install.hypercube.example

This file was deleted.

9 changes: 0 additions & 9 deletions script/resize2fs-reboot

This file was deleted.

11 changes: 0 additions & 11 deletions script/resize2fs-reboot.service

This file was deleted.

17 changes: 0 additions & 17 deletions script/secondrun

This file was deleted.

10 changes: 0 additions & 10 deletions script/secondrun.service

This file was deleted.

31 changes: 0 additions & 31 deletions script/upgrade.sh

This file was deleted.

59 changes: 17 additions & 42 deletions yunocube.sh
Original file line number Diff line number Diff line change
@@ -1,52 +1,27 @@
#!/bin/bash


set -e
set -x

TARGET_DIR=./tmp
REP=$(dirname $0)
APT='DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes'
IMAGE=$(echo $1 | sed 's/yunohost/internetcube/')

cp $1 $IMAGE
mkdir -p $TARGET_DIR
umount $TARGET_DIR || true
mount -o loop,offset=4194304 $IMAGE $TARGET_DIR


echo '. /etc/bash_completion' >> $TARGET_DIR/root/.bashrc

# Use dhcp on boot
cat <<EOT > $TARGET_DIR/etc/network/interfaces
source /etc/network/interfaces.d/*
OVERLAY_PATH=/tmp/overlay/internetcube

auto lo
iface lo inet loopback
InstallInternetCubeServices(){

auto usb0
allow-hotplug usb0
iface usb0 inet dhcp
EOT
# Install InternetCube dependencies usb detection, hotspot, vpnclient, roundcube
apt-get install -o Dpkg::Options::='--force-confold' -y \
file udisks2 udiskie ntfs-3g jq \
php7.0-fpm sipcalc hostapd iptables iw dnsmasq firmware-linux-free \
sipcalc dnsutils openvpn curl fake-hwclock \
php-cli php-common php-intl php-json php-mcrypt php-pear php-auth-sasl php-mail-mime php-patchwork-utf8 php-net-smtp php-net-socket php-net-ldap2 php-net-ldap3 php-zip php-gd php-mbstring php-curl

# Debootstrap optimisations from igorpecovnik
# change default I/O scheduler, noop for flash media, deadline for SSD, cfq for mechanical drive
cat <<EOT >> $TARGET_DIR/etc/sysfs.conf
block/mmcblk0/queue/scheduler = noop
#block/sda/queue/scheduler = cfq
EOT
# Install hypercube service
mkdir -p /var/log/hypercube
install -m 755 -o root -g root ${OVERLAY_PATH}/hypercube.sh /usr/local/bin/
install -m 444 -o root -g root ${OVERLAY_PATH}/hypercube.service /etc/systemd/system/
install -m 444 -o root -g root ${OVERLAY_PATH}/install.html /var/log/hypercube/

# Add firstrun and secondrun init script
install -m 755 -o root -g root ${REP}/script/resize2fs-reboot $TARGET_DIR/usr/local/bin/
install -m 755 -o root -g root ${REP}/script/hypercube/hypercube.sh $TARGET_DIR/usr/local/bin/
install -m 444 -o root -g root ${REP}/script/resize2fs-reboot.service $TARGET_DIR/etc/systemd/system/
install -m 444 -o root -g root ${REP}/script/hypercube/hypercube.service $TARGET_DIR/etc/systemd/system/
ln -f -s '/etc/systemd/system/resize2fs-reboot.service' $TARGET_DIR/etc/systemd/system/multi-user.target.wants/resize2fs-reboot.service
ln -f -s '/etc/systemd/system/hypercube.service' $TARGET_DIR/etc/systemd/system/multi-user.target.wants/hypercube.service
# Enable hypercube service
# TODO use systemctl for doing this
ln -f -s '/etc/systemd/system/hypercube.service' /etc/systemd/system/multi-user.target.wants/hypercube.service

# Add hypercube scripts
mkdir -p $TARGET_DIR/var/log/hypercube
install -m 444 -o root -g root ${REP}/script/hypercube/install.html $TARGET_DIR/var/log/hypercube/
umount $TARGET_DIR || true
}

exit 0