Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f231ae5
Update Makefile: Only call "make all" for "src" directory
EricClaeys Apr 6, 2025
c1f53f6
Update Makefile: Install ffmpeg lftp imagemagick bc in "install.sh", …
EricClaeys Apr 6, 2025
88e2b0e
Update install.sh: Install ffmpeg lftp imagemagick bc
EricClaeys Apr 6, 2025
807f9de
Update Makefile: Remove "deps" and "all"
EricClaeys Apr 6, 2025
60e5e13
Update Makefile: Use double quotes with echo so single quotes appear
EricClaeys Apr 6, 2025
97d1754
Update Makefile: Add dummy "deps:"
EricClaeys Apr 6, 2025
fe75de8
Update Makefile
EricClaeys Apr 6, 2025
c105d0f
Update Makefile: Temporarily run "make -C src $@"
EricClaeys Apr 6, 2025
a0d5fef
Update ci_compile.yml: Run "make -C src ..."
EricClaeys Apr 6, 2025
41f8816
Update Makefile
EricClaeys Apr 6, 2025
ca446f0
Update ci_compile.yml: Combine deps and all
EricClaeys Apr 6, 2025
3c54b9f
Update Makefile: Remove temporary code
EricClaeys Apr 6, 2025
f5df48d
Update Makefile: Use double quotes with echo so single quotes appear
EricClaeys Apr 6, 2025
3b6e674
Update install.sh: Combine "make deps" and "make all"
EricClaeys Apr 6, 2025
3c2697d
Update install.sh: Fix: Adding missing ";"
EricClaeys Apr 6, 2025
5a4e552
Update Makefile: Delete PKGBUILD-related code
EricClaeys Apr 6, 2025
c2c58c6
Update Makefile: Delete PKGBUILD-related code
EricClaeys Apr 6, 2025
67acc3a
Update Makefile: Delete PKGBUILD-related code
EricClaeys Apr 6, 2025
e9f521c
Delete notificationImages/Makefile: not needed
EricClaeys Apr 6, 2025
dc337fe
Update Makefile: Delete "make -C notificationImages"
EricClaeys Apr 6, 2025
349b098
Delete scripts/Makefile: Not needed without PKGBUILD
EricClaeys Apr 6, 2025
d846d21
Update Makefile: Delete "make -C scripts"
EricClaeys Apr 6, 2025
ab2785c
Update ci_compile.yml: Add "sudo apt update" - GitHub needs it when c…
EricClaeys Apr 6, 2025
727cec4
Update Makefile: Add space for testing compile
EricClaeys Apr 6, 2025
ece75b8
Update Makefile: Remove temporary space
EricClaeys Apr 6, 2025
7b31d3c
Update Makefile: Fix "[ ! -e ../bin ] && mkdir -p ../bin"
EricClaeys Apr 6, 2025
3b75370
Update install.sh: Add headers when running "make" twice in same log …
EricClaeys Apr 6, 2025
afdba33
Update Makefile: Prepend "@" to "sed" statements
EricClaeys Apr 6, 2025
6c1c0bd
Update Makefile: Let install.sh create allsky/tmp and set permissions
EricClaeys Apr 7, 2025
634990f
Update install.sh: fix typo
EricClaeys Apr 7, 2025
85b3ce0
Merge branch 'v2025.xx.xx' into 4489-improve-the-way-allsky-is-compiled
EricClaeys Apr 7, 2025
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
11 changes: 4 additions & 7 deletions .github/workflows/ci_compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,8 @@ jobs:
- uses: actions/checkout@v2

# Runs a set of commands using the runners shell
- name: make deps
- name: make deps all
run: |
sudo make deps

# Info: depends an step "make deps"
- name: make all
run: |
sudo make all
sudo apt update
sudo make -C src deps
make -C src all
53 changes: 10 additions & 43 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,59 +1,26 @@
platform = $(shell uname -m)
prefix =

sysconfdir = ${prefix}/etc
exec_prefix = /usr
bindir = ${exec_prefix}/bin
libexecdir = ${exec_prefix}/libexec/allsky
sharedir = ${exec_prefix}/share/allsky

.DEFAULT_GOAL := all

ROOTCHECK=$(shell id -u)
ifneq ($(ROOTCHECK),0)
ifeq ($(PKGBUILD),1)
ROOTCHECK=0
endif
endif

ifeq ($(PKGBUILD),)
PKGBUILD=0
endif

%:
@make -C src $@
@make -C config_repo $@
@make -C notificationImages $@
@make -C scripts $@
@echo "Nothing to do for 'all'. Run 'sudo make install' instead."

deps:
@make -C src $@

.PHONY : deps

install:
ifneq ($(ROOTCHECK), 0)
@echo This must be run with root permissions.
@echo Please run \'sudo make install\'
install:
@echo "This must be run with root permissions."
@echo "Please run 'sudo make install'."
else
install:
@echo `date +%F\ %R:%S` Starting install...
@echo ""
@make -C src $@
@echo ""
@make -C config_repo $@
@make -C notificationImages $@
@make -C scripts $@
@if [ $(PKGBUILD) -eq 1 ]; then \
[ ! -e $(DESTDIR)$(libexecdir) ] && mkdir -p $(DESTDIR)$(libexecdir) \
install allsky.sh $(DESTDIR)$(libexecdir)/allsky.sh; \
fi
@if [ $(PKGBUILD) -ne 1 ]; then \
echo `date +%F\ %R:%S` Setting directory permissions...; \
[ ! -e tmp ] && mkdir tmp; \
chown -R $(SUDO_USER):$(SUDO_USER) ./ ; \
echo ""; \
echo ""; \
echo `date +%F\ %R:%S` Install complete; \
echo ""; \
echo ""; \
fi
@echo ""
@echo "\n\n`date +%F\ %R:%S` Install complete\n\n"
endif

.PHONY : install
118 changes: 33 additions & 85 deletions config_repo/Makefile
Original file line number Diff line number Diff line change
@@ -1,135 +1,83 @@
platform = $(shell uname -m)
prefix =

sysconfdir = ${prefix}/etc
exec_prefix = /usr
bindir = ${exec_prefix}/bin
libexecdir = ${exec_prefix}/libexec/allsky
sharedir = ${exec_prefix}/share/allsky

HOMEDIR = $(shell dirname "$$PWD")
CONFIGDIR = ${HOMEDIR}/config
SCRIPTSDIR = ${HOMEDIR}/scripts
UTILITIESDIR = ${SCRIPTSDIR}/utilities
# TODO: get from variables.sh
NORESTARTCODES = 100 101
LIBSYSTEMDIR = /lib/systemd/system

.DEFAULT_GOAL := all

ROOTCHECK=$(shell id -u)
ifneq ($(ROOTCHECK),0)
ifeq ($(PKGBUILD),1)
ROOTCHECK=0
endif
endif

ifeq ($(PKGBUILD),)
PKGBUILD=0
endif


ENVFILE := env.json
UNINSTALLFILES := $(DESTDIR)$(sysconfdir)/logrotate.d/allsky $(DESTDIR)$(sysconfdir)/rsyslog.d/allsky.conf $(DESTDIR)$(sysconfdir)/systemd/system/allsky.service $(DESTDIR)$(sysconfdir)/systemd/system/allskyperiodic.service
UNINSTALLFILES := /etc/logrotate.d/allsky /etc/rsyslog.d/allsky.conf /etc/systemd/system/allsky.service /etc/systemd/system/allskyperiodic.service

%:
@echo `date +%F\ %R:%S` nothing to do for $@
@echo "`date +%F\ %R:%S` nothing to do for $@"

ifneq ($(ROOTCHECK), 0)
install uninstall:
@echo "This must be run with root permissions."
@echo "Please run 'sudo make $@'"
@echo "Please run 'sudo make $@'."
else # Root check passed

uninstall:
@echo `date +%F\ %R:%S` Removing installed files: $(UNINSTALLFILES)
@echo "`date +%F\ %R:%S` Removing installed files: $(UNINSTALLFILES)"
@rm -f $(UNINSTALLFILES)
@echo `date +%F\ %R:%S` Complete.
@echo `date +%F\ %R:%S` NOTE: Config files were \-NOT\- removed.
@echo `date +%F\ %R:%S` To remove config files, please run \'sudo make remove_configs\'
@echo "`date +%F\ %R:%S` Complete."
@echo "`date +%F\ %R:%S` NOTE: Config files were -NOT- removed."
@echo "`date +%F\ %R:%S` To remove config files, please run 'sudo make remove_configs'."
.PHONY : uninstall

ifeq ($(PKGBUILD),1) # In package build mode ###################################### Needs testing

remove_configs:
@echo `date +%F\ %R:%S` Removing config path and files $(DESTDIR)$(sysconfigdir)/allsky
@rm -rf $(DESTDIR)$(sysconfigdir)/allsky

createDirs:
@echo `date +%F\ %R:%S` Creating directory structures...
@if [ ! -e $(DESTDIR)$(sysconfdir)/allsky ]; then mkdir -p $(DESTDIR)$(sysconfdir)/allsky; fi
@if [ ! -e $(DESTDIR)$(sysconfdir)/profile.d ]; then mkdir -p $(DESTDIR)$(sysconfdir)/profile.d; fi
@if [ ! -e $(DESTDIR)$(sysconfdir)/systemd/system ]; then mkdir -p $(DESTDIR)$(sysconfdir)/systemd/system; fi
@if [ ! -e $(DESTDIR)$(sysconfdir)/udev/rules.d ]; then mkdir -p $(DESTDIR)$(sysconfdir)/udev/rules.d; fi
.PHONY : createDirs

$(ENVFILE):
@if [ ! -e $(DESTDIR)$(sysconfdir)/allsky/$@ ]; then \
echo `date +%F\ %R:%S` Copying default $@; \
cp $@.repo > env; \
install -m 0664 env $(HOMEDIR)/$@; \
rm -f env; \
fi
# TODO: In PKGBUILD mode, where is the "allsky" directory? $(ENVFILE) needs to go in it.
# Is $(HOMEDIR) the correct location, or should it be $(DESTDIR)$(sysconfdir)/allsky ?
.PHONY : $(ENVFILE)

install: createDirs $(ENVFILE)
@echo `date +%F\ %R:%S` Setting up udev rules...
@install -D -m 0644 asi.rules $(DESTDIR)$(sysconfdir)/udev/rules.d/
@echo `date +%F\ %R:%S` Setting up logging...
@install -D -m 0644 allsky.logrotate.repo $(DESTDIR)$(sysconfdir)/logrotate.d/allsky
@install -D -m 0644 allsky.rsyslog.repo $(DESTDIR)$(sysconfdir)/rsyslog.d/allsky.conf
@echo `date +%F\ %R:%S` Setting allsky to auto start...
@sed -e "s|XX_ALLSKY_OWNER_XX|allsky|" -e "s|XX_ALLSKY_HOME_XX|$(bindir)|" allsky.service.repo > allsky.service
@install -m 0644 allsky.service $(DESTDIR)$(sysconfdir)/systemd/system/
@rm -f allsky.service
@echo `date +%F\ %R:%S` Setting up home environment variable...
@echo "export ALLSKY_TMP=/tmp\nexport ALLSKY_CONFIG=$(DESTDIR)$(sysconfdir)/allsky\nexport ALLSKY_SCRIPTS=$(DESTDIR)$(libexecdir)\nexport ALLSKY_NOTIFICATION_IMAGES=$(DESTDIR)$(sharedir)\nexport ALLSKY_IMAGES=/home/allsky/images/\nPATH=${PATH}:${DESTDIR}$(libexedir)" > $(DESTDIR)$(sysconfdir)/profile.d/allsy.sh


else # Not in package build mode ######################################

remove_configs:
@echo `date +%F\ %R:%S` Removing config path and files ../config
@rm -rf ../config
@echo "`date +%F\ %R:%S` Removing config path and files $(CONFIGDIR)"
@rm -rf $(CONFIGDIR)
.PHONY : remove_configs

createDirs:
@echo `date +%F\ %R:%S` Creating directory structures...
@if [ ! -e ../config ]; then mkdir -p ../config; chown $(SUDO_USER):$(SUDO_USER) ../config; fi
@echo "`date +%F\ %R:%S` Creating directory structures..."
@if [ ! -e $(CONFIGDIR) ]; then \
mkdir -p $(CONFIGDIR); \
chown $(SUDO_USER):$(SUDO_USER) $(CONFIGDIR); \
fi
.PHONY : createDirs

install: createDirs
@echo `date +%F\ %R:%S` Setting up udev rules...
@install -D -m 0644 asi.rules $(DESTDIR)$(sysconfdir)/udev/rules.d/
@echo `date +%F\ %R:%S` Setting up logging...
@install -D -m 0644 allsky.logrotate.repo $(DESTDIR)$(sysconfdir)/logrotate.d/allsky
@install -D -m 0644 allsky.rsyslog.repo $(DESTDIR)$(sysconfdir)/rsyslog.d/allsky.conf
@echo "`date +%F\ %R:%S` Setting up udev rules..."
@install -D -m 0644 asi.rules /etc/udev/rules.d/
@echo "`date +%F\ %R:%S` Setting up logging..."
@install -D -m 0644 allsky.logrotate.repo /etc/logrotate.d/allsky
@install -D -m 0644 allsky.rsyslog.repo /etc/rsyslog.d/allsky.conf
@udevadm control -R
@udevadm trigger
@echo `date +%F\ %R:%S` Setting allsky to auto start...
@echo "`date +%F\ %R:%S` Setting allsky to auto start..."
@if [ -e /etc/xdg/lxsession/LXDE-pi/autostart ]; then \
sed -i '/allsky.sh/d' /etc/xdg/lxsession/LXDE-pi/autostart; fi
@# Don't use the /lib/systemd/system directory
sed -e "s|XX_ALLSKY_OWNER_XX|$(SUDO_USER)|" \
@# Don't use the $(LIBSYSTEMDIR) directory
@sed -e "s|XX_ALLSKY_OWNER_XX|$(SUDO_USER)|" \
-e "s|XX_ALLSKY_HOME_XX|$(HOMEDIR)|" \
-e "s|XX_NO_RESTART_CODES_XX|$(NORESTARTCODES)|" \
-e "s|XX_ALLSKY_UTILITIES_XX|$(UTILITIESDIR)|" \
allsky.service.repo > allsky.service
@install -m 0644 allsky.service $(DESTDIR)$(sysconfdir)/systemd/system/
@install -m 0644 allsky.service /etc/systemd/system/
@rm -f allsky.service
@if [ -e /lib/systemd/system/allsky.service ]; then rm -f /lib/systemd/system/allsky.service; fi
sed -e "s|XX_ALLSKY_OWNER_XX|$(SUDO_USER)|" \
@if [ -e $(LIBSYSTEMDIR)/allsky.service ]; then rm -f $(LIBSYSTEMDIR)/allsky.service; fi
@sed -e "s|XX_ALLSKY_OWNER_XX|$(SUDO_USER)|" \
-e "s|XX_NO_RESTART_CODES_XX|$(NORESTARTCODES)|" \
-e "s|XX_ALLSKY_SCRIPTS_XX|$(SCRIPTSDIR)|" \
allskyperiodic.service.repo > allskyperiodic.service
@install -m 0644 allskyperiodic.service $(DESTDIR)$(sysconfdir)/systemd/system/
@install -m 0644 allskyperiodic.service /etc/systemd/system/
@rm -f allskyperiodic.service
@if [ -e /lib/systemd/system/allskyperiodic.service ]; then rm -f /lib/systemd/system/allskyperiodic.service; fi
@if [ -e $(LIBSYSTEMDIR)/allskyperiodic.service ]; then rm -f $(LIBSYSTEMDIR)/allskyperiodic.service; fi
@systemctl daemon-reload
@systemctl enable allsky
@systemctl enable allskyperiodic
@echo `date +%F\ %R:%S` Setting up ALLSKY_HOME environment variable...
@echo "export ALLSKY_HOME=$(HOMEDIR)\nPATH=${PATH}:$(SCRIPTSDIR)" > $(DESTDIR)$(sysconfdir)/profile.d/allsky.sh
@echo "`date +%F\ %R:%S` Setting up ALLSKY_HOME environment variable..."
@echo "export ALLSKY_HOME=$(HOMEDIR)\nPATH=${PATH}:$(SCRIPTSDIR)" > /etc/profile.d/allsky.sh

.PHONY : install
endif # Package build check

endif # Root check
19 changes: 12 additions & 7 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1818,9 +1818,9 @@ install_dependencies_etc()
ln -s "${F}" "${T}" || echo "Unable to ln -s '${F}' '${T}'" >&2
fi

TMP="${ALLSKY_LOGS}/make_deps.log"
sudo make deps > "${TMP}" 2>&1
check_success $? "Dependency installation failed" "${TMP}" "${DEBUG}" ||
TMP="${ALLSKY_LOGS}/allsky_dependencies.log"
run_aptGet ffmpeg lftp imagemagick bc > "${TMP}" 2>&1
check_success $? "Allsky dependency installation failed" "${TMP}" "${DEBUG}" ||
exit_with_image 1 "${STATUS_ERROR}" "dependency installation failed"

# Set some default locations needed by the capture programs so we
Expand All @@ -1830,18 +1830,23 @@ install_dependencies_etc()
-e "s;XX_ALLSKY_HOME_XX;${ALLSKY_HOME};" \
-e "s;XX_CONNECTED_CAMERAS_FILE_XX;${CONNECTED_CAMERAS_INFO};" \
-e "s;XX_RPI_CAMERA_INFO_FILE_XX;${RPi_SUPPORTED_CAMERAS};" \
"${ALLSKY_HOME}/src/include/allsky_common.h.repo" > "${ALLSKY_HOME}/src/include/allsky_common.h"
"${ALLSKY_HOME}/src/include/allsky_common.h.repo" \
> "${ALLSKY_HOME}/src/include/allsky_common.h"

display_msg --log progress "Preparing Allsky commands."
# "make -C src deps" may need to install some packages, so needs "sudo".
display_msg --log progress "Creating Allsky commands."
TMP="${ALLSKY_LOGS}/make_all.log"
make all > "${TMP}" 2>&1
{
echo "===== make deps"
sudo make -C src deps && echo -e "\n\n===== make all" && make -C src all
} > "${TMP}" 2>&1
check_success $? "Compile failed" "${TMP}" "${DEBUG}" ||
exit_with_image 1 "${STATUS_ERROR}" "compile failed"

TMP="${ALLSKY_LOGS}/make_install.log"
sudo make install > "${TMP}" 2>&1
check_success $? "make install failed" "${TMP}" "${DEBUG}" ||
exit_with_image 1 "${STATUS_ERROR}" "make insall_failed"
exit_with_image 1 "${STATUS_ERROR}" "make install failed"

STATUS_VARIABLES+=("${FUNCNAME[0]}='true'\n")
}
Expand Down
44 changes: 0 additions & 44 deletions notificationImages/Makefile

This file was deleted.

46 changes: 0 additions & 46 deletions scripts/Makefile

This file was deleted.

Loading